From 03957487571c7f8b9939bb1a8cf2bb827e079e14 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 17 Oct 2017 21:26:05 +0200 Subject: Add make check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 3 +++ LICENSE | 2 +- Makefile | 29 +++++++++++++++++++++++++++-- test.c | 9 +++++++++ tinysleep.c | 9 +++++++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 test.c create mode 100644 tinysleep.c diff --git a/.gitignore b/.gitignore index 5358cd7..6da38a3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ *.o *.su /pdeath +/tinysleep +/test +/.testdir diff --git a/LICENSE b/LICENSE index 028f3a3..383201c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ ISC License -© 2016 Mattias Andrée +© 2016, 2017 Mattias Andrée Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/Makefile b/Makefile index 8df5b80..04892ec 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ CONFIGFILE = config.mk include $(CONFIGFILE) -all: pdeath +all: pdeath tinysleep test .o: $(CC) -o $@ $^ $(LDFLAGS) @@ -11,6 +11,31 @@ all: pdeath .c.o: $(CC) -o $@ $< $(CPPFLAGS) $(CFLAGS) +check: pdeath tinysleep test + ./pdeath -L >/dev/null + ./pdeath -L | grep ABRT >/dev/null + ./pdeath -L | grep FPE >/dev/null + ./pdeath -L | grep ILL >/dev/null + ./pdeath -L | grep INT >/dev/null + ./pdeath -L | grep SEGV >/dev/null + ./pdeath -L | grep TERM >/dev/null + ! ./pdeath 2>/dev/null + ! ./pdeath KILL 2>/dev/null + ./pdeath KILL true + ! ./pdeath KILL false + ./pdeath 1 true + ./pdeath 1+1 true + ./pdeath 2-1 true + ! ./pdeath - true 2>/dev/null + ! ./test + ./pdeath KILL ./test + mkdir -p .testdir + sleep 1 & printf '%i\n' $$! > .testdir/pid; ./tinysleep + kill -0 $$(cat .testdir/pid) + ./pdeath KILL sleep 1 & printf '%i\n' $$! > .testdir/pid; ./tinysleep + ! kill -0 $$(cat .testdir/pid) 2>/dev/null + rm -r .testdir + install: pdeath mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" mkdir -p -- "$(DESTDIR)$(PREFIX)/share/licenses/pdeath" @@ -25,7 +50,7 @@ uninstall: -rm -rf -- "$(DESTDIR)$(PREFIX)/share/licenses/pdeath" clean: - -rm -f -- *.o pdeath + -rm -rf -- *.o pdeath .testdir SUFFIXES: .o .c.o diff --git a/test.c b/test.c new file mode 100644 index 0000000..082a952 --- /dev/null +++ b/test.c @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#include + +int +main(void) +{ + int val = 0; + return prctl(PR_GET_PDEATHSIG, &val) || !val; +} diff --git a/tinysleep.c b/tinysleep.c new file mode 100644 index 0000000..5c00a59 --- /dev/null +++ b/tinysleep.c @@ -0,0 +1,9 @@ +/* See LICENSE file for copyright and license details. */ +#include + +int +main(void) +{ + usleep(50000L); + return 0; +} -- cgit v1.2.3-70-g09d2