Fuzz testing debug tool

Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
This commit is contained in:
Pasi Kallinen
2018-11-08 15:50:53 +02:00
parent 4f541fe216
commit 0bb6754998
14 changed files with 76 additions and 3 deletions

View File

@@ -330,6 +330,8 @@ int sig_unused UNUSED;
int
done2()
{
if (iflags.debug_fuzzer)
return 0;
if (!paranoid_query(ParanoidQuit, "Really quit?")) {
#ifndef NO_SIGNAL
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
@@ -602,7 +604,7 @@ VA_DECL(const char *, str)
/* XXX can we move this above the prints? Then we'd be able to
* suppress "it may be possible to rebuild" based on dosave0()
* or say it's NOT possible to rebuild. */
if (program_state.something_worth_saving) {
if (program_state.something_worth_saving && !iflags.debug_fuzzer) {
set_error_savefile();
if (dosave0()) {
/* os/win port specific recover instructions */
@@ -1043,6 +1045,14 @@ int how;
bot();
}
if (iflags.debug_fuzzer) {
if (!(program_state.panicking || how == PANICKED)) {
savelife(how);
killer.name[0] = 0;
killer.format = 0;
return;
}
} else
if (how == ASCENDED || (!killer.name[0] && how == GENOCIDED))
killer.format = NO_KILLER_PREFIX;
/* Avoid killed by "a" burning or "a" starvation */