Skip to content

Commit

Permalink
[CI] Enable check-sycl-unittests in CI (#12858)
Browse files Browse the repository at this point in the history
This PR enables testing unittests in CI.
  • Loading branch information
uditagarwal97 authored Mar 21, 2024
1 parent 2d0ee99 commit 445893a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/sycl-linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ jobs:
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
- name: check-sycl-unittests
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
run: |
# TODO consider moving this to Dockerfile.
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
cmake --build $GITHUB_WORKSPACE/build --target check-sycl-unittests
- name: check-llvm-spirv
if: always() && !cancelled() && contains(inputs.changes, 'llvm_spirv')
run: |
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sycl-windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ jobs:
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
run: |
cmake --build build --target check-sycl
- name: check-sycl-unittests
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
run: |
cmake --build build --target check-sycl-unittests
- name: check-llvm-spirv
if: always() && !cancelled() && contains(inputs.changes, 'llvm_spirv')
run: |
Expand Down
40 changes: 29 additions & 11 deletions sycl/cmake/modules/AddSYCLUnitTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,34 @@ macro(add_sycl_unittest test_dirname link_variant)
)
endif()

add_custom_target(check-sycl-${test_dirname}
${CMAKE_COMMAND} -E env
LLVM_PROFILE_FILE="${SYCL_COVERAGE_PATH}/${test_dirname}.profraw"
env SYCL_CONFIG_FILE_NAME=null.cfg
env SYCL_DEVICELIB_NO_FALLBACK=1
env SYCL_CACHE_DIR="${CMAKE_BINARY_DIR}/sycl_cache"
${CMAKE_CURRENT_BINARY_DIR}/${test_dirname}
DEPENDS
${test_dirname}
)
# check-sycl-unittests was using an old sycl library. So, to get
# around this problem, we add the new sycl library to the PATH and
# LD_LIBRARY_PATH on Windows and Linux respectively.
if (WIN32)
add_custom_target(check-sycl-${test_dirname}
${CMAKE_COMMAND} -E env
LLVM_PROFILE_FILE="${SYCL_COVERAGE_PATH}/${test_dirname}.profraw"
SYCL_CONFIG_FILE_NAME=null.cfg
SYCL_DEVICELIB_NO_FALLBACK=1
SYCL_CACHE_DIR="${CMAKE_BINARY_DIR}/sycl_cache"
"PATH=${CMAKE_BINARY_DIR}/bin;$ENV{PATH}"
${CMAKE_CURRENT_BINARY_DIR}/${test_dirname}
DEPENDS
${test_dirname}
)
else()
add_custom_target(check-sycl-${test_dirname}
${CMAKE_COMMAND} -E env
LLVM_PROFILE_FILE="${SYCL_COVERAGE_PATH}/${test_dirname}.profraw"
SYCL_CONFIG_FILE_NAME=null.cfg
SYCL_DEVICELIB_NO_FALLBACK=1
SYCL_CACHE_DIR="${CMAKE_BINARY_DIR}/sycl_cache"
"LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}"
${CMAKE_CURRENT_BINARY_DIR}/${test_dirname}
DEPENDS
${test_dirname}
)
endif()

add_dependencies(check-sycl-unittests check-sycl-${test_dirname})

Expand All @@ -60,7 +78,7 @@ macro(add_sycl_unittest test_dirname link_variant)
if(SYCL_ENABLE_KERNEL_FUSION)
target_link_libraries(${test_dirname} PRIVATE sycl-fusion)
endif(SYCL_ENABLE_KERNEL_FUSION)

target_include_directories(${test_dirname}
PRIVATE SYSTEM
${sycl_inc_dir}
Expand Down
4 changes: 3 additions & 1 deletion sycl/unittests/xpti_trace/QueueIDCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ TEST_F(QueueID, QueueCreationAndKernelWithDeps) {
checkTaskBeginEnd(QueueIDSTr);
}

TEST_F(QueueID, QueueCreationUSMOperations) {
// Re-enable this test after fixing
// https://github.com/intel/llvm/issues/12963
TEST_F(QueueID, DISABLED_QueueCreationUSMOperations) {
sycl::queue Q0;
auto Queue0ImplPtr = sycl::detail::getSyclObjImpl(Q0);
auto QueueIDSTr = std::to_string(Queue0ImplPtr->getQueueID());
Expand Down

0 comments on commit 445893a

Please sign in to comment.