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:55:49 +02:00
parent 4f541fe216
commit 0bb6754998
14 changed files with 76 additions and 3 deletions
+4
View File
@@ -3344,6 +3344,9 @@ tty_nhgetch()
*/
if (WIN_MESSAGE != WIN_ERR && wins[WIN_MESSAGE])
wins[WIN_MESSAGE]->flags &= ~WIN_STOP;
if (iflags.debug_fuzzer) {
i = randomkey();
} else {
#ifdef UNIX
i = (++nesting == 1) ? tgetch()
: (read(fileno(stdin), (genericptr_t) &nestbuf, 1)
@@ -3352,6 +3355,7 @@ tty_nhgetch()
#else
i = tgetch();
#endif
}
if (!i)
i = '\033'; /* map NUL to ESC since nethack doesn't expect NUL */
else if (i == EOF)