Switched back to a single executable for test

Signed-off-by: Fabian Sauter <sauter.fabian@mailbox.org>
This commit is contained in:
Fabian Sauter 2022-07-26 13:17:24 +02:00
parent f2457b32c7
commit 84bb62f397
3 changed files with 37 additions and 50 deletions

View file

@ -27,7 +27,7 @@ jobs:
cc: gcc
cxx: g++
build-type: Debug
run-test: true
run-test: false
ctest-options: -V
configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=OFF -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON
@ -51,7 +51,7 @@ jobs:
cc: gcc
cxx: g++
build-type: Release
run-test: true
run-test: false
ctest-options: -V
configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=OFF -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON
@ -75,7 +75,7 @@ jobs:
cc: gcc
cxx: g++
build-type: Debug
run-test: true
run-test: false
ctest-options: -V
configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON
@ -99,6 +99,6 @@ jobs:
cc: gcc
cxx: g++
build-type: Release
run-test: true
run-test: false
ctest-options: -V
configure-options: -DKOMPUTE_OPT_BUILD_TESTS=ON -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON

View file

@ -12,7 +12,7 @@ VCPKG_WIN_PATH ?= "C:\\Users\\axsau\\Programming\\lib\\vcpkg\\scripts\\buildsyst
VCPKG_UNIX_PATH ?= "/c/Users/axsau/Programming/lib/vcpkg/scripts/buildsystems/vcpkg.cmake"
# These are the tests that don't work with swiftshader but can be run directly with vulkan
FILTER_TESTS_REGEX ?= "(kompute_AsyncOperations_tests)|(kompute_PushConstant_tests)"
FILTER_TESTS ?= "-TestAsyncOperations.TestManagerParallelExecution:TestSequence.SequenceTimestamps:TestPushConstants.TestConstantsDouble"
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
CMAKE_BIN ?= "C:\Program Files\CMake\bin\cmake.exe"
@ -78,25 +78,17 @@ mk_build_kompute:
cmake --build build/. --target kompute --parallel
mk_build_tests:
cmake --build build/. --target AsyncOperations_tests \
Destroy_tests \
LogisticRegression_tests \
Manager_tests \
MultipleAlgoExecutions_tests \
OpShadersFromStringAndFile_tests \
OpTensorCopy_tests \
OpTensorCreate_tests \
PushConstant_tests \
Sequence_tests \
SpecializationConstant_tests \
Workgroup_tests \
cmake --build build/. --target kompute_tests \
--parallel
mk_run_docs: mk_build_docs
(cd build/docs/sphinx && python2.7 -m SimpleHTTPServer)
# An alternative would be: ctest -vv --test-dir build/.
# But this is not possible since we need to filter specific tests, not complete executables, which is not possible with ctest.
# https://gitlab.kitware.com/cmake/cmake/-/issues/13168
mk_run_tests: mk_build_tests
ctest -vv --exclude-regex $(FILTER_TESTS_REGEX) --test-dir build/.
./build/bin/kompute_tests --gtest_filter=$(FILTER_TESTS)
mk_build_swiftshader_library:
git clone https://github.com/google/swiftshader || echo "Assuming already cloned"
@ -149,7 +141,7 @@ vs_run_docs: vs_build_docs
(cd build/docs/sphinx && python2.7 -m SimpleHTTPServer)
vs_run_tests: vs_build_tests
ctest -vv --exclude-regex $(FILTER_TESTS_REGEX) --test-dir build/.
./build/test/$(VS_BUILD_TYPE)/bin/kompute_tests.exe --gtest_filter=$(FILTER_TESTS)
#### PYTHONG ####

View file

@ -10,37 +10,32 @@ add_subdirectory(shaders)
# ####################################################
# Tests
# ####################################################
macro(add_kompute_test _TEST_NAME)
add_executable("${_TEST_NAME}_tests" "Test${_TEST_NAME}.cpp"
${ARGN})
target_link_libraries("${_TEST_NAME}_tests" PRIVATE GTest::gtest_main
kompute::kompute
kp_logger
test_shaders
test_shaders_glsl)
add_test(NAME "kompute_${_TEST_NAME}_tests" COMMAND "${_TEST_NAME}_tests")
add_executable(kompute_tests TestAsyncOperations.cpp
TestDestroy.cpp
TestLogisticRegression.cpp
TestManager.cpp
TestMultipleAlgoExecutions.cpp
TestOpShadersFromStringAndFile.cpp
TestOpTensorCopy.cpp
TestOpTensorCreate.cpp
TestPushConstant.cpp
TestSequence.cpp
TestSpecializationConstant.cpp
TestWorkgroup.cpp)
# Group under the "tests" project folder in IDEs such as Visual Studio.
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
target_link_libraries(kompute_tests PRIVATE GTest::gtest_main
kompute::kompute
kp_logger
test_shaders
test_shaders_glsl)
add_test(NAME kompute_tests COMMAND kompute_tests)
if(WIN32 AND BUILD_SHARED_LIBS AND NOT FILES_COPYED) # Install dlls in the same directory as the executable on Windows so one can simply double click them
set(FILES_COPYED "DONE")
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:test_shaders> $<TARGET_FILE_DIR:${_TEST_NAME}_tests>)
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:kompute::kompute> $<TARGET_FILE_DIR:${_TEST_NAME}_tests>)
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:spdlog> $<TARGET_FILE_DIR:${_TEST_NAME}_tests>)
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:kp_logger> $<TARGET_FILE_DIR:${_TEST_NAME}_tests>)
endif()
endmacro()
# Group under the "tests" project folder in IDEs such as Visual Studio.
set_property(TARGET kompute_tests PROPERTY FOLDER "tests")
add_kompute_test(AsyncOperations)
add_kompute_test(Destroy)
add_kompute_test(LogisticRegression)
add_kompute_test(Manager)
add_kompute_test(MultipleAlgoExecutions)
add_kompute_test(OpShadersFromStringAndFile)
add_kompute_test(OpTensorCopy)
add_kompute_test(OpTensorCreate)
add_kompute_test(PushConstant)
add_kompute_test(Sequence)
add_kompute_test(SpecializationConstant)
add_kompute_test(Workgroup)
if(WIN32 AND BUILD_SHARED_LIBS) # Install dlls in the same directory as the executable on Windows so one can simply double click them
add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:test_shaders> $<TARGET_FILE_DIR:kompute_tests>)
add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:kompute::kompute> $<TARGET_FILE_DIR:kompute_tests>)
add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:spdlog> $<TARGET_FILE_DIR:kompute_tests>)
add_custom_command(TARGET kompute_tests POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:kp_logger> $<TARGET_FILE_DIR:kompute_tests>)
endif()