mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[libFuzzer] deprecate several flags
llvm-svn: 263739
This commit is contained in:
parent
d8cee1fdf1
commit
e634bbeadd
@ -293,9 +293,6 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
|
||||
Options.MaxNumberOfRuns = Flags.runs;
|
||||
if (!Inputs->empty())
|
||||
Options.OutputCorpus = (*Inputs)[0];
|
||||
if (Flags.sync_command)
|
||||
Options.SyncCommand = Flags.sync_command;
|
||||
Options.SyncTimeout = Flags.sync_timeout;
|
||||
Options.ReportSlowUnits = Flags.report_slow_units;
|
||||
if (Flags.artifact_prefix)
|
||||
Options.ArtifactPrefix = Flags.artifact_prefix;
|
||||
@ -307,7 +304,8 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
|
||||
return 1;
|
||||
if (Flags.verbosity > 0 && !Dictionary.empty())
|
||||
Printf("Dictionary: %zd entries\n", Dictionary.size());
|
||||
Options.SaveArtifacts = !Flags.test_single_input;
|
||||
bool DoPlainRun = AllInputsAreFiles();
|
||||
Options.SaveArtifacts = !DoPlainRun;
|
||||
Options.PrintNewCovPcs = Flags.print_new_cov_pcs;
|
||||
Options.PrintFinalStats = Flags.print_final_stats;
|
||||
|
||||
@ -337,12 +335,8 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
|
||||
if (Flags.handle_fpe) SetSigFpeHandler();
|
||||
if (Flags.handle_int) SetSigIntHandler();
|
||||
|
||||
if (Flags.test_single_input) {
|
||||
RunOneTest(&F, Flags.test_single_input);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (AllInputsAreFiles()) {
|
||||
if (DoPlainRun) {
|
||||
Options.SaveArtifacts = false;
|
||||
int Runs = std::max(1, Flags.runs);
|
||||
Printf("%s: Running %zd inputs %d time(s) each.\n", ProgName->c_str(),
|
||||
Inputs->size(), Runs);
|
||||
|
@ -52,16 +52,11 @@ FUZZER_FLAG_INT(workers, 0,
|
||||
FUZZER_FLAG_INT(reload, 1,
|
||||
"Reload the main corpus periodically to get new units"
|
||||
" discovered by other processes.")
|
||||
FUZZER_FLAG_STRING(sync_command, "Execute an external command "
|
||||
"\"<sync_command> <test_corpus>\" "
|
||||
"to synchronize the test corpus.")
|
||||
FUZZER_FLAG_INT(sync_timeout, 600, "Minimum timeout between syncs.")
|
||||
FUZZER_FLAG_INT(report_slow_units, 10,
|
||||
"Report slowest units if they run for more than this number of seconds.")
|
||||
FUZZER_FLAG_INT(only_ascii, 0,
|
||||
"If 1, generate only ASCII (isprint+isspace) inputs.")
|
||||
FUZZER_FLAG_STRING(dict, "Experimental. Use the dictionary file.")
|
||||
FUZZER_FLAG_STRING(test_single_input, "Use specified file as test input.")
|
||||
FUZZER_FLAG_STRING(artifact_prefix, "Write fuzzing artifacts (crash, "
|
||||
"timeout, or slow inputs) as "
|
||||
"$(artifact_prefix)file")
|
||||
@ -82,5 +77,9 @@ FUZZER_FLAG_INT(handle_abrt, 1, "If 1, try to intercept SIGABRT.")
|
||||
FUZZER_FLAG_INT(handle_ill, 1, "If 1, try to intercept SIGILL.")
|
||||
FUZZER_FLAG_INT(handle_fpe, 1, "If 1, try to intercept SIGFPE.")
|
||||
FUZZER_FLAG_INT(handle_int, 1, "If 1, try to intercept SIGINT.")
|
||||
|
||||
FUZZER_DEPRECATED_FLAG(exit_on_first)
|
||||
FUZZER_DEPRECATED_FLAG(save_minimized_corpus)
|
||||
FUZZER_DEPRECATED_FLAG(sync_command)
|
||||
FUZZER_DEPRECATED_FLAG(sync_timeout)
|
||||
FUZZER_DEPRECATED_FLAG(test_single_input)
|
||||
|
@ -290,11 +290,9 @@ public:
|
||||
bool ShuffleAtStartUp = true;
|
||||
int PreferSmallDuringInitialShuffle = -1;
|
||||
size_t MaxNumberOfRuns = ULONG_MAX;
|
||||
int SyncTimeout = 600;
|
||||
int ReportSlowUnits = 10;
|
||||
bool OnlyASCII = false;
|
||||
std::string OutputCorpus;
|
||||
std::string SyncCommand;
|
||||
std::string ArtifactPrefix = "./";
|
||||
std::string ExactArtifactPath;
|
||||
bool SaveArtifacts = true;
|
||||
@ -365,8 +363,6 @@ private:
|
||||
// Must be called whenever the corpus or unit weights are changed.
|
||||
void UpdateCorpusDistribution();
|
||||
|
||||
void SyncCorpus();
|
||||
|
||||
size_t RecordBlockCoverage();
|
||||
size_t RecordCallerCalleeCoverage();
|
||||
void PrepareCoverageBeforeRun();
|
||||
@ -412,7 +408,6 @@ private:
|
||||
MutationDispatcher &MD;
|
||||
FuzzingOptions Options;
|
||||
system_clock::time_point ProcessStartTime = system_clock::now();
|
||||
system_clock::time_point LastExternalSync = system_clock::now();
|
||||
system_clock::time_point UnitStartTime;
|
||||
long TimeOfLongestUnitInSeconds = 0;
|
||||
long EpochOfLastReadOfOutputCorpus = 0;
|
||||
|
@ -561,7 +561,6 @@ void Fuzzer::Loop() {
|
||||
if (Options.DoCrossOver)
|
||||
MD.SetCorpus(&Corpus);
|
||||
while (true) {
|
||||
SyncCorpus();
|
||||
auto Now = system_clock::now();
|
||||
if (duration_cast<seconds>(Now - LastCorpusReload).count()) {
|
||||
RereadOutputCorpus(Options.MaxLen);
|
||||
@ -581,17 +580,6 @@ void Fuzzer::Loop() {
|
||||
MD.PrintRecommendedDictionary();
|
||||
}
|
||||
|
||||
void Fuzzer::SyncCorpus() {
|
||||
if (Options.SyncCommand.empty() || Options.OutputCorpus.empty())
|
||||
return;
|
||||
auto Now = system_clock::now();
|
||||
if (duration_cast<seconds>(Now - LastExternalSync).count() <
|
||||
Options.SyncTimeout)
|
||||
return;
|
||||
LastExternalSync = Now;
|
||||
ExecuteCommand(Options.SyncCommand + " " + Options.OutputCorpus);
|
||||
}
|
||||
|
||||
void Fuzzer::UpdateCorpusDistribution() {
|
||||
size_t N = Corpus.size();
|
||||
std::vector<double> Intervals(N + 1);
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
# A simple script to synchronise a fuzz test corpus
|
||||
# with an external git repository.
|
||||
# Usage:
|
||||
# pull_and_push_fuzz_corpus.sh DIR
|
||||
# It assumes that DIR is inside a git repo and push
|
||||
# can be done w/o typing a password.
|
||||
cd $1
|
||||
git add *
|
||||
git commit -m "fuzz test corpus"
|
||||
git pull --rebase --no-edit
|
||||
for((attempt=0; attempt<5; attempt++)); do
|
||||
echo GIT PUSH $1 ATTEMPT $attempt
|
||||
if $(git push); then break; fi
|
||||
git pull --rebase --no-edit
|
||||
done
|
||||
|
@ -7,7 +7,7 @@ TimeoutTest: #1
|
||||
TimeoutTest: #2
|
||||
TimeoutTest: SUMMARY: libFuzzer: timeout
|
||||
|
||||
RUN: not LLVMFuzzer-TimeoutTest -timeout=1 -test_single_input=%S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInputTimeoutTest
|
||||
RUN: not LLVMFuzzer-TimeoutTest -timeout=1 %S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInputTimeoutTest
|
||||
SingleInputTimeoutTest: ALARM: working on the last Unit for
|
||||
SingleInputTimeoutTest-NOT: Test unit written to ./timeout-
|
||||
|
||||
|
@ -2,7 +2,7 @@ CHECK: BINGO
|
||||
Done1000000: Done 1000000 runs in
|
||||
|
||||
RUN: LLVMFuzzer-SimpleTest 2>&1 | FileCheck %s
|
||||
RUN: not LLVMFuzzer-NullDerefTest -test_single_input=%S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInput
|
||||
RUN: not LLVMFuzzer-NullDerefTest %S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInput
|
||||
SingleInput-NOT: Test unit written to ./crash-
|
||||
|
||||
RUN: LLVMFuzzer-SimpleCmpTest -max_total_time=1 2>&1 | FileCheck %s --check-prefix=MaxTotalTime
|
||||
|
Loading…
Reference in New Issue
Block a user