portsmf-239-ctest.patch (2740B)
- From 7f24dac7f55e47667e78b6c5681b44ff2f0d5bff Mon Sep 17 00:00:00 2001
- From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
- Date: Thu, 26 Aug 2021 04:24:03 +0200
- Subject: [PATCH 1/2] CMake: hook up tests to CTest
- - test/test.cpp: remove prompt for Enter
- - "test" is a reserved name so smftest is used instead
- - Remove option for "BUILD_TESTING", CTest provides it, enabled by default
- Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
- ---
- CMakeLists.txt | 2 +-
- test/CMakeLists.txt | 5 +++--
- test/test.cpp | 2 --
- 3 files changed, 4 insertions(+), 5 deletions(-)
- diff --git a/CMakeLists.txt b/CMakeLists.txt
- index defe5f6..9d306f2 100644
- --- a/CMakeLists.txt
- +++ b/CMakeLists.txt
- @@ -92,7 +92,7 @@ if(BUILD_APPS)
- add_subdirectory(apps)
- endif()
- -option(BUILD_TESTING "Include test projects" OFF)
- +include(CTest)
- if(BUILD_TESTING)
- add_subdirectory(test)
- endif()
- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
- index 36f3104..cf989e5 100644
- --- a/test/CMakeLists.txt
- +++ b/test/CMakeLists.txt
- @@ -1,2 +1,3 @@
- -add_executable(test test.cpp)
- -target_link_libraries(test PortSMF)
- +add_executable(smftest test.cpp)
- +target_link_libraries(smftest PortSMF)
- +add_test(NAME smftest COMMAND smftest)
- diff --git a/test/test.cpp b/test/test.cpp
- index 3746d72..7553bb5 100644
- --- a/test/test.cpp
- +++ b/test/test.cpp
- @@ -831,6 +831,4 @@ int main()
- //test32();
- printf("*** Test 33 ... DISABLED\n");
- //test33();
- - printf("press enter to exit\n");
- - getchar();
- }
- From fa2459efa55bb4afc67457b1c3696fa1fb50bd50 Mon Sep 17 00:00:00 2001
- From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
- Date: Thu, 26 Aug 2021 04:39:28 +0200
- Subject: [PATCH 2/2] Github Workflows: Add CTest
- ctest(1) needs to be run into the build directory and doesn't accepts --config
- Windows is disabled because Github Workflows seems to be incomplete for CTest,
- as seen by the following log line with apparently means a missing DLL:
- 1/1 Test #1: smftest ..........................Exit code 0xc0000135
- Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
- ---
- .github/workflows/build.yml | 3 +++
- 1 file changed, 3 insertions(+)
- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
- index 3c5fac5..ddbc397 100644
- --- a/.github/workflows/build.yml
- +++ b/.github/workflows/build.yml
- @@ -34,6 +34,9 @@ jobs:
- run: cmake --build build ${{ matrix.cmake_config }}
- env:
- CMAKE_BUILD_PARALLEL_LEVEL: 2
- + - name: Test
- + if: ${{ runner.os != 'Windows' }}
- + run: cd build && ctest --build-config RelWithDebInfo --output-on-failure && cd ..
- - name: Install
- run: cmake --install . ${{ matrix.cmake_config }}
- working-directory: build