mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 21:22:43 -06:00
dnn: avoid unsafe fork fallback in NonZero death test
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user