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:
@@ -475,8 +475,14 @@ int *x, *y, *mod;
|
||||
coord cc;
|
||||
DWORD count;
|
||||
really_move_cursor();
|
||||
if (iflags.debug_fuzzer)
|
||||
return randomkey();
|
||||
if (iflags.debug_fuzzer) {
|
||||
int poskey = randomkey();
|
||||
if (poskey == 0) {
|
||||
*x = rn2(console.width);
|
||||
*y = rn2(console.height);
|
||||
}
|
||||
return poskey;
|
||||
}
|
||||
ch = (program_state.done_hup)
|
||||
? '\033'
|
||||
: keyboard_handler.pCheckInput(
|
||||
|
||||
@@ -336,7 +336,7 @@ attempt_restore:
|
||||
resuming = TRUE; /* not starting new game */
|
||||
if (discover)
|
||||
You("are in non-scoring discovery mode.");
|
||||
if (discover || wizard) {
|
||||
if ((discover || wizard) && !iflags.fuzzer_auto_start) {
|
||||
if (yn("Do you want to keep the save file?") == 'n')
|
||||
(void) delete_savefile();
|
||||
else {
|
||||
@@ -461,6 +461,23 @@ char *argv[];
|
||||
case 'X':
|
||||
discover = TRUE, wizard = FALSE;
|
||||
break;
|
||||
case 'F':
|
||||
{
|
||||
iflags.fuzzer_auto_start = 1;
|
||||
|
||||
if (argc > 1 && argv[1][0] != '-') {
|
||||
argc--;
|
||||
argv++;
|
||||
iflags.fuzzer_stop_and_save = atoi(*argv);
|
||||
|
||||
if (argc > 1 && argv[1][0] != '-') {
|
||||
argc--;
|
||||
argv++;
|
||||
iflags.verbose_logging_start = atoi(*argv);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#ifdef NEWS
|
||||
case 'n':
|
||||
iflags.news = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user