git: a657b45bed31 - stable/15 - contrib/kyua: update to 0.15.1

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Mon, 23 Nov 2026 01:18:37 UTC
The branch stable/15 has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=a657b45bed31f1755d1fd7337094550f3b94991b

commit a657b45bed31f1755d1fd7337094550f3b94991b
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-10-28 22:02:27 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-11-23 01:17:40 +0000

    contrib/kyua: update to 0.15.1
    
    This new release contains multiple bugfixes. Please see the release
    notes mentioned in the merge commit for more details.
    
    MFC after:      2 weeks
    Merge commit '3e05143b80d1537cdd51a5dcf742da31f400507e'
    
    (cherry picked from commit b68969979d6b590247290b4fe26212d201c3ad96)
---
 contrib/kyua/NEWS                              |  19 +++
 contrib/kyua/README.md                         |   4 +-
 contrib/kyua/config.h                          |   6 +-
 contrib/kyua/doc/kyua-about.1                  |   2 +-
 contrib/kyua/drivers/debug_test.cpp            |   3 +
 contrib/kyua/drivers/run_tests.cpp             |   3 +
 contrib/kyua/engine/atf_test.cpp               |   1 +
 contrib/kyua/engine/googletest.cpp             |  27 +---
 contrib/kyua/engine/googletest_helpers.cpp     |  27 +---
 contrib/kyua/engine/googletest_list.cpp        |  27 +---
 contrib/kyua/engine/googletest_list_test.cpp   |  27 +---
 contrib/kyua/engine/googletest_result.cpp      | 195 +++++++++++++++++--------
 contrib/kyua/engine/googletest_result.hpp      |  31 +---
 contrib/kyua/engine/googletest_result_test.cpp | 141 ++++++++++++++----
 contrib/kyua/engine/googletest_test.cpp        |  28 +---
 contrib/kyua/engine/plain_test.cpp             |   1 +
 contrib/kyua/engine/scanner_test.cpp           |   1 +
 contrib/kyua/engine/scheduler_test.cpp         |  11 ++
 contrib/kyua/engine/tap_test.cpp               |   1 +
 contrib/kyua/utils/config/nodes.cpp            |   6 +-
 contrib/kyua/utils/config/tree.cpp             |  11 +-
 contrib/kyua/utils/sqlite/test_utils.hpp       |   4 +-
 22 files changed, 316 insertions(+), 260 deletions(-)

diff --git a/contrib/kyua/NEWS b/contrib/kyua/NEWS
index c794e6e60092..50a2c8257370 100644
--- a/contrib/kyua/NEWS
+++ b/contrib/kyua/NEWS
@@ -1,5 +1,24 @@
 # Major changes between releases
 
+## Changes in version 0.15.1
+
+**Released on 2026/10/25.**
+
+### Bugfixes
+
+* #324: googletest: fix "failed without a reason" scenario
+* #328: utils::sqlite: restore static on test helpers
+* #330: Address a number of issues with the GoogleTest parser
+* #331: GoogleTest: licensing and style cleanup
+* #332: model/metadata: source code cleanup post-748e27bb
+* #339: Guard dynamic_cast results before dereferencing
+
+### Developer Workflow Changes
+
+* #338: add 30 minutes timeout for Distcheck step of CI
+
+**Full Changelog**: https://github.com/freebsd/lutok/compare/kyua-0.15.0...kyua-0.15.1
+
 ## Changes in version 0.15.0
 
 **Released on 2026/10/07.**
diff --git a/contrib/kyua/README.md b/contrib/kyua/README.md
index e42d6da35377..b8b54d0413de 100644
--- a/contrib/kyua/README.md
+++ b/contrib/kyua/README.md
@@ -27,9 +27,9 @@ This is not an official Google product.
 
 ## Download
 
-The latest version of Kyua is 0.14.1 and was released on March 29th, 2025.
+The latest version of Kyua is 0.15.0 and was released on October 7th, 2026.
 
-Download: [kyua-0.14.1](../../releases/tag/kyua-0.14.1).
+Download: [kyua-0.15.0](../../releases/tag/kyua-0.15.0).
 
 See the [release notes](NEWS) for information about the changes in this
 and all previous releases.
diff --git a/contrib/kyua/config.h b/contrib/kyua/config.h
index d2e8728dde38..eba9c9cb1448 100644
--- a/contrib/kyua/config.h
+++ b/contrib/kyua/config.h
@@ -119,7 +119,7 @@
 #define PACKAGE_NAME "Kyua"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "Kyua 0.15.0"
+#define PACKAGE_STRING "Kyua 0.15.1"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "kyua"
@@ -128,7 +128,7 @@
 #define PACKAGE_URL "https://github.com/freebsd/kyua/"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.15.0"
+#define PACKAGE_VERSION "0.15.1"
 
 /* Define to 1 if all of the C89 standard headers exist (not just the ones
    required in a freestanding environment). This macro is provided for
@@ -136,4 +136,4 @@
 #define STDC_HEADERS 1
 
 /* Version number of package */
-#define VERSION "0.15.0"
+#define VERSION "0.15.1"
diff --git a/contrib/kyua/doc/kyua-about.1 b/contrib/kyua/doc/kyua-about.1
index ba3041f14447..c914fa33374e 100644
--- a/contrib/kyua/doc/kyua-about.1
+++ b/contrib/kyua/doc/kyua-about.1
@@ -48,7 +48,7 @@ The name of the package, which is
 .Sq kyua .
 .It
 The version number, which is
-.Sq 0.15.0 .
+.Sq 0.15.1 .
 .It
 License information.
 .It
diff --git a/contrib/kyua/drivers/debug_test.cpp b/contrib/kyua/drivers/debug_test.cpp
index 6bd3d4dc0731..2e0e56d22f46 100644
--- a/contrib/kyua/drivers/debug_test.cpp
+++ b/contrib/kyua/drivers/debug_test.cpp
@@ -42,6 +42,7 @@
 #include "utils/format/macros.hpp"
 #include "utils/fs/auto_cleaners.hpp"
 #include "utils/optional.ipp"
+#include "utils/sanity.hpp"
 
 namespace config = utils::config;
 namespace fs = utils::fs;
@@ -103,6 +104,8 @@ drivers::debug_test::drive(engine::debugger_ptr debugger,
     const scheduler::test_result_handle* test_result_handle =
         dynamic_cast< const scheduler::test_result_handle* >(
             result_handle.get());
+    if (test_result_handle == nullptr)
+        UNREACHABLE_MSG("Expected a test result handle from the scheduler");
     const model::test_result test_result = test_result_handle->test_result();
     result_handle->cleanup();
 
diff --git a/contrib/kyua/drivers/run_tests.cpp b/contrib/kyua/drivers/run_tests.cpp
index d92940005242..e8ee03385184 100644
--- a/contrib/kyua/drivers/run_tests.cpp
+++ b/contrib/kyua/drivers/run_tests.cpp
@@ -50,6 +50,7 @@
 #include "utils/noncopyable.hpp"
 #include "utils/optional.ipp"
 #include "utils/passwd.hpp"
+#include "utils/sanity.hpp"
 #include "utils/text/operations.ipp"
 
 namespace config = utils::config;
@@ -202,6 +203,8 @@ finish_test(scheduler::result_handle_ptr result_handle,
     const scheduler::test_result_handle* test_result_handle =
         dynamic_cast< const scheduler::test_result_handle* >(
             result_handle.get());
+    if (test_result_handle == nullptr)
+        UNREACHABLE_MSG("Expected a test result handle from the scheduler");
 
     put_test_result(test_case_id, *test_result_handle, tx);
 
diff --git a/contrib/kyua/engine/atf_test.cpp b/contrib/kyua/engine/atf_test.cpp
index 5f9b8c59663e..6c3f1cf03b06 100644
--- a/contrib/kyua/engine/atf_test.cpp
+++ b/contrib/kyua/engine/atf_test.cpp
@@ -150,6 +150,7 @@ run_one(const atf::tests::tc* tc, const char* test_case_name,
     const scheduler::test_result_handle* test_result_handle =
         dynamic_cast< const scheduler::test_result_handle* >(
             result_handle.get());
+    ATF_REQUIRE(test_result_handle != nullptr);
     atf::utils::cat_file(result_handle->stdout_file().str(), "stdout: ");
     atf::utils::cat_file(result_handle->stderr_file().str(), "stderr: ");
     ATF_REQUIRE_EQ(exp_result, test_result_handle->test_result());
diff --git a/contrib/kyua/engine/googletest.cpp b/contrib/kyua/engine/googletest.cpp
index e050410ba1f5..37d979585718 100644
--- a/contrib/kyua/engine/googletest.cpp
+++ b/contrib/kyua/engine/googletest.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 #include "engine/googletest.hpp"
 
diff --git a/contrib/kyua/engine/googletest_helpers.cpp b/contrib/kyua/engine/googletest_helpers.cpp
index 129a08a89b7c..1a57fa0e977e 100644
--- a/contrib/kyua/engine/googletest_helpers.cpp
+++ b/contrib/kyua/engine/googletest_helpers.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 extern "C" {
 #include <sys/stat.h>
diff --git a/contrib/kyua/engine/googletest_list.cpp b/contrib/kyua/engine/googletest_list.cpp
index f231cb9e7021..6c006687fe49 100644
--- a/contrib/kyua/engine/googletest_list.cpp
+++ b/contrib/kyua/engine/googletest_list.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 #include "engine/googletest_list.hpp"
 
diff --git a/contrib/kyua/engine/googletest_list_test.cpp b/contrib/kyua/engine/googletest_list_test.cpp
index 5052c2f133ad..d5e9545b15ba 100644
--- a/contrib/kyua/engine/googletest_list_test.cpp
+++ b/contrib/kyua/engine/googletest_list_test.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 #include "engine/googletest_list.hpp"
 
diff --git a/contrib/kyua/engine/googletest_result.cpp b/contrib/kyua/engine/googletest_result.cpp
index a1fc1f72da4d..9616fc292b86 100644
--- a/contrib/kyua/engine/googletest_result.cpp
+++ b/contrib/kyua/engine/googletest_result.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 #include "engine/googletest_result.hpp"
 
@@ -53,21 +30,46 @@ using utils::optional;
 
 namespace {
 
-/// Internal string for specifying invalid output.
-const std::string invalid_output_message = "invalid output";
-
 /// Regular expression for disabled tests line.
 const std::regex disabled_re(
     R"RE((YOU HAVE [[:digit:]]+ DISABLED TESTS?))RE"
 );
 
+/// Regular expression for buggy skipped message output. Should be resolved via
+/// google/googletest#5098 .
+const std::regex global_env_buggy_skip_prefix_re(
+    R"RE(.+: Skipped\n)RE"
+);
+
+/// Regular expression for starting sentinel for Global test environment.
+const std::regex global_env_context_start_re(
+    R"(\[\-+\][[:space:]]+Global test environment set-up)"
+);
+
+/// Regular expression for ending sentinel for Global test environment.
+const std::regex global_env_context_end_re(
+    R"(\[\-+\][[:space:]]+Global test environment tear-down)"
+);
+
+// CHECK_STYLE_DISABLE
+
+/// Regular expression for setup or teardown fixtures that fail for test
+/// suites.
+///
+/// This only applies to the failure result type, not the other ones.
+const std::regex suite_setup_or_teardown_failure_re(
+    R"RE(\[[[:space:]]+FAILED[[:space:]]+\][[:space:]]+[^:]+:[[:space:]]SetUpTestSuite or TearDownTestSuite)RE"
+);
+
+// CHECK_STYLE_ENABLE
+
 /// Regular expression for starting sentinel of results block.
-const std::regex starting_sentinel_re(
-    R"(\[[[:space:]]+RUN[[:space:]]+\][[:space:]]+[A-Za-z0-9]+\.[A-Za-z0-9]+)"
+const std::regex test_context_start_re(
+    R"(\[[[:space:]]+RUN[[:space:]]+\][[:space:]]+[^[:space:]]+)"
 );
 
 /// Regular expression for ending sentinel of results block.
-const std::regex ending_sentinel_re(
+const std::regex test_context_end_re(
     R"RE(\[[[:space:]]+(FAILED|OK|SKIPPED)[[:space:]]+\])RE"
 );
 
@@ -89,10 +91,13 @@ parse_without_reason(const std::string& status, const std::string& rest)
 
     if (status == "skipped")
         return engine::googletest_result(engine::googletest_result::skipped);
-    else {
-        INV(status == "successful");
+    else if (status == "successful")
         return engine::googletest_result(engine::googletest_result::successful);
-    }
+    else if (status == "failed")
+        return engine::googletest_result(engine::googletest_result::failed);
+    else
+        return engine::googletest_result(engine::googletest_result::broken,
+            F("bad status: '%s'; output was:\n%s") % status % rest);
 }
 
 
@@ -121,8 +126,10 @@ parse_with_reason(const std::string& status, const std::string& rest)
         return googletest_result(googletest_result::failed, rest);
     else if (status == "skipped")
         return googletest_result(googletest_result::skipped, rest);
+    else if (status == "successful")
+        return googletest_result(googletest_result::successful, rest);
     else
-        PRE_MSG(false, "Unexpected status");
+        PRE_MSG(false, F("Unexpected status: %s") % status);
 }
 
 
@@ -178,6 +185,9 @@ engine::googletest_result::googletest_result(
 /// have a bug), and thus why they are reported as broken instead of just failed
 /// (which is a legitimate result for a test case).
 ///
+/// TODO(ngie): replace ad hoc output format parsing with a structured file
+///             format, e.g., JSON or XML.
+///
 /// \param input The stream to read from.
 ///
 /// \return A generic representation of the result of the test case.
@@ -187,6 +197,7 @@ engine::googletest_result
 engine::googletest_result::parse(std::istream& input)
 {
     std::vector<std::string> lines;
+    std::string all_context;
 
     do {
         std::string line;
@@ -194,50 +205,107 @@ engine::googletest_result::parse(std::istream& input)
         if (!input.eof())
             line.push_back('\n');
         lines.push_back(line);
+        all_context += line;
     } while (input.good());
 
-    bool capture_context = false;
-    bool valid_output = false;
     std::string context, status;
+    bool capture_immediate_context = false;
+    bool global_env_message_start_seen = false;
+    bool valid_output = false;
 
     for (auto& line: lines) {
+        // FIXME: drop the line-by-line parsing and just use multiline regular
+        // expressions with associated matching or just bite the bullet and
+        // switch to a structured format like JSON or XML.
         std::smatch matches;
 
-        if (regex_search(line, matches, disabled_re)) {
+        if (std::regex_search(line, global_env_context_start_re)) {
+            global_env_message_start_seen = true;
+            // Issue 326: it's a common pattern for folks to use GoogleTest
+            // Environments to run checks and skip entire test suites if
+            // preconditions aren't met. We need to start capturing the context
+            // in this block, just in case no testcases are run.
+            //
+            // In the event test output is found later on, the context will be
+            // reset by design.
+            capture_immediate_context = true;
+            context = "";
+            continue;
+        }
+
+        if (std::regex_search(line, matches, disabled_re)) {
             context = matches[1];
             status = "disabled";
             valid_output = true;
             break;
         }
-        if (regex_search(line, matches, starting_sentinel_re)) {
-            capture_context = true;
+
+        if (!global_env_message_start_seen) {
+            continue;
+        }
+
+        if (std::regex_search(line, test_context_start_re)) {
+            capture_immediate_context = true;
+            // (Re)set the context to ensure that the test result information
+            // doesn't show up in the context parsed by kyua.
             context = "";
             continue;
         }
-        if (regex_search(line, matches, ending_sentinel_re)) {
+        if (std::regex_search(line, matches, test_context_end_re)) {
             std::string googletest_res = matches[1];
+
             if (googletest_res == "OK") {
-                context = "";
                 status = "successful";
             } else if (googletest_res == "FAILED") {
                 status = "failed";
             } else {
-                INV(googletest_res == "SKIPPED");
+                INV_MSG(googletest_res == "SKIPPED",
+                    F("expected SKIPPED; got %s") % googletest_res);
                 status = "skipped";
             }
-            capture_context = false;
+            capture_immediate_context = false;
+        }
+        if (std::regex_search(line, global_env_context_end_re)) {
+            capture_immediate_context = false;
             valid_output = true;
+            // Keep scanning in case, in case we run into
+            // `suite_setup_or_teardown_failure_re`.
         }
-        if (capture_context) {
+
+        if (std::regex_search(line, suite_setup_or_teardown_failure_re)) {
+            // Any failure context should get printed out earlier on, but in
+            // the event it isn't, just dump the whole test output for sanity's
+            // sake/debuggability.
+            if (context.empty()) {
+                context = \
+                    F("kyua: could not 'summarize' failure context; "
+                      "see full process output for more details:\n\n%s") %
+                    all_context;
+            }
+            status = "failed";
+        }
+
+        if (capture_immediate_context) {
             context += line;
         }
     }
+
     if (!valid_output) {
-        context = invalid_output_message;
+        context = googletest_invalid_output_message;
         status = "broken";
+    } else {
+        // See Issue 326 comments.
+        if (std::regex_search(context, global_env_buggy_skip_prefix_re)) {
+            // It is easier to replace the existing string instead of
+            // extracting the multiline match.
+            context = std::regex_replace(context,
+                global_env_buggy_skip_prefix_re, "");
+            status = "skipped";
+        }
     }
     if (status == "skipped" && context.empty())
-        context = bogus_googletest_skipped_nul_message;
+        context = googletest_bogus_skipped_nul_message;
+
     if (context.empty())
         return parse_without_reason(status, context);
     else
@@ -388,18 +456,21 @@ engine::googletest_result::apply(const optional< process::status >& status)
 model::test_result
 engine::googletest_result::externalize(void) const
 {
+
+    // FIXME(ngie,#323): some of these test result types may require a reason, and thus the
+    // `.get()` -> `.get_default("")` change might be a bug.
     switch (_type) {
     case googletest_result::broken:
-        return model::test_result(model::test_result_broken, _reason.get());
+        return model::test_result(model::test_result_broken, _reason.get_default(""));
 
     case googletest_result::disabled:
-        return model::test_result(model::test_result_skipped, _reason.get());
+        return model::test_result(model::test_result_skipped, _reason.get_default(""));
 
     case googletest_result::failed:
-        return model::test_result(model::test_result_failed, _reason.get());
+        return model::test_result(model::test_result_failed, _reason.get_default(""));
 
     case googletest_result::skipped:
-        return model::test_result(model::test_result_skipped, _reason.get());
+        return model::test_result(model::test_result_skipped, _reason.get_default(""));
 
     case googletest_result::successful:
         return model::test_result(model::test_result_passed);
@@ -486,16 +557,16 @@ engine::calculate_googletest_result(
     googletest_result result(googletest_result::broken, "Unknown result");
     try {
         result = googletest_result::load(results_file);
-        /// atf_result.cpp handles this by side-effect by setting a broken
-        /// result with "", which results in a std::runtime_error throw from
-        /// atf_result::parse(..). googletest_result::parse doesn't do that and
-        /// instead returns a broken result with a reason of
-        /// `invalid_output_message`, so that case needs to be tested for after
-        /// the fact to make sure the reason why `invalid_output_message` was
-        /// because of a program that crashed or failed.
+        // atf_result.cpp handles this by side-effect by setting a broken
+        // result with "", which results in a std::runtime_error throw from
+        // atf_result::parse(..). googletest_result::parse doesn't do that and
+        // instead returns a broken result with a reason of
+        // `googletest_invalid_output_message`, so that case needs to be
+        // tested for after the fact to confirm whether or not program crashed
+        // or failed.
         if (result.type() == googletest_result::broken && body_status) {
             const optional< std::string >& reason = result.reason();
-            if (reason && reason.get() == invalid_output_message) {
+            if (reason && reason.get() == googletest_invalid_output_message) {
                 result = googletest_result(
                     googletest_result::broken,
                     F("Error: Premature exit. Test case %s") %
@@ -506,11 +577,11 @@ engine::calculate_googletest_result(
         if (body_status)
             result = googletest_result(googletest_result::broken,
                 F("Error: %s. Test case %s") %
-		error.what() %
+                error.what() %
                 format_status(body_status.get()));
-	else {
+        else {
             // The test case timed out.  apply() handles this case later.
-	}
+        }
     } catch (const std::runtime_error& error) {
         if (body_status)
             result = googletest_result(
diff --git a/contrib/kyua/engine/googletest_result.hpp b/contrib/kyua/engine/googletest_result.hpp
index 325995be3221..f296ea701203 100644
--- a/contrib/kyua/engine/googletest_result.hpp
+++ b/contrib/kyua/engine/googletest_result.hpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 /// \file engine/googletest_result.hpp
 /// Functions and types to process the results of googletest-based test cases.
@@ -99,11 +76,13 @@ model::test_result calculate_googletest_result(
     const utils::optional< utils::process::status >&,
     const utils::fs::path&);
 
+/// Internal string for specifying invalid output.
+const std::string googletest_invalid_output_message = "invalid output";
 
 /// A bogus identifier for nul reasons provided by the test writer.
 ///
 /// TODO: Support nul messages with skipped results in the schema, etc.
-const std::string bogus_googletest_skipped_nul_message = "\n";
+const std::string googletest_bogus_skipped_nul_message = "\n";
 
 
 }  // namespace engine
diff --git a/contrib/kyua/engine/googletest_result_test.cpp b/contrib/kyua/engine/googletest_result_test.cpp
index 90bc2cc62b7d..0398a11359ee 100644
--- a/contrib/kyua/engine/googletest_result_test.cpp
+++ b/contrib/kyua/engine/googletest_result_test.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 #include "engine/googletest_result.hpp"
 
@@ -96,7 +73,8 @@ parse_ok_test(const engine::googletest_result::types& exp_type,
 
 
 PARSE(broken,
-      engine::googletest_result::broken, "invalid output",
+      engine::googletest_result::broken,
+      engine::googletest_invalid_output_message.c_str(),
       "invalid input");
 
 const char disabled_context[] = (
@@ -150,6 +128,71 @@ PARSE(failed,
       engine::googletest_result::failed, failed_context,
       failed_message);
 
+// CHECK_STYLE_DISABLE
+#if 0
+const char failed_parameterized_context[] = (
+"/usr/src/contrib/googletest/googletest/test/googletest-param-test-test.cc:882: Failure\n"
+"Expected: (global_count_) >= (2), actual: 1 vs 2\n"
+"If some (but not all) SeparateInstanceTest tests have been filtered out this test will fail. Make sure that all GeneratorEvaluationTest are selected or de-selected together by the test filter.\n"
+"\n"
+);
+#else
+const char failed_parameterized_context[] = (
+"kyua: could not 'summarize' failure context; see full process output for more details:\n"
+"\n"
+"Note: Google Test filter = FourElemSequence/SeparateInstanceTest.TestsRunInSeparateInstances/0\n"
+"[==========] Running 1 test from 1 test suite.\n"
+"[----------] Global test environment set-up.\n"
+"[----------] 1 test from FourElemSequence/SeparateInstanceTest\n"
+"[ RUN      ] FourElemSequence/SeparateInstanceTest.TestsRunInSeparateInstances/0\n"
+"[       OK ] FourElemSequence/SeparateInstanceTest.TestsRunInSeparateInstances/0 (0 ms)\n"
+"/usr/src/contrib/googletest/googletest/test/googletest-param-test-test.cc:882: Failure\n"
+"Expected: (global_count_) >= (2), actual: 1 vs 2\n"
+"If some (but not all) SeparateInstanceTest tests have been filtered out this test will fail. Make sure that all GeneratorEvaluationTest are selected or de-selected together by the test filter.\n"
+"\n"
+"[----------] 1 test from FourElemSequence/SeparateInstanceTest (0 ms total)\n"
+"\n"
+"[----------] Global test environment tear-down\n"
+"[==========] 1 test from 1 test suite ran. (0 ms total)\n"
+"[  PASSED  ] 1 test.\n"
+"[  FAILED  ] 0 tests, listed below:\n"
+"\n"
+" 0 FAILED TESTS\n"
+"[  FAILED  ] FourElemSequence/SeparateInstanceTest: SetUpTestSuite or TearDownTestSuite\n"
+"\n"
+" 1 FAILED TEST SUITE\n"
+);
+#endif
+
+const char failed_parameterized_message[] = (
+"Note: Google Test filter = FourElemSequence/SeparateInstanceTest.TestsRunInSeparateInstances/0\n"
+"[==========] Running 1 test from 1 test suite.\n"
+"[----------] Global test environment set-up.\n"
+"[----------] 1 test from FourElemSequence/SeparateInstanceTest\n"
+"[ RUN      ] FourElemSequence/SeparateInstanceTest.TestsRunInSeparateInstances/0\n"
+"[       OK ] FourElemSequence/SeparateInstanceTest.TestsRunInSeparateInstances/0 (0 ms)\n"
+"/usr/src/contrib/googletest/googletest/test/googletest-param-test-test.cc:882: Failure\n"
+"Expected: (global_count_) >= (2), actual: 1 vs 2\n"
+"If some (but not all) SeparateInstanceTest tests have been filtered out this test will fail. Make sure that all GeneratorEvaluationTest are selected or de-selected together by the test filter.\n"
+"\n"
+"[----------] 1 test from FourElemSequence/SeparateInstanceTest (0 ms total)\n"
+"\n"
+"[----------] Global test environment tear-down\n"
+"[==========] 1 test from 1 test suite ran. (0 ms total)\n"
+"[  PASSED  ] 1 test.\n"
+"[  FAILED  ] 0 tests, listed below:\n"
+"\n"
+" 0 FAILED TESTS\n"
+"[  FAILED  ] FourElemSequence/SeparateInstanceTest: SetUpTestSuite or TearDownTestSuite\n"
+"\n"
+" 1 FAILED TEST SUITE\n"
+);
+// CHECK_STYLE_ENABLE
+
+PARSE(failed_parameterized,
+      engine::googletest_result::failed, failed_parameterized_context,
+      failed_parameterized_message);
+
 const char skipped_message[] = (
 "Note: Google Test filter = SkipTest.DoesSkip\n"
 "[==========] Running 1 test from 1 test suite.\n"
@@ -168,7 +211,7 @@ const char skipped_message[] = (
 
 PARSE(skipped,
       engine::googletest_result::skipped,
-      engine::bogus_googletest_skipped_nul_message.c_str(),
+      engine::googletest_bogus_skipped_nul_message.c_str(),
       skipped_message
 );
 
@@ -197,6 +240,36 @@ PARSE(skipped_with_reason,
       engine::googletest_result::skipped, skipped_with_reason_context,
       skipped_with_reason_message);
 
+// Issue 326: test suites built against 0.18.0 which skip in
+// `Environment::SetUp` misreport tests passing instead of being skipped.
+//
+// https://github.com/google/googletest/issues/4653
+const char skipped_from_environment_with_buggy_output_context[] = (
+"current user is not allowed to mount\n"
+"\n"
+"current user is not allowed to mount\n"
+"\n"
+);
+
+const char skipped_from_environment_with_buggy_output_message[] = (
+"Note: Google Test filter = Setattr.eacces\n"
+"[==========] Running 1 test from 1 test suite.\n"
+"[----------] Global test environment set-up.\n"
+"/usr/src/tests/sys/fs/fusefs/utils.cc:95: Skipped\n"
+"current user is not allowed to mount\n"
+"\n"
+"current user is not allowed to mount\n"
+"\n"
+"[----------] Global test environment tear-down\n"
+"[==========] 1 test from 1 test suite ran. (0 ms total)\n"
+"[  PASSED  ] 1 test.\n"
+);
+
+PARSE(skipped_from_environment_with_buggy_output,
+      engine::googletest_result::skipped,
+      skipped_from_environment_with_buggy_output_context,
+      skipped_from_environment_with_buggy_output_message);
+
 const char successful_message[] = (
 "Note: Google Test filter = PassFailTest.Passes\n"
 "[==========] Running 1 test from 1 test case.\n"
@@ -251,7 +324,11 @@ PARSE(successful_parameterized,
       engine::googletest_result::successful, NULL,
       successful_parameterized_message);
 
-const char successful_message_with_reason[] = (
+const char successful_with_reason_context[] = (
+"This is a reason\n"
+);
+
+const char successful_with_reason_message[] = (
 "Note: Google Test filter = PassFailTest.PassesWithReason\n"
 "[==========] Running 1 test from 1 test suite.\n"
 "[----------] Global test environment set-up.\n"
@@ -267,8 +344,9 @@ const char successful_message_with_reason[] = (
 );
 
 PARSE(successful_with_reason,
-      engine::googletest_result::successful, NULL,
-      successful_message_with_reason);
+      engine::googletest_result::successful,
+      successful_with_reason_context,
+      successful_with_reason_message);
 
 ATF_TEST_CASE_WITHOUT_HEAD(googletest_result__load__ok);
 ATF_TEST_CASE_BODY(googletest_result__load__ok)
@@ -403,7 +481,10 @@ ATF_INIT_TEST_CASES(tcs)
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__broken);
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__disabled);
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__failed);
+    ATF_ADD_TEST_CASE(tcs, googletest_result__parse__failed_parameterized);
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__skipped);
+    ATF_ADD_TEST_CASE(tcs,
+        googletest_result__parse__skipped_from_environment_with_buggy_output);
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__skipped_with_reason);
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__successful);
     ATF_ADD_TEST_CASE(tcs, googletest_result__parse__successful2);
diff --git a/contrib/kyua/engine/googletest_test.cpp b/contrib/kyua/engine/googletest_test.cpp
index 3af4d6801e70..0e74dc80ce6a 100644
--- a/contrib/kyua/engine/googletest_test.cpp
+++ b/contrib/kyua/engine/googletest_test.cpp
@@ -1,30 +1,7 @@
-// Copyright 2024 The Kyua Authors.
+// Copyright 2026 The Kyua Authors.
 // All rights reserved.
 //
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-//   notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright
-//   notice, this list of conditions and the following disclaimer in the
-//   documentation and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors
-//   may be used to endorse or promote products derived from this software
-//   without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-2-Clause
 
 #include "engine/googletest.hpp"
 
@@ -146,6 +123,7 @@ run_one(const atf::tests::tc* tc, const char* test_case_name,
     const scheduler::test_result_handle* test_result_handle =
         dynamic_cast< const scheduler::test_result_handle* >(
             result_handle.get());
+    ATF_REQUIRE(test_result_handle != nullptr);
     atf::utils::cat_file(result_handle->stdout_file().str(), "stdout: ");
     atf::utils::cat_file(result_handle->stderr_file().str(), "stderr: ");
     ATF_REQUIRE_EQ(exp_result, test_result_handle->test_result());
diff --git a/contrib/kyua/engine/plain_test.cpp b/contrib/kyua/engine/plain_test.cpp
index cc3326e4c581..b9c81747bd2c 100644
--- a/contrib/kyua/engine/plain_test.cpp
+++ b/contrib/kyua/engine/plain_test.cpp
@@ -99,6 +99,7 @@ run_one(const atf::tests::tc* tc, const char* test_case_name,
     const scheduler::test_result_handle* test_result_handle =
         dynamic_cast< const scheduler::test_result_handle* >(
             result_handle.get());
+    ATF_REQUIRE(test_result_handle != nullptr);
     atf::utils::cat_file(result_handle->stdout_file().str(), "stdout: ");
     atf::utils::cat_file(result_handle->stderr_file().str(), "stderr: ");
     ATF_REQUIRE_EQ(exp_result, test_result_handle->test_result());
diff --git a/contrib/kyua/engine/scanner_test.cpp b/contrib/kyua/engine/scanner_test.cpp
index f79717eca49e..6d8aba1ac2e0 100644
--- a/contrib/kyua/engine/scanner_test.cpp
+++ b/contrib/kyua/engine/scanner_test.cpp
@@ -327,6 +327,7 @@ ATF_TEST_CASE_BODY(scanner__no_filters__verify_lazy_loads)
          iter != results.end(); ++iter) {
         const mock_test_program* mock_program =
             dynamic_cast< const mock_test_program* >((*iter).first.get());
+        ATF_REQUIRE(mock_program != nullptr);
         ATF_REQUIRE_EQ(1, mock_program->num_calls());
     }
 }
diff --git a/contrib/kyua/engine/scheduler_test.cpp b/contrib/kyua/engine/scheduler_test.cpp
index 93e7627f291a..ed7d23ccc0fa 100644
--- a/contrib/kyua/engine/scheduler_test.cpp
+++ b/contrib/kyua/engine/scheduler_test.cpp
@@ -577,6 +577,7 @@ ATF_TEST_CASE_BODY(integration__run_one)
     const scheduler::test_result_handle* test_result_handle =
         dynamic_cast< const scheduler::test_result_handle* >(
             result_handle.get());
+    ATF_REQUIRE(test_result_handle != nullptr);
     ATF_REQUIRE_EQ(exec_handle, result_handle->original_pid());
*** 171 LINES SKIPPED ***