forked from OSchip/llvm-project
Reland "[NFC][libFuzzer] Prefix TempPath with string showing the work it is doing."
With fix (somehow one hunk is missed).
This commit is contained in:
parent
9ed9742ec0
commit
4f3c3bbbf8
|
@ -345,7 +345,7 @@ int CleanseCrashInput(const Vector<std::string> &Args,
|
|||
assert(Cmd.hasArgument(InputFilePath));
|
||||
Cmd.removeArgument(InputFilePath);
|
||||
|
||||
auto TmpFilePath = TempPath(".repro");
|
||||
auto TmpFilePath = TempPath("CleanseCrashInput", ".repro");
|
||||
Cmd.addArgument(TmpFilePath);
|
||||
Cmd.setOutputFile(getDevNull());
|
||||
Cmd.combineOutAndErr();
|
||||
|
@ -499,7 +499,7 @@ void Merge(Fuzzer *F, FuzzingOptions &Options, const Vector<std::string> &Args,
|
|||
std::sort(OldCorpus.begin(), OldCorpus.end());
|
||||
std::sort(NewCorpus.begin(), NewCorpus.end());
|
||||
|
||||
std::string CFPath = CFPathOrNull ? CFPathOrNull : TempPath(".txt");
|
||||
std::string CFPath = CFPathOrNull ? CFPathOrNull : TempPath("Merge", ".txt");
|
||||
Vector<std::string> NewFiles;
|
||||
Set<uint32_t> NewFeatures, NewCov;
|
||||
CrashResistantMerge(Args, OldCorpus, NewCorpus, &NewFiles, {}, &NewFeatures,
|
||||
|
|
|
@ -297,7 +297,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,
|
|||
for (auto &Dir : CorpusDirs)
|
||||
GetSizedFilesFromDir(Dir, &SeedFiles);
|
||||
std::sort(SeedFiles.begin(), SeedFiles.end());
|
||||
Env.TempDir = TempPath(".dir");
|
||||
Env.TempDir = TempPath("FuzzWithFork", ".dir");
|
||||
Env.DFTDir = DirPlusFile(Env.TempDir, "DFT");
|
||||
RmDirRecursive(Env.TempDir); // in case there is a leftover from old runs.
|
||||
MkDir(Env.TempDir);
|
||||
|
|
|
@ -151,9 +151,9 @@ void RmDirRecursive(const std::string &Dir) {
|
|||
[](const std::string &Path) { RemoveFile(Path); });
|
||||
}
|
||||
|
||||
std::string TempPath(const char *Extension) {
|
||||
return DirPlusFile(TmpDir(),
|
||||
"libFuzzerTemp." + std::to_string(GetPid()) + Extension);
|
||||
std::string TempPath(const char *Prefix, const char *Extension) {
|
||||
return DirPlusFile(TmpDir(), std::string("libFuzzerTemp.") + Prefix +
|
||||
std::to_string(GetPid()) + Extension);
|
||||
}
|
||||
|
||||
} // namespace fuzzer
|
||||
|
|
|
@ -42,7 +42,7 @@ std::string DirName(const std::string &FileName);
|
|||
// Returns path to a TmpDir.
|
||||
std::string TmpDir();
|
||||
|
||||
std::string TempPath(const char *Extension);
|
||||
std::string TempPath(const char *Prefix, const char *Extension);
|
||||
|
||||
bool IsInterestingCoverageFile(const std::string &FileName);
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ void Fuzzer::ExitCallback() {
|
|||
void Fuzzer::MaybeExitGracefully() {
|
||||
if (!F->GracefulExitRequested) return;
|
||||
Printf("==%lu== INFO: libFuzzer: exiting as requested\n", GetPid());
|
||||
RmDirRecursive(TempPath(".dir"));
|
||||
RmDirRecursive(TempPath("FuzzWithFork", ".dir"));
|
||||
F->PrintFinalStats();
|
||||
_Exit(0);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ void Fuzzer::InterruptCallback() {
|
|||
Printf("==%lu== libFuzzer: run interrupted; exiting\n", GetPid());
|
||||
PrintFinalStats();
|
||||
ScopedDisableMsanInterceptorChecks S; // RmDirRecursive may call opendir().
|
||||
RmDirRecursive(TempPath(".dir"));
|
||||
RmDirRecursive(TempPath("FuzzWithFork", ".dir"));
|
||||
// Stop right now, don't perform any at-exit actions.
|
||||
_Exit(Options.InterruptExitCode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue