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

View File

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