aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt15
-rw-r--r--test/unit_tests/CMakeLists.txt51
2 files changed, 52 insertions, 14 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3b61d11..ed1ebab 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,7 +1,10 @@
-add_executable(echo echo.cpp)
-set_target_properties(echo PROPERTIES OUTPUT_NAME winapi-common-test-echo)
+# echo.cpp is MSVC-only, I think.
+# TODO: fix that?
+if(MSVC)
+ add_executable(echo echo.cpp)
+ set_target_properties(echo PROPERTIES OUTPUT_NAME winapi-common-test-echo)
+ install(TARGETS echo RUNTIME DESTINATION bin)
+ install_pdbs(TARGETS echo DESTINATION bin)
-install(TARGETS echo RUNTIME DESTINATION bin)
-install_pdbs(TARGETS echo DESTINATION bin)
-
-add_subdirectory(unit_tests)
+ add_subdirectory(unit_tests)
+endif()
diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt
index c3d5b84..070e1bb 100644
--- a/test/unit_tests/CMakeLists.txt
+++ b/test/unit_tests/CMakeLists.txt
@@ -1,25 +1,60 @@
+find_package(Boost REQUIRED COMPONENTS unit_test_framework)
+
file(GLOB shared_src "shared/*.hpp")
file(GLOB unit_tests_src "*.cpp" "*.h" "*.hpp" "*.rc")
add_executable(unit_tests ${unit_tests_src} ${shared_src})
set_target_properties(unit_tests PROPERTIES OUTPUT_NAME winapi-common-unit-tests)
-
target_link_libraries(unit_tests PRIVATE winapi_common winapi_utf8)
-
-find_package(Boost REQUIRED COMPONENTS unit_test_framework)
target_link_libraries(unit_tests PRIVATE Boost::disable_autolinking Boost::unit_test_framework)
-
install(TARGETS unit_tests RUNTIME DESTINATION bin)
install_pdbs(TARGETS unit_tests DESTINATION bin)
file(GLOB worker_src "worker/*.cpp")
add_executable(worker ${worker_src} ${shared_src})
set_target_properties(worker PROPERTIES OUTPUT_NAME winapi-common-test-worker)
-
target_link_libraries(worker PRIVATE winapi_common winapi_utf8)
-
-find_package(Boost REQUIRED)
target_link_libraries(worker PRIVATE Boost::disable_autolinking Boost::boost)
-
install(TARGETS worker RUNTIME DESTINATION bin)
install_pdbs(TARGETS worker DESTINATION bin)
+
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
+
+add_test(NAME unit_tests COMMAND unit_tests
+ --log_level=all
+ --no_color_output
+ "--log_sink=$<TARGET_FILE_DIR:unit_tests>/unit_tests.log"
+ "--report_sink=$<TARGET_FILE_DIR:unit_tests>/unit_tests_report.txt"
+ --run_test=!console_tests,process_console_tests
+ --
+ "--echo_exe=$<TARGET_FILE:echo>"
+ "--worker_exe=$<TARGET_FILE:worker>")
+
+add_test(NAME unit_tests_report COMMAND Python3::Interpreter
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/tools/ctest-driver.py"
+ grep
+ --pass-regex [=[^\*\*\* No errors detected$]=]
+ --
+ "$<TARGET_FILE_DIR:unit_tests>/unit_tests_report.txt")
+
+add_test(NAME console_tests COMMAND Python3::Interpreter
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/tools/ctest-driver.py"
+ run
+ --new-window
+ --
+ "$<TARGET_FILE:unit_tests>"
+ --log_level=all
+ --no_color_output
+ "--log_sink=$<TARGET_FILE_DIR:unit_tests>/console_tests.log"
+ "--report_sink=$<TARGET_FILE_DIR:unit_tests>/console_tests_report.txt"
+ --run_test=console_tests,process_console_tests
+ --
+ "--echo_exe=$<TARGET_FILE:echo>"
+ "--worker_exe=$<TARGET_FILE:worker>")
+
+add_test(NAME console_tests_report COMMAND Python3::Interpreter
+ "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/tools/ctest-driver.py"
+ grep
+ --pass-regex [=[^\*\*\* No errors detected$]=]
+ --
+ "$<TARGET_FILE_DIR:unit_tests>/console_tests_report.txt")