aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-24 21:18:49 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-24 21:23:46 +0300
commitf166c71e88d84a640eed1bc99535856f5baac95b (patch)
tree9ebcc63633f9d18aed04056e40793c2a19e0efbc
parentworkflows/ci: Bionic to Focal (diff)
downloadwinapi-debug-f166c71e88d84a640eed1bc99535856f5baac95b.tar.gz
winapi-debug-f166c71e88d84a640eed1bc99535856f5baac95b.zip
add CTest tests
-rw-r--r--.github/workflows/ci.yml23
-rw-r--r--CMakeLists.txt2
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/unit_tests/CMakeLists.txt2
-rw-r--r--utils/CMakeLists.txt4
5 files changed, 13 insertions, 20 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5dc021c..0ba4227 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -70,25 +70,8 @@ jobs:
with:
name: 'pdb-repo-${{ matrix.os }}-${{ matrix.toolset }}-${{ matrix.platform }}-${{ matrix.configuration }}'
path: '${{ runner.workspace }}/build/install/'
- - name: Run unit tests
- run: ../build/install/bin/test/unit_tests --log_level=all
- if: runner.os == 'Windows'
- - name: Run enum_symbols tests
- run: ../build/install/bin/enum_symbols --pdb ../build/install/bin/test/test_lib.pdb --mask 'test_ns:*'
- if: runner.os == 'Windows'
- - name: Check enum_symbols output
- run: |
- $(../build/install/bin/enum_symbols --pdb ../build/install/bin/test/test_lib.pdb | Select-String -Pattern 'test_ns::baz' -SimpleMatch -Quiet) -or $(throw 'test_ns::baz not enumerated among the symbols')
- $(../build/install/bin/enum_symbols --pdb ../build/install/bin/test/test_lib.pdb | Select-String -Pattern 'test_ns::bar' -SimpleMatch -Quiet) -or $(throw 'test_ns::bar not enumerated among the symbols')
- $(../build/install/bin/enum_symbols --pdb ../build/install/bin/test/test_lib.pdb | Select-String -Pattern 'test_ns::foo' -SimpleMatch -Quiet) -or $(throw 'test_ns::foo not enumerated among the symbols')
- $(../build/install/bin/enum_symbols --pdb ../build/install/bin/test/test_lib.pdb | Select-String -Pattern 'test_ns::var' -SimpleMatch -Quiet) -or $(throw 'test_ns::var not enumerated among the symbols')
- if: runner.os == 'Windows'
- - name: Run call_stack
- run: ../build/install/bin/test/call_stack
- if: runner.os == 'Windows'
- - name: Check call_stack output
+ - name: Test
run: |
- $(../build/install/bin/test/call_stack | Select-String -Pattern '[test_lib!test_ns::baz' -SimpleMatch -Quiet) -or $(throw 'test_ns::baz not found in the call stack')
- $(../build/install/bin/test/call_stack | Select-String -Pattern '[test_lib!test_ns::bar' -SimpleMatch -Quiet) -or $(throw 'test_ns::bar not found in the call stack')
- $(../build/install/bin/test/call_stack | Select-String -Pattern '[test_lib!test_ns::foo' -SimpleMatch -Quiet) -or $(throw 'test_ns::foo not found in the call stack')
+ cd ../build/cmake
+ ctest -C '${{ env.CONFIGURATION }}' --verbose
if: runner.os == 'Windows'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 326519b..f86a3a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.5) # for Boost::* imported targets
project(pdb_repo CXX)
+enable_testing()
+
if(MSVC)
# This is an ugly hack to make the tests work.
# With incremental linking, the &func address does not point to the
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8851856..d429bce 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -18,4 +18,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
install(FILES "$<TARGET_PDB_FILE:call_stack>" DESTINATION bin/test OPTIONAL)
endif()
+add_test(NAME call_stack COMMAND call_stack)
+
add_subdirectory(unit_tests)
diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt
index 1241061..90f8bed 100644
--- a/test/unit_tests/CMakeLists.txt
+++ b/test/unit_tests/CMakeLists.txt
@@ -8,3 +8,5 @@ install(TARGETS unit_tests RUNTIME DESTINATION bin/test)
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)
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index f724654..712a9e8 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -13,3 +13,7 @@ endfunction()
add_util(enum_symbols enum_symbols.cpp command_line.hpp pdb_descr.hpp)
add_util(name2addr name2addr.cpp)
add_util(addr2name addr2name.cpp command_line.hpp pdb_descr.hpp)
+
+if(MSVC)
+ add_test(NAME enum_symbols COMMAND enum_symbols --pdb "$<TARGET_PDB_FILE:test_lib>" --mask "test_ns:*")
+endif()