allow SIGUSR1 as synonym for SIGINFO

Lets users on those unfortunate operating systems that lack SIGINFO
still be able to obtain progress information from unit tests :)
This commit is contained in:
Damien Miller 2018-09-14 10:31:47 +10:00
parent d64e785265
commit 0aa1f23084
2 changed files with 5 additions and 6 deletions

View File

@ -196,7 +196,6 @@ fuzz_dump(struct fuzz *fuzz)
dump(fuzz_ptr(fuzz), fuzz_len(fuzz));
}
#ifdef SIGINFO
static struct fuzz *last_fuzz;
static void
@ -211,7 +210,6 @@ siginfo(int unused __attribute__((__unused__)))
atomicio(vwrite, STDERR_FILENO, buf, strlen(buf));
}
}
#endif
struct fuzz *
fuzz_begin(u_int strategies, const void *p, size_t l)
@ -233,10 +231,11 @@ fuzz_begin(u_int strategies, const void *p, size_t l)
fuzz_next(ret);
#ifdef SIGINFO
last_fuzz = ret;
#ifdef SIGINFO
signal(SIGINFO, siginfo);
#endif
signal(SIGUSR1, siginfo);
return ret;
}
@ -245,10 +244,11 @@ void
fuzz_cleanup(struct fuzz *fuzz)
{
FUZZ_DBG(("cleanup, fuzz = %p", fuzz));
#ifdef SIGINFO
last_fuzz = NULL;
#ifdef SIGINFO
signal(SIGINFO, SIG_DFL);
#endif
signal(SIGUSR1, SIG_DFL);
assert(fuzz != NULL);
assert(fuzz->seed != NULL);
assert(fuzz->fuzzed != NULL);

View File

@ -203,7 +203,6 @@ test_info(char *s, size_t len)
*subtest_info != '\0' ? " - " : "", subtest_info);
}
#ifdef SIGINFO
static void
siginfo(int unused __attribute__((__unused__)))
{
@ -212,7 +211,6 @@ siginfo(int unused __attribute__((__unused__)))
test_info(buf, sizeof(buf));
atomicio(vwrite, STDERR_FILENO, buf, strlen(buf));
}
#endif
void
test_start(const char *n)
@ -226,6 +224,7 @@ test_start(const char *n)
#ifdef SIGINFO
signal(SIGINFO, siginfo);
#endif
signal(SIGUSR1, siginfo);
}
void