diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-24 22:33:30 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-24 22:40:54 +0300 |
commit | a4eb193ea2d05ad6af821013c9bea17068773542 (patch) | |
tree | 1dd163549accf00c4c49489358d637bf21ed0935 /test | |
parent | add CTest tests (diff) | |
download | winapi-debug-a4eb193ea2d05ad6af821013c9bea17068773542.tar.gz winapi-debug-a4eb193ea2d05ad6af821013c9bea17068773542.zip |
unit_tests: dynamic path to test_lib.pdb
Diffstat (limited to 'test')
-rw-r--r-- | test/unit_tests/CMakeLists.txt | 8 | ||||
-rw-r--r-- | test/unit_tests/fixtures.hpp | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt index 90f8bed..ae43fbb 100644 --- a/test/unit_tests/CMakeLists.txt +++ b/test/unit_tests/CMakeLists.txt @@ -9,4 +9,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") install(FILES "$<TARGET_PDB_FILE:unit_tests>" DESTINATION bin/test OPTIONAL) endif() -add_test(NAME unit_tests COMMAND unit_tests --log_level=all --no_color_output) +if(MSVC) + # Set the working directory so that the unit_tests binary can find the + # test_lib shared library binary. + add_test(NAME unit_tests + COMMAND unit_tests --log_level=all --no_color_output -- --test_lib_pdb "$<TARGET_PDB_FILE:test_lib>" + WORKING_DIRECTORY "$<TARGET_FILE_DIR:test_lib>") +endif() diff --git a/test/unit_tests/fixtures.hpp b/test/unit_tests/fixtures.hpp index 85451d4..60047df 100644 --- a/test/unit_tests/fixtures.hpp +++ b/test/unit_tests/fixtures.hpp @@ -115,7 +115,12 @@ private: } static boost::filesystem::path get_module_pdb_path() { - return Paths::get().exe_dir / (get_module_name() + ".pdb"); + // That's pretty ad-hoc, but seems to work; based on + // https://www.boost.org/doc/libs/1_70_0/libs/test/doc/html/boost_test/runtime_config/custom_command_line_arguments.html + BOOST_TEST_REQUIRE(boost::unit_test::framework::master_test_suite().argc == 3); + BOOST_TEST_REQUIRE(boost::unit_test::framework::master_test_suite().argv[1] == + "--test_lib_pdb"); + return boost::unit_test::framework::master_test_suite().argv[2]; } }; |