Fuzzer improvements.

phase_of_moon and friday_13th determined using rn2() instead of local
time if fuzzing.  Don't reseed using init_random() if fuzzing.  Allow
set_random to be called outside of hacklib.  rn2_on_display_rng uses
rn2 if fuzzing so that we have a single source of random that we can
ensure is reproducible.  Implement rul() that returns a random unsigned
long.  Fix bug in fuzzer handling of ntposkey which would cause us to use
unitialized values for x and y.  Added command line arguments to allow
auto starting and stopping of fuzzer.  Add a logging facility for the
fuzzer to use to record activity.  Added some scripts used to automate
fuzzer testing on windows.
This commit is contained in:
Bart House
2019-07-14 00:20:09 -07:00
parent aa95e20ca7
commit 435f1c4626
14 changed files with 337 additions and 8 deletions

View File

@@ -462,6 +462,10 @@ struct ptr_array {
};
typedef struct ptr_array ptr_array_t;
/* logging verbosity levels */
#define LOG_MINIMAL 0
#define LOG_VERBOSE 1
#undef E
#endif /* DECL_H */

View File

@@ -27,6 +27,13 @@ E void NDECL(newgame);
E void FDECL(welcome, (BOOLEAN_P));
E time_t NDECL(get_realtime);
E int FDECL(argcheck, (int, char **, enum earlyarg));
E void NDECL(fuzzer_start);
E void NDECL(fuzzer_stop);
E void NDECL(fuzzer_toggle);
E void VDECL(fuzzer_log, (int, const char *, ...)) PRINTF_F(2, 3);
E void NDECL(fuzzer_check);
E void NDECL(fuzzer_auto_start);
E boolean FDECL(fuzzer_msg_history, (const char *));
/* ### apply.c ### */
@@ -950,6 +957,7 @@ E boolean
FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P));
E void FDECL(init_random, (int FDECL((*fn), (int))));
E void FDECL(reseed_random, (int FDECL((*fn), (int))));
E void FDECL(set_random, (unsigned long, int FDECL((*fn), (int))));
E time_t NDECL(getnow);
E int NDECL(getyear);
#if 0
@@ -2161,6 +2169,7 @@ E int FDECL(rnd, (int));
E int FDECL(d, (int, int));
E int FDECL(rne, (int));
E int FDECL(rnz, (int));
E unsigned long NDECL(rul);
/* ### role.c ### */

View File

@@ -447,6 +447,10 @@ struct instance_flags {
chosen_windowport[], but do not switch to
it in the midst of options processing */
boolean obsolete; /* obsolete options can point at this, it isn't used */
boolean fuzzer_auto_start; /* start fuzzer automatically */
int fuzzer_stop_and_save; /* move when fuzzer stops and saves game */
boolean fuzzer_saving; /* fuzzer is saving game */
int verbose_logging_start; /* move when verbose fuzzer logging starts */
};
/*