mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Improve C++ test infrastructure: progress reporter, timeouts, and skip hanging Move Subinterpreter test (#5942)
* Improve C++ test infrastructure and disable hanging test This commit improves the C++ test infrastructure to ensure test output is visible in CI logs, and disables a test that hangs on free-threaded Python 3.14+. Changes: ## CI/test infrastructure improvements - .github/workflows: Added `timeout-minutes: 3` to all C++ test steps to prevent indefinite hangs. - tests/**/CMakeLists.txt: Added `USES_TERMINAL` to C++ test targets (cpptest, test_cross_module_rtti, test_pure_cpp) to ensure output is shown immediately rather than buffered and possibly lost on crash/timeout. - tests/test_with_catch/catch.cpp: Added a custom Catch2 progress reporter with timestamps, Python version info, and a SIGTERM handler to make test execution and failures clearly visible in CI logs. ## Disabled hanging test - The "Move Subinterpreter" test is disabled on free-threaded Python 3.14+ due to a hang in Py_EndInterpreter() when the subinterpreter is destroyed from a different thread than it was created on. Work on fixing the underlying issue will continue under PR #5940. Context: We were in the dark for months (since we started testing with Python 3.14t) because CI logs gave no clue about the root cause of hangs. This led to ignoring intermittent hangs (mostly on macOS). Our hand was forced only with the Python 3.14.1 release, when hangs became predictable on all platforms. For the full development history of these changes, see PR #5933. * Add test summary to progress reporter Print the total number of test cases and assertions at the end of the test run, making it easy to spot if tests are disabled or added. Example output: [ PASSED ] 20 test cases, 1589 assertions. * Add PYBIND11_CATCH2_SKIP_IF macro to skip tests at runtime Catch2 v2 doesn't have native skip support (v3 does with SKIP()). This macro allows tests to be skipped with a visible message while still appearing in the test list. Use this for the Move Subinterpreter test on free-threaded Python 3.14+ so it shows as skipped rather than being conditionally compiled out. Example output: [ RUN ] Move Subinterpreter [ SKIPPED ] Skipped on free-threaded Python 3.14+ (see PR #5940) [ OK ] Move Subinterpreter * Fix clang-tidy bugprone-macro-parentheses warning in PYBIND11_CATCH2_SKIP_IF
This commit is contained in:
committed by
GitHub
parent
3aeb113b0a
commit
78381e5e28
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@@ -229,6 +229,7 @@ jobs:
|
||||
run: cmake --build . --target pytest
|
||||
|
||||
- name: Compiled tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build . --target cpptest
|
||||
|
||||
- name: Interface test
|
||||
@@ -334,6 +335,7 @@ jobs:
|
||||
run: cmake --build --preset default --target pytest
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build --preset default --target cpptest
|
||||
|
||||
- name: Visibility test
|
||||
@@ -393,6 +395,7 @@ jobs:
|
||||
run: cmake --build build --target pytest
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build --target cpptest
|
||||
|
||||
- name: Interface test
|
||||
@@ -516,6 +519,7 @@ jobs:
|
||||
run: cmake --build build --target pytest
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build --target cpptest
|
||||
|
||||
- name: Interface test
|
||||
@@ -570,6 +574,7 @@ jobs:
|
||||
run: cmake --build build --target pytest
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build --target cpptest
|
||||
|
||||
- name: Interface test
|
||||
@@ -652,6 +657,7 @@ jobs:
|
||||
cmake --build build-11 --target check
|
||||
|
||||
- name: C++ tests C++11
|
||||
timeout-minutes: 3
|
||||
run: |
|
||||
set +e; source /opt/intel/oneapi/setvars.sh; set -e
|
||||
cmake --build build-11 --target cpptest
|
||||
@@ -689,6 +695,7 @@ jobs:
|
||||
cmake --build build-17 --target check
|
||||
|
||||
- name: C++ tests C++17
|
||||
timeout-minutes: 3
|
||||
run: |
|
||||
set +e; source /opt/intel/oneapi/setvars.sh; set -e
|
||||
cmake --build build-17 --target cpptest
|
||||
@@ -760,6 +767,7 @@ jobs:
|
||||
run: cmake --build build --target pytest
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build --target cpptest
|
||||
|
||||
- name: Interface test
|
||||
@@ -1001,6 +1009,7 @@ jobs:
|
||||
run: cmake --build build --target pytest
|
||||
|
||||
- name: C++20 tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build --target cpptest -j 2
|
||||
|
||||
- name: Interface test C++20
|
||||
@@ -1077,6 +1086,7 @@ jobs:
|
||||
run: cmake --build build --target pytest -j 2
|
||||
|
||||
- name: C++11 tests
|
||||
timeout-minutes: 3
|
||||
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build --target cpptest -j 2
|
||||
|
||||
- name: Interface test C++11
|
||||
@@ -1101,6 +1111,7 @@ jobs:
|
||||
run: cmake --build build2 --target pytest -j 2
|
||||
|
||||
- name: C++14 tests
|
||||
timeout-minutes: 3
|
||||
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build2 --target cpptest -j 2
|
||||
|
||||
- name: Interface test C++14
|
||||
@@ -1125,6 +1136,7 @@ jobs:
|
||||
run: cmake --build build3 --target pytest -j 2
|
||||
|
||||
- name: C++17 tests
|
||||
timeout-minutes: 3
|
||||
run: PYTHONHOME=/${{matrix.sys}} PYTHONPATH=/${{matrix.sys}} cmake --build build3 --target cpptest -j 2
|
||||
|
||||
- name: Interface test C++17
|
||||
@@ -1196,6 +1208,7 @@ jobs:
|
||||
run: cmake --build . --target pytest -j 2
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build . --target cpptest -j 2
|
||||
|
||||
- name: Interface test
|
||||
@@ -1258,6 +1271,7 @@ jobs:
|
||||
run: cmake --build . --target pytest -j 2
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build . --target cpptest -j 2
|
||||
|
||||
- name: Interface test
|
||||
@@ -1330,6 +1344,7 @@ jobs:
|
||||
run: cmake --build build --target pytest -j 2
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: PYTHONHOME=/clangarm64 PYTHONPATH=/clangarm64 cmake --build build --target cpptest -j 2
|
||||
|
||||
- name: Interface test
|
||||
|
||||
1
.github/workflows/reusable-standard.yml
vendored
1
.github/workflows/reusable-standard.yml
vendored
@@ -83,6 +83,7 @@ jobs:
|
||||
run: cmake --build build --target pytest
|
||||
|
||||
- name: C++ tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build --target cpptest
|
||||
|
||||
- name: Interface test
|
||||
|
||||
2
.github/workflows/upstream.yml
vendored
2
.github/workflows/upstream.yml
vendored
@@ -66,6 +66,7 @@ jobs:
|
||||
run: cmake --build build11 --target pytest -j 2
|
||||
|
||||
- name: C++11 tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build11 --target cpptest -j 2
|
||||
|
||||
- name: Interface test C++11
|
||||
@@ -87,6 +88,7 @@ jobs:
|
||||
run: cmake --build build17 --target pytest
|
||||
|
||||
- name: C++17 tests
|
||||
timeout-minutes: 3
|
||||
run: cmake --build build17 --target cpptest
|
||||
|
||||
# Third build - C++17 mode with unstable ABI
|
||||
|
||||
Reference in New Issue
Block a user