replace fuzzer state magic numbers
This commit is contained in:
@@ -224,6 +224,12 @@ struct accessibility_data {
|
||||
a11y.mon_notices_blocked = 0; \
|
||||
} } while(0)
|
||||
|
||||
enum debug_fuzzer_states {
|
||||
fuzzer_off,
|
||||
fuzzer_impossible_panic,
|
||||
fuzzer_impossible_continue
|
||||
};
|
||||
|
||||
/*
|
||||
* Stuff that really isn't option or platform related and does not
|
||||
* get saved and restored. They are set and cleared during the game
|
||||
|
||||
@@ -77,7 +77,7 @@ done1(int sig_unused UNUSED)
|
||||
#ifndef NO_SIGNAL
|
||||
(void) signal(SIGINT, SIG_IGN);
|
||||
#endif
|
||||
iflags.debug_fuzzer = FALSE;
|
||||
iflags.debug_fuzzer = fuzzer_off;
|
||||
if (flags.ignintr) {
|
||||
#ifndef NO_SIGNAL
|
||||
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||
|
||||
@@ -587,7 +587,7 @@ impossible(const char *s, ...)
|
||||
va_end(the_args);
|
||||
pbuf[BUFSZ - 1] = '\0'; /* sanity */
|
||||
paniclog("impossible", pbuf);
|
||||
if (iflags.debug_fuzzer == 1)
|
||||
if (iflags.debug_fuzzer == fuzzer_impossible_panic)
|
||||
panic("%s", pbuf);
|
||||
|
||||
gp.pline_flags = URGENT_MESSAGE;
|
||||
|
||||
@@ -551,8 +551,14 @@ wiz_fuzzer(void)
|
||||
pline("The fuzz tester will make NetHack execute random keypresses.");
|
||||
There("is no conventional way out of this mode.");
|
||||
}
|
||||
if (paranoid_query(TRUE, "Do you want to start fuzz testing?"))
|
||||
iflags.debug_fuzzer = TRUE; /* Thoth, take the reins */
|
||||
if (paranoid_query(TRUE, "Do you want to start fuzz testing?")) {
|
||||
/* Thoth, take the reins */
|
||||
if (y_n("Do you want to call panic() after impossible()?") == 'n') {
|
||||
iflags.debug_fuzzer = fuzzer_impossible_continue;
|
||||
} else {
|
||||
iflags.debug_fuzzer = fuzzer_impossible_panic;
|
||||
}
|
||||
}
|
||||
return ECMD_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user