fuzzer: add an -l option, so it loops until it crashes

This commit is contained in:
Sergio Martins
2020-01-21 17:10:29 +00:00
parent cfa1cc47b6
commit b8279633ac

View File

@@ -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);
});