From fe0eafc02b5f3b232e8975c66b03725e4e128d46 Mon Sep 17 00:00:00 2001 From: raistlin7447 Date: Sun, 14 Jun 2026 04:44:20 -0500 Subject: [PATCH] Fix Unit Tests CI job that silently ran zero tests (#14175) Fix Unit Tests CI job silently running zero tests scripts/run_unit_tests.sh selected tests with `ctest -L "Http|PlaceholderParser"`, but catch_discover_tests() was called without ADD_TAGS_AS_LABELS, so Catch2 tags were never registered as CTest labels. The -L filter matched nothing and the job passed green while running no tests ("No tests were found!!!"). Tests have not run in CI since PR #11485 added that -L line (2025-12-23). Register tags as labels via a shared orcaslicer_discover_tests() wrapper in tests/CMakeLists.txt (passing ADD_TAGS_AS_LABELS), routed through all five test suites. Restore full-suite execution by replacing the narrow -L selection with a `-LE NotWorking` exclusion, so all reliable tests gate PRs again (the suite ran in full before #11485). Tag the two OrcaCloudServiceAgent display-name tests [NotWorking]: their constructor reaches wxStandardPaths::Get().GetUserDataDir(), which dereferences the null wxTheApp in the headless test binary and segfaults on every platform. Excluded until the agent can be constructed without the wx app context. CI now runs 151 tests (was 0) and passes. --- scripts/run_unit_tests.sh | 4 +++- tests/CMakeLists.txt | 5 +++++ tests/fff_print/CMakeLists.txt | 2 +- tests/libnest2d/CMakeLists.txt | 2 +- tests/libslic3r/CMakeLists.txt | 2 +- tests/sla_print/CMakeLists.txt | 2 +- tests/slic3rutils/CMakeLists.txt | 2 +- tests/slic3rutils/slic3rutils_tests_main.cpp | 6 ++++-- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index 292c6c9d3f..bd9e969227 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -9,4 +9,6 @@ ROOT_DIR="$(dirname "$0")/.." cd "${ROOT_DIR}" || exit 1 -ctest --test-dir build/tests -L "Http|PlaceholderParser" --output-junit "$(pwd)/ctest_results.xml" --output-on-failure -j +# Run the whole suite, excluding tests tagged [NotWorking]. +# --no-tests=error fails the job if the filter matches nothing (instead of passing green). +ctest --test-dir build/tests -LE "NotWorking" --no-tests=error --output-junit "$(pwd)/ctest_results.xml" --output-on-failure -j diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6b93962a33..1108fe9350 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,6 +47,11 @@ function(orcaslicer_copy_test_dlls) endforeach() endfunction() +# Register Catch2 tags as CTest labels so `ctest -L`/`-LE` can filter by tag. +function(orcaslicer_discover_tests TARGET) + catch_discover_tests(${TARGET} ADD_TAGS_AS_LABELS) +endfunction() + add_subdirectory(libnest2d) add_subdirectory(libslic3r) add_subdirectory(slic3rutils) diff --git a/tests/fff_print/CMakeLists.txt b/tests/fff_print/CMakeLists.txt index 452a40adb9..1467c1397f 100644 --- a/tests/fff_print/CMakeLists.txt +++ b/tests/fff_print/CMakeLists.txt @@ -21,4 +21,4 @@ set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") orcaslicer_copy_test_dlls() -catch_discover_tests(${_TEST_NAME}_tests) +orcaslicer_discover_tests(${_TEST_NAME}_tests) diff --git a/tests/libnest2d/CMakeLists.txt b/tests/libnest2d/CMakeLists.txt index 6ead7f11a0..2c36b9cdcb 100644 --- a/tests/libnest2d/CMakeLists.txt +++ b/tests/libnest2d/CMakeLists.txt @@ -10,4 +10,4 @@ set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") orcaslicer_copy_test_dlls() -catch_discover_tests(${_TEST_NAME}_tests) +orcaslicer_discover_tests(${_TEST_NAME}_tests) diff --git a/tests/libslic3r/CMakeLists.txt b/tests/libslic3r/CMakeLists.txt index 1824df8dc0..9c451e0456 100644 --- a/tests/libslic3r/CMakeLists.txt +++ b/tests/libslic3r/CMakeLists.txt @@ -38,4 +38,4 @@ set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") orcaslicer_copy_test_dlls() -catch_discover_tests(${_TEST_NAME}_tests) +orcaslicer_discover_tests(${_TEST_NAME}_tests) diff --git a/tests/sla_print/CMakeLists.txt b/tests/sla_print/CMakeLists.txt index bb53f5bee2..b348e21bdc 100644 --- a/tests/sla_print/CMakeLists.txt +++ b/tests/sla_print/CMakeLists.txt @@ -9,4 +9,4 @@ set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") orcaslicer_copy_test_dlls() -catch_discover_tests(${_TEST_NAME}_tests) +orcaslicer_discover_tests(${_TEST_NAME}_tests) diff --git a/tests/slic3rutils/CMakeLists.txt b/tests/slic3rutils/CMakeLists.txt index e734fcf6c6..30f58a9562 100644 --- a/tests/slic3rutils/CMakeLists.txt +++ b/tests/slic3rutils/CMakeLists.txt @@ -12,4 +12,4 @@ set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") orcaslicer_copy_test_dlls() -catch_discover_tests(${_TEST_NAME}_tests) +orcaslicer_discover_tests(${_TEST_NAME}_tests) diff --git a/tests/slic3rutils/slic3rutils_tests_main.cpp b/tests/slic3rutils/slic3rutils_tests_main.cpp index cea6934e8e..e29b518f3d 100644 --- a/tests/slic3rutils/slic3rutils_tests_main.cpp +++ b/tests/slic3rutils/slic3rutils_tests_main.cpp @@ -53,7 +53,8 @@ TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") { REQUIRE(status == 200); } -TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCloudServiceAgent]") +// [NotWorking]: OrcaCloudServiceAgent ctor segfaults headless (wxStandardPaths::Get() -> null wxTheApp). +TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCloudServiceAgent][NotWorking]") { CHECK(resolved_display_name(flat_session_json({ {"username", "orca_username"}, @@ -81,7 +82,8 @@ TEST_CASE("Orca cloud flat session resolves display name consistently", "[OrcaCl })) == "orca_username"); } -TEST_CASE("Orca cloud nested session resolves display name consistently", "[OrcaCloudServiceAgent]") +// [NotWorking]: see flat-session test above. +TEST_CASE("Orca cloud nested session resolves display name consistently", "[OrcaCloudServiceAgent][NotWorking]") { CHECK(resolved_display_name(nested_session_json({ {"username", "orca_username"},