#include <sanitizer/coverage_interface.h>
#include <algorithm>
+extern "C" {
+__attribute__((weak)) void __sanitizer_print_stack_trace();
+}
+
namespace fuzzer {
static const size_t kMaxUnitSizeToPrint = 256;
PrintUnitInASCIIOrTokens(CurrentUnit, "\n");
}
WriteUnitToFileWithPrefix(CurrentUnit, "timeout-");
+ Printf("==%d== ERROR: libFuzzer: timeout after %d seconds\n", GetPid(),
+ Seconds);
+ if (__sanitizer_print_stack_trace)
+ __sanitizer_print_stack_trace();
+ Printf("SUMMARY: libFuzzer: timeout\n");
exit(1);
}
}
RUN: not LLVMFuzzer-TimeoutTest -timeout=5 2>&1 | FileCheck %s --check-prefix=TimeoutTest
TimeoutTest: ALARM: working on the last Unit for
TimeoutTest: Test unit written to ./timeout-
+TimeoutTest: == ERROR: libFuzzer: timeout after
+TimeoutTest: #0
+TimeoutTest: #1
+TimeoutTest: #2
+TimeoutTest: SUMMARY: libFuzzer: timeout
RUN: not LLVMFuzzer-TimeoutTest -timeout=5 -test_single_input=%S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInputTimeoutTest
SingleInputTimeoutTest: ALARM: working on the last Unit for