logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

portsmf-239-ctest.patch (2740B)


  1. From 7f24dac7f55e47667e78b6c5681b44ff2f0d5bff Mon Sep 17 00:00:00 2001
  2. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  3. Date: Thu, 26 Aug 2021 04:24:03 +0200
  4. Subject: [PATCH 1/2] CMake: hook up tests to CTest
  5. - test/test.cpp: remove prompt for Enter
  6. - "test" is a reserved name so smftest is used instead
  7. - Remove option for "BUILD_TESTING", CTest provides it, enabled by default
  8. Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
  9. ---
  10. CMakeLists.txt | 2 +-
  11. test/CMakeLists.txt | 5 +++--
  12. test/test.cpp | 2 --
  13. 3 files changed, 4 insertions(+), 5 deletions(-)
  14. diff --git a/CMakeLists.txt b/CMakeLists.txt
  15. index defe5f6..9d306f2 100644
  16. --- a/CMakeLists.txt
  17. +++ b/CMakeLists.txt
  18. @@ -92,7 +92,7 @@ if(BUILD_APPS)
  19. add_subdirectory(apps)
  20. endif()
  21. -option(BUILD_TESTING "Include test projects" OFF)
  22. +include(CTest)
  23. if(BUILD_TESTING)
  24. add_subdirectory(test)
  25. endif()
  26. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
  27. index 36f3104..cf989e5 100644
  28. --- a/test/CMakeLists.txt
  29. +++ b/test/CMakeLists.txt
  30. @@ -1,2 +1,3 @@
  31. -add_executable(test test.cpp)
  32. -target_link_libraries(test PortSMF)
  33. +add_executable(smftest test.cpp)
  34. +target_link_libraries(smftest PortSMF)
  35. +add_test(NAME smftest COMMAND smftest)
  36. diff --git a/test/test.cpp b/test/test.cpp
  37. index 3746d72..7553bb5 100644
  38. --- a/test/test.cpp
  39. +++ b/test/test.cpp
  40. @@ -831,6 +831,4 @@ int main()
  41. //test32();
  42. printf("*** Test 33 ... DISABLED\n");
  43. //test33();
  44. - printf("press enter to exit\n");
  45. - getchar();
  46. }
  47. From fa2459efa55bb4afc67457b1c3696fa1fb50bd50 Mon Sep 17 00:00:00 2001
  48. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  49. Date: Thu, 26 Aug 2021 04:39:28 +0200
  50. Subject: [PATCH 2/2] Github Workflows: Add CTest
  51. ctest(1) needs to be run into the build directory and doesn't accepts --config
  52. Windows is disabled because Github Workflows seems to be incomplete for CTest,
  53. as seen by the following log line with apparently means a missing DLL:
  54. 1/1 Test #1: smftest ..........................Exit code 0xc0000135
  55. Signed-off-by: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
  56. ---
  57. .github/workflows/build.yml | 3 +++
  58. 1 file changed, 3 insertions(+)
  59. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
  60. index 3c5fac5..ddbc397 100644
  61. --- a/.github/workflows/build.yml
  62. +++ b/.github/workflows/build.yml
  63. @@ -34,6 +34,9 @@ jobs:
  64. run: cmake --build build ${{ matrix.cmake_config }}
  65. env:
  66. CMAKE_BUILD_PARALLEL_LEVEL: 2
  67. + - name: Test
  68. + if: ${{ runner.os != 'Windows' }}
  69. + run: cd build && ctest --build-config RelWithDebInfo --output-on-failure && cd ..
  70. - name: Install
  71. run: cmake --install . ${{ matrix.cmake_config }}
  72. working-directory: build