Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions e2e_tests/functional_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ void GoogleTestExpectationsDontAbortInUnitTestModeImpl(
EXPECT_THAT_LOG(std_out, HasSubstr("[ FAILED ] MySuite.GoogleTestAssert"));
EXPECT_THAT(status, Ne(ExitCode(0)));

#ifndef FUZZTEST_USE_CENTIPEDE
// There is the gtest stack on stdout, and no stack on stderr.
EXPECT_THAT_LOG(std_out, AllOf(HasSubstr("GoogleTestExpect("),
HasSubstr("GoogleTestAssert(")));
// We remove the reproducer first because it also contains the function name.
EXPECT_THAT(RemoveReproducer(RemoveReproducer(std_err, "MySuite",
"GoogleTestExpect", ".*"),
"MySuite", "GoogleTestAssert", ".*"),
AllOf(Not(HasSubstr("GoogleTestExpect(")),
Not(HasSubstr("GoogleTestAssert("))));
#endif

// There is no repro example on stdout, and there is one on stderr.
EXPECT_THAT_LOG(
std_out,
Expand Down Expand Up @@ -1668,6 +1680,9 @@ TEST_P(FuzzingModeCrashFindingTest, GoogleTestExpectationsStopTheFuzzer) {
ExpectTargetAbort(status, std_err);

#ifndef FUZZTEST_USE_CENTIPEDE
// There is a stack both on stdout and stderr.
EXPECT_THAT_LOG(std_out, HasSubstr("GoogleTestExpect("));
EXPECT_THAT_LOG(std_err, HasSubstr("GoogleTestExpect("));

// There is the repro example only on stderr.
EXPECT_THAT_LOG(std_out,
Expand All @@ -1683,6 +1698,9 @@ TEST_P(FuzzingModeCrashFindingTest, GoogleTestAssertionsStopTheFuzzer) {
ExpectTargetAbort(status, std_err);

#ifndef FUZZTEST_USE_CENTIPEDE
// There is a stack both on stdout and stderr.
EXPECT_THAT_LOG(std_out, HasSubstr("GoogleTestAssert("));
EXPECT_THAT_LOG(std_err, HasSubstr("GoogleTestAssert("));

// There is the repro example only on stderr.
EXPECT_THAT_LOG(std_out,
Expand Down
2 changes: 2 additions & 0 deletions fuzztest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ cc_library(
testonly = 1,
srcs = ["fuzztest_gtest_main.cc"],
deps = [
"@abseil-cpp//absl/debugging:failure_signal_handler",
"@abseil-cpp//absl/debugging:symbolize",
"@com_google_fuzztest//fuzztest:init_fuzztest",
"@googletest//:gtest",
],
Expand Down
3 changes: 3 additions & 0 deletions fuzztest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ fuzztest_cc_library(
SRCS
"fuzztest_gtest_main.cc"
DEPS
absl::debugging
absl::failure_signal_handler
absl::symbolize
fuzztest::init_fuzztest
GTest::gtest
)
Expand Down
6 changes: 6 additions & 0 deletions fuzztest/fuzztest_gtest_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@

#include "gtest/gtest.h"
#include "./fuzztest/init_fuzztest.h"
#include "absl/debugging/failure_signal_handler.h"
#include "absl/debugging/symbolize.h"

int main(int argc, char** argv) {
absl::InitializeSymbolizer(argv[0]);
absl::FailureSignalHandlerOptions options;
options.call_previous_handler = true;
absl::InstallFailureSignalHandler(options);
testing::InitGoogleTest(&argc, argv);
// We call fuzztest::ParseAbslFlags rather than absl::ParseCommandLine
// since the latter would complain about any unknown flags that need
Expand Down
Loading