* tests/signal_receive.c: New file.
* tests/signal_receive.test: New test.
* tests/.gitignore: Add signal_receive.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(MISC_TESTS): Add signal_receive.test.
---
 tests/.gitignore          |  1 +
 tests/Makefile.am         |  2 ++
 tests/signal_receive.c    | 50 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/signal_receive.test |  8 ++++++++
 4 files changed, 61 insertions(+)
 create mode 100644 tests/signal_receive.c
 create mode 100755 tests/signal_receive.test

diff --git a/tests/.gitignore b/tests/.gitignore
index 8f4d6f0..f5c1af0 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -227,6 +227,7 @@ setuid32
 shmxt
 sigaction
 sigaltstack
+signal_receive
 signalfd
 sigreturn
 sleep
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ac527ec..8d76824 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -281,6 +281,7 @@ check_PROGRAMS = \
        shmxt \
        sigaction \
        sigaltstack \
+       signal_receive \
        signalfd \
        sigreturn \
        sleep \
@@ -644,6 +645,7 @@ MISC_TESTS = \
        qual_syscall.test \
        redirect.test \
        restart_syscall.test \
+       signal_receive.test \
        strace-S.test \
        strace-T.test \
        strace-V.test \
diff --git a/tests/signal_receive.c b/tests/signal_receive.c
new file mode 100644
index 0000000..4225409
--- /dev/null
+++ b/tests/signal_receive.c
@@ -0,0 +1,50 @@
+#include "tests.h"
+#include <assert.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+void sig_print(const char *signame)
+{
+       printf("kill\\(%d, %s\\) = 0\n"
+              "--- %s {si_signo=%s, si_code=SI_USER, si_pid=%d,"
+              " si_uid=%d} ---\n",
+              getpid(), signame, signame, signame, getpid(), getuid());
+}
+
+static void
+handler(int sig)
+{
+}
+
+int
+main(void)
+{
+       int sig;
+       const struct sigaction act = { .sa_handler = handler };
+       for (sig = 1; sig <= 31; sig++)
+       {
+               if( sig != SIGKILL && sig != SIGSTOP)
+               {
+                       sigaction(sig, &act, NULL);
+               }
+       }
+
+       sigset_t mask;
+       sigemptyset(&mask);
+       for (sig = 1; sig <= 31; sig++)
+       {
+               sigaddset(&mask, sig);
+       }
+       sigprocmask(SIG_UNBLOCK, &mask, NULL);
+
+       for (sig = 1; sig <= 31; sig++)
+       {
+               if(sig != SIGKILL && sig != SIGSTOP)
+               {
+                       assert(kill(getpid(), sig) == 0);
+                       sig_print(signal2name(sig));
+               }
+       }
+       return 0;
+}
diff --git a/tests/signal_receive.test b/tests/signal_receive.test
new file mode 100755
index 0000000..03b26d3
--- /dev/null
+++ b/tests/signal_receive.test
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+run_strace -a15 -esignal $args > "$EXP"
+match_grep "$LOG" "$EXP"
+rm -f "$EXP"
-- 
1.8.3.1




------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to