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