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
+2
View File
@@ -748,6 +748,8 @@ tty_delay_output()
#if defined(MICRO)
register int i;
#endif
if (iflags.debug_fuzzer)
return;
#ifdef TIMED_DELAY
if (flags.nap) {
(void) fflush(stdout);
+2
View File
@@ -186,6 +186,8 @@ more()
/* avoid recursion -- only happens from interrupts */
if (ttyDisplay->inmore++)
return;
if (iflags.debug_fuzzer)
return;
if (ttyDisplay->toplin) {
tty_curs(BASE_WINDOW, cw->curx + 1, cw->cury);
+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)