dnn: avoid unsafe fork fallback in NonZero death test

This commit is contained in:
abhishek-gola
2026-11-29 12:09:50 +05:30
parent 7236b399b8
commit 7aae1af9bd

View File

@@ -90,13 +90,12 @@ public:
TEST(Layer_NonZeroDeathTest, partition_independence)
{
#if GTEST_HAS_DEATH_TEST
// Re-execution needs GTest's saved working directory; otherwise use fork on POSIX.
// Re-execution needs GTest's saved working directory. Fork-only execution is
// unsafe when the test process already has threads (for example, on macOS).
const bool canReexec = ::testing::UnitTest::GetInstance()->original_working_dir()[0] != '\0';
#if defined(_WIN32)
if (!canReexec)
throw SkipTestException("NonZero partition test requires GTest subprocess support");
#endif
::testing::GTEST_FLAG(death_test_style) = canReexec ? "threadsafe" : "fast";
::testing::GTEST_FLAG(death_test_style) = "threadsafe";
// Keep the process-global backend override in the child, including on assertion failure.
EXPECT_EXIT(([] {
Mat input(4, 8, CV_32F, Scalar(1));