summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-01-02 06:30:14 +0000
committerEric Andersen <andersen@codepoet.org>2002-01-02 06:30:14 +0000
commiteae91bb3afc7976e855f21cb916bb3caaf513933 (patch)
tree9627e06e15117dfc5d11abab0d650e278a8431a3 /test
parent06d634eab66c7ebce0fe02d87b2c0b48ac4fa72b (diff)
Add a test for a sigchld bug
Diffstat (limited to 'test')
-rw-r--r--test/signal/.cvsignore4
-rw-r--r--test/signal/Makefile24
-rw-r--r--test/signal/sigchld.c38
3 files changed, 65 insertions, 1 deletions
diff --git a/test/signal/.cvsignore b/test/signal/.cvsignore
index 9ae898d74..975daee56 100644
--- a/test/signal/.cvsignore
+++ b/test/signal/.cvsignore
@@ -2,3 +2,7 @@ signal
signal.o
signal_glibc
signal_glibc.o
+sigchld
+sigchld.o
+sigchld_glibc
+sigchld_glibc.o
diff --git a/test/signal/Makefile b/test/signal/Makefile
index 07bd58cee..b3c6eee79 100644
--- a/test/signal/Makefile
+++ b/test/signal/Makefile
@@ -21,7 +21,7 @@ include $(TESTDIR)/Rules.mak
CFLAGS += -D_GNU_SOURCE
-TARGETS=signal signal_glibc
+TARGETS=signal signal_glibc sigchld sigchld_glibc
all: $(TARGETS)
signal: signal.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
@@ -46,6 +46,28 @@ signal_glibc: signal.c Makefile
-./$@
-@ echo " "
+sigchld: sigchld.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
+ -@ echo "-------"
+ -@ echo " "
+ -@ echo "Compiling vs uClibc: "
+ -@ echo " "
+ $(CC) $(CFLAGS) -c $< -o $@.o
+ $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
+ $(STRIPTOOL) -x -R .note -R .comment $@
+ -./$@
+ -@ echo " "
+
+sigchld_glibc: sigchld.c Makefile
+ -@ echo "-------"
+ -@ echo " "
+ -@ echo "Compiling vs GNU libc: "
+ -@ echo " "
+ $(HOST_CC) $(GLIBC_CFLAGS) -c $< -o $@.o
+ $(HOST_CC) $(GLIBC_LDFLAGS) $@.o -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $@
+ -./$@
+ -@ echo " "
+
clean:
rm -f *.[oa] *~ core $(TARGETS)
diff --git a/test/signal/sigchld.c b/test/signal/sigchld.c
new file mode 100644
index 000000000..05f4d1594
--- /dev/null
+++ b/test/signal/sigchld.c
@@ -0,0 +1,38 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/signal.h>
+#include <unistd.h>
+
+void test_handler(int signo)
+{
+ fprintf(stderr, "caught signo: %d\n", signo);
+}
+
+
+int main(void)
+{
+ int count = 0;
+ struct sigaction siga;
+ static sigset_t sigset;
+
+ sigfillset(&sigset);
+
+ siga.sa_handler = test_handler;
+ siga.sa_mask = sigset;
+ siga.sa_flags = 0;
+
+ if (0 != sigaction(SIGCHLD, &siga, (struct sigaction *)NULL)) {
+ fprintf(stderr, "ack!");
+ }
+ printf("give me a SIGCHLD\n");
+
+ for(;;) {
+ sleep(10);
+ printf("after sleep %d\n", ++count);
+ }
+
+ printf("after loop\n");
+
+ return 0;
+}
+