From 0aa1f230846ebce698e52051a107f3127024a05a Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 14 Sep 2018 10:31:47 +1000 Subject: [PATCH] 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 :) --- regress/unittests/test_helper/fuzz.c | 8 ++++---- regress/unittests/test_helper/test_helper.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/regress/unittests/test_helper/fuzz.c b/regress/unittests/test_helper/fuzz.c index 99f1d036c..78b36654d 100644 --- a/regress/unittests/test_helper/fuzz.c +++ b/regress/unittests/test_helper/fuzz.c @@ -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); diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c index 866f3495d..4cc70852c 100644 --- a/regress/unittests/test_helper/test_helper.c +++ b/regress/unittests/test_helper/test_helper.c @@ -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