Repository navigation
Run C++ tests during building #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c877e4f
Install gtest package
PokhodenkoSA 72bec2d
Add Gtest tests
PokhodenkoSA fc28d40
Unskip test
a59726d
Update conda-recipe/build.sh
PokhodenkoSA 84d55f0
Fix using filesystem on Windows
PokhodenkoSA 7c203c3
Enable GTest for Windows
PokhodenkoSA 4be1f3c
Fix filesystem
PokhodenkoSA f994968
Fix filesystem
PokhodenkoSA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,40 @@ | ||
| string(COMPARE EQUAL "${GTEST_INCLUDE_DIR}" "" no_gtest_incl_dir) | ||
| string(COMPARE EQUAL "${GTEST_LIB_DIR}" "" no_gtest_lib_dir) | ||
|
|
||
| if(${no_gtest_incl_dir} OR ${no_gtest_lib_dir}) | ||
| message(WARNING | ||
| "GTest is needed to test dpCtl's C API test cases. Pass in \ | ||
| -DGTEST_INCLUDE_DIR and -DGTEST_LIB_DIR when you configure Cmake if\ | ||
| you wish to run dpCtl backend tests." | ||
| ) | ||
| else() | ||
| # We need thread support for gtest | ||
| find_package(Threads REQUIRED) | ||
|
|
||
| set(CMAKE_CTEST_COMMAND ctest -V) | ||
|
|
||
| # Emulate autotools like make check target to build tests | ||
| add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) | ||
| enable_testing() | ||
|
|
||
| include_directories(${GTEST_INCLUDE_DIR}) | ||
| include_directories(../include) | ||
|
|
||
| link_directories(${GTEST_LIB_DIR}) | ||
|
|
||
| set(DPCTL_C_API_TEST_CASES | ||
| test_sycl_kernel_interface | ||
| test_sycl_platform_interface | ||
| test_sycl_program_interface | ||
| test_sycl_queue_interface | ||
| test_sycl_queue_manager | ||
| find_package(GTest REQUIRED) | ||
|
|
||
| # We need thread support for gtest | ||
| find_package(Threads REQUIRED) | ||
|
|
||
| set(CMAKE_CTEST_COMMAND ctest -V) | ||
|
|
||
| # Emulate autotools like make check target to build tests | ||
| add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) | ||
| enable_testing() | ||
|
|
||
| include_directories(${GTEST_INCLUDE_DIR}) | ||
| include_directories(../include) | ||
|
|
||
| link_directories(${GTEST_LIB_DIR}) | ||
|
|
||
| set(PYDPPL_BACKEND_TEST_CASES | ||
| test_sycl_kernel_interface | ||
| test_sycl_platform_interface | ||
| test_sycl_program_interface | ||
| test_sycl_queue_interface | ||
| test_sycl_queue_manager | ||
| ) | ||
|
|
||
| # Copy the spir-v input files to test build directory | ||
| set(spirv-test-files | ||
| multi_kernel.spv | ||
| ) | ||
| foreach(tf ${spirv-test-files}) | ||
| file(COPY ${tf} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
| endforeach() | ||
|
|
||
| foreach(TEST_CASE ${PYDPPL_BACKEND_TEST_CASES}) | ||
| add_executable(${TEST_CASE} EXCLUDE_FROM_ALL ${TEST_CASE}.cpp) | ||
| target_link_libraries( | ||
| ${TEST_CASE} ${CMAKE_THREAD_LIBS_INIT} GTest::GTest DPPLSyclInterface | ||
| ) | ||
|
|
||
| # Copy the spir-v input files to test build directory | ||
| set(spirv-test-files | ||
| multi_kernel.spv | ||
| ) | ||
| foreach(tf ${spirv-test-files}) | ||
| file(COPY ${tf} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) | ||
| endforeach() | ||
|
|
||
| foreach(TEST_CASE ${DPCTL_C_API_TEST_CASES}) | ||
| add_executable(${TEST_CASE} EXCLUDE_FROM_ALL ${TEST_CASE}.cpp) | ||
| target_link_libraries( | ||
| ${TEST_CASE} ${CMAKE_THREAD_LIBS_INIT} gtest DPPLSyclInterface | ||
| ) | ||
| add_test(NAME ${TEST_CASE} COMMAND ${TEST_CASE}) | ||
| add_dependencies(check ${TEST_CASE}) | ||
| endforeach() | ||
| endif() | ||
| add_test(NAME ${TEST_CASE} COMMAND ${TEST_CASE}) | ||
| add_dependencies(check ${TEST_CASE}) | ||
| endforeach() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,7 +32,7 @@ cmake \ | |||||||||
| -DNUMPY_INCLUDE_DIR=${NUMPY_INC} \ | ||||||||||
| ../backends | ||||||||||
|
|
||||||||||
| make -j 4 && make install | ||||||||||
| make -j 4 && make check && make install | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| popd | ||||||||||
| cp install/lib/*.so dpctl/ | ||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ requirements: | |
| - make # [unix] | ||
| - ninja # [win] | ||
| - numpy >=1.17 | ||
| - gtest | ||
| run: | ||
| - python | ||
| - numpy >=1.17 | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.