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
7 changes: 3 additions & 4 deletions centipede/centipede_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1406,9 +1406,8 @@ TEST_F(CentipedeWithTemporaryLocalDir, EngineWorksInWorkerMode) {
fuzztest::internal::DefaultCallbacksFactory<
fuzztest::internal::CentipedeDefaultCallbacks>
callbacks;
EXPECT_DEATH(
[&] { std::exit(CentipedeMain(env, callbacks)); }(),
ContainsRegex("Failure *: INPUT FAILURE: some_failure_description"));
EXPECT_DEATH([&] { std::exit(CentipedeMain(env, callbacks)); }(),
ContainsRegex("Failure *: some_failure_description"));
}

TEST_F(CentipedeWithTemporaryLocalDir, EngineWorksInStandaloneMode) {
Expand All @@ -1428,7 +1427,7 @@ TEST_F(CentipedeWithTemporaryLocalDir, EngineWorksInStandaloneMode) {
const int status = std::system(test_command.c_str());
std::exit(WEXITSTATUS(status));
}(),
ContainsRegex("Failure *: INPUT FAILURE: some_failure_description"));
ContainsRegex("Failure *: some_failure_description"));
}

} // namespace
Expand Down
16 changes: 15 additions & 1 deletion centipede/engine_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,14 +299,28 @@ void WorkerEmitError(std::string_view message) {
WorkerEmitFailureOutput("SETUP FAILURE: ", message);
}

// TODO(xinhaoyuan): Some of them are planned to be removed.
static constexpr std::array<std::string_view, 3> kNonFindingPrefixes = {
"SETUP FAILURE:",
"IGNORED FAILURE:",
"SKIPPED TEST:",
};

void WorkerEmitFinding(std::string_view description,
std::string_view signature) {
WorkerCheck(
GetWorkerState().in_adapter_execute.load(std::memory_order_relaxed),
"Must emit finding in adapter execute");
for (auto bad_prefix : kNonFindingPrefixes) {
if (description.substr(0, bad_prefix.size()) == bad_prefix) {
WorkerLog("Got bad prefix in the finding description: ", description);
WorkerEmitError("Bad prefix in the finding description");
return;
}
}
const bool ignored = GetWorkerState().has_finding.exchange(true);
if (!ignored) {
WorkerCheck(WorkerEmitFailureOutput("INPUT FAILURE: ", description),
WorkerCheck(WorkerEmitFailureOutput(/*prefix=*/"", description),
"Failed to emit failure output for the finding");
if (const char* finding_signature_path =
GetWorkerFlag(kWorkerFailureSignaturePathFlagHeader);
Expand Down
Loading