Fix the test of per-iteration fixture skipping to reflect the actual behavior. PiperOrigin-RevId: 903818763
diff --git a/e2e_tests/functional_test.cc b/e2e_tests/functional_test.cc index d813c43..6133473 100644 --- a/e2e_tests/functional_test.cc +++ b/e2e_tests/functional_test.cc
@@ -661,11 +661,17 @@ EXPECT_THAT(status, Eq(ExitCode(0))); } -TEST_F(UnitTestModeTest, TestIsSkippedWhenRequestedInFixturePerIteration) { +TEST_F(UnitTestModeTest, IterationIsSkippedWhenRequestedInFixturePerIteration) { auto [status, std_out, std_err] = Run("SkippedTestFixturePerIteration.SkippedTest", kDefaultTargetBinary, /*env=*/{}, /*fuzzer_flags=*/{{"time_limit_per_input", "1s"}}); + // Check that the there are more than one iteration skipped from the fixture. + EXPECT_GT(CountSubstrs( + std_err, + "Request to skip SkippedTestFixturePerIteration.SkippedTest"), + 1) + << std_err; EXPECT_THAT_LOG(std_err, Not(HasSubstr("SkippedTest is executed"))); EXPECT_THAT(status, Eq(ExitCode(0))); }
diff --git a/e2e_tests/testdata/fuzz_tests_using_googletest.cc b/e2e_tests/testdata/fuzz_tests_using_googletest.cc index 9fcb0b1..17a9a0f 100644 --- a/e2e_tests/testdata/fuzz_tests_using_googletest.cc +++ b/e2e_tests/testdata/fuzz_tests_using_googletest.cc
@@ -142,7 +142,11 @@ // when initializing the corpus for fuzzing. So we always accept the first // input. SkippedTestFixturePerIteration() { - if (!first_iteration_) fuzztest::SkipTestsOrCurrentInput(); + if (!first_iteration_) { + fprintf(stderr, + "Request to skip SkippedTestFixturePerIteration.SkippedTest\n"); + fuzztest::SkipTestsOrCurrentInput(); + } } void SkippedTest() {