[PATCH] D60980: [fuzzer] Replace -seed_corpus with -seed_corpus_file

Jonathan Metzman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 18:26:46 PDT 2019


metzman added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/FuzzerDriver.cpp:771
+    std::istringstream SeedInputsStream(FileToString(SeedInputsFile));
+    RemoveFile(SeedInputsFile);
+    std::string seed_input;
----------------
Removing the file is somewhat hostile to users but is the best way to prevent the accumulation of files in fork mode.
Since the primary purpose of -seed_inputs_file is for fork mode, I think this is acceptable. Thoughts?


================
Comment at: compiler-rt/test/fuzzer/cross_over.test:18
 # Test the same thing but using -seed_inputs instead of passing the corpus dir.
-RUN: not %run %t-CrossOverTest -max_len=10 -seed=1 -runs=10000000 -seed_inputs=%t-corpus/A,%t-corpus/B
+RUN: python -c "import sys; sys.stdout.write(r'%t-corpus/A,%t-corpus/B')" > %t.seed-inputs
+RUN: not %run %t-CrossOverTest -max_len=10 -seed=1 -runs=10000000 -seed_inputs_file=%t.seed-inputs
----------------
The reason why I do this hacky python thing is because echo leaves a trailing newline and printf didn't work well with the percent formatting.
Is it OK to use python for this purpose (I think python is necessary to run lit commands anyway)?
If not, I can use `echo` so long as I end with a trailing `,`, that way the last seed input is "\n" instead of a newline being added to a filename we actually care about. Does this sound better than the python hack?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60980/new/

https://reviews.llvm.org/D60980





More information about the llvm-commits mailing list