From b8279633acd7069f7103e1d0bf6e8a64a4eaccfe Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 21 Jan 2020 17:10:29 +0000 Subject: [PATCH] fuzzer: add an -l option, so it loops until it crashes --- tests/fuzzer/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/fuzzer/main.cpp b/tests/fuzzer/main.cpp index 5d83aef5..10050f11 100644 --- a/tests/fuzzer/main.cpp +++ b/tests/fuzzer/main.cpp @@ -48,6 +48,9 @@ int main(int argc, char **argv) QCommandLineOption forceDumpJsonOption("f", QCoreApplication::translate("main", "Dump json of the test even if we're already loading a test.")); parser.addOption(forceDumpJsonOption); + QCommandLineOption loopOption("l", QCoreApplication::translate("main", "Loops until it crashes")); + parser.addOption(loopOption); + parser.addHelpOption(); parser.process(app); @@ -67,9 +70,13 @@ int main(int argc, char **argv) } } - QTimer::singleShot(0, &fuzzer, [&fuzzer, filesToLoad] { + const bool loops = parser.isSet(loopOption); + + QTimer::singleShot(0, &fuzzer, [&fuzzer, filesToLoad, loops] { if (filesToLoad.isEmpty()) - fuzzer.fuzz({ 1, 10, true }); + do { + fuzzer.fuzz({ 1, 10, true }); + } while(loops); else fuzzer.fuzz(filesToLoad); });