From: Florian Krohm Date: Fri, 31 Jul 2015 06:58:16 +0000 (+0000) Subject: Fix testcase such that it can be run under cron on Solaris. X-Git-Tag: svn/VALGRIND_3_11_0~195 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dc43bea4da14ceb456b6efdb62bc21cacde019a;p=thirdparty%2Fvalgrind.git Fix testcase such that it can be run under cron on Solaris. The tescase depends on SIGHUP to be delivered but cron on Solaris ignored the signal. So it needs to be enabled in child processes after fork. Patch by Ivo Raisr . Fixes BZ #350809. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15462 --- diff --git a/NEWS b/NEWS index 77a1612b5f..52988cc94b 100644 --- a/NEWS +++ b/NEWS @@ -269,6 +269,7 @@ where XXXXXX is the bug number as listed below. 349874 Fix typos in source code 349828 memcpy intercepts memmove causing src/dst overlap error (ppc64 ld.so) 349941 di_notify_mmap might create wrong start/size DebugInfoMapping +350809 Fix none/tests/async-sigs for Solaris 350811 Remove reference to --db-attach which has been removed. n-i-bz Provide implementations of certain compiler builtins to support compilers who may not provide those diff --git a/none/tests/async-sigs.c b/none/tests/async-sigs.c index d027b6c3a2..f05eb6e4eb 100644 --- a/none/tests/async-sigs.c +++ b/none/tests/async-sigs.c @@ -22,6 +22,15 @@ static void handler(int sig) { } +static void install_handler(int sig, void (*sig_handler)(int)) +{ + struct sigaction sa; + sa.sa_handler = sig_handler; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sigaction(sig, &sa, 0); +} + /* Kill our child, but use a separate kill command. This is so that it's running independently of Valgrind, and so is async with respect to thread scheduling. */ @@ -87,11 +96,7 @@ static void test(int block, int caughtsig, int fatalsig) // - otherwise, wait in client code (by spinning). // The alarm() calls is so that if something breaks, we don't get stuck. if (pid == 0) { - struct sigaction sa; - sa.sa_handler = handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sigaction(caughtsig, &sa, 0); + install_handler(caughtsig, handler); alarm(10); for (;;) @@ -130,6 +135,9 @@ static void test(int block, int caughtsig, int fatalsig) int main() { + /* Restore default behaviour of SIGHUP when forked from cron. */ + install_handler(SIGHUP, SIG_DFL); + test(/*non-blocked*/0, /* sync*/SIGSEGV, /* sync*/SIGBUS); test(/*non-blocked*/0, /* sync*/SIGSEGV, /*async*/SIGHUP); test(/*non-blocked*/0, /*async*/SIGUSR1, /* sync*/SIGBUS);