fix various issues

This commit is contained in:
Alex Groce
2018-12-15 13:40:17 -07:00
parent b89d7d7073
commit 950da4a789
2 changed files with 13 additions and 9 deletions
+12 -8
View File
@@ -578,16 +578,20 @@ static int DeepState_RunTestNoFork(struct DeepState_TestInfo *test) {
/* Fork and run `test`. */
static enum DeepState_TestRunResult
DeepState_ForkAndRunTest(struct DeepState_TestInfo *test) {
if (FLAG_no_fork) {
return DeepState_RunTestNoFork(test);
}
pid_t test_pid = fork();
if (!test_pid) {
DeepState_RunTest(test);
pid_t test_pid;
if (!FLAGS_no_fork) {
test_pid = fork();
if (!test_pid) {
DeepState_RunTest(test);
}
}
int wstatus;
waitpid(test_pid, &wstatus, 0);
if (!FLAGS_no_fork) {
waitpid(test_pid, &wstatus, 0);
} else {
wstatus = DeepState_RunTestNoFork(test);
}
/* If we exited normally, the status code tells us if the test passed. */
if (WIFEXITED(wstatus)) {
uint8_t status = WEXITSTATUS(wstatus);
+1 -1
View File
@@ -39,7 +39,7 @@ DEFINE_bool(abort_on_fail, false, "Abort on file replay failure (useful in file
DEFINE_bool(verbose_reads, false, "Report on bytes being read during execution of test.");
DEFINE_bool(fuzz, false, "Perform brute force unguided fuzzing.");
DEFINE_bool(fuzz_save_passing, false, "Save passing tests during fuzzing.");
DEFINE_bool(no_fork, false, "Don't fork when running a test.")
DEFINE_bool(no_fork, false, "Don't fork when running a test.");
DEFINE_int(log_level, 0, "Minimum level of logging to output.");
DEFINE_int(seed, 0, "Seed for brute force fuzzing (uses time if not set).");