From 0f8f32a92ac4f6c6e233e17104302aa61281aee5 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 20 Dec 2025 19:37:53 -0800 Subject: [PATCH] Disable stdout buffering in test_with_catch Ensure test output appears immediately in CI logs by disabling stdout buffering. Without this, output may be lost if the process is killed by a timeout, making it difficult to diagnose which test was hanging. --- tests/test_with_catch/catch.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_with_catch/catch.cpp b/tests/test_with_catch/catch.cpp index 46edbd294..80cbf1bb9 100644 --- a/tests/test_with_catch/catch.cpp +++ b/tests/test_with_catch/catch.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,11 @@ std::string get_utc_timestamp() { } // namespace int main(int argc, char *argv[]) { + // Disable stdout buffering to ensure output appears immediately in CI logs. + // Without this, output may be lost if the process is killed by a timeout. + std::cout.setf(std::ios::unitbuf); + setvbuf(stdout, nullptr, _IONBF, 0); + // Setup for TEST_CASE in test_interpreter.cpp, tagging on a large random number: std::string updated_pythonpath("pybind11_test_with_catch_PYTHONPATH_2099743835476552"); const char *preexisting_pythonpath = getenv("PYTHONPATH");