guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 01/05: tests: Do not leave processes behind.


From: Ludovic Courtès
Subject: [shepherd] 01/05: tests: Do not leave processes behind.
Date: Sat, 23 Jan 2016 22:20:26 +0000

civodul pushed a commit to branch master
in repository shepherd.

commit 3fedde2d885c5cb1e9759cc57b8142347cbc7568
Author: Ludovic Courtès <address@hidden>
Date:   Sat Jan 23 13:34:48 2016 +0100

    tests: Do not leave processes behind.
    
    Before that, shepherd processes were left behind because we would always
    remove the PID file before checking for its existence.
    
    * tests/basic.sh, tests/misbehaved-client.sh, tests/no-home.sh,
    tests/respawn.sh, tests/sigint.sh, tests/status-sexp.sh: Remove $pid
    only after it has been used to kill the daemon.
---
 tests/basic.sh             |    4 ++--
 tests/misbehaved-client.sh |    4 ++--
 tests/no-home.sh           |    4 ++--
 tests/respawn.sh           |    4 ++--
 tests/sigint.sh            |    6 +++---
 tests/status-sexp.sh       |    4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/basic.sh b/tests/basic.sh
index 386b2b0..14cc22b 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -30,8 +30,8 @@ pid="t-pid-$$"
 
 herd="herd -s $socket"
 
-trap "rm -f $socket $conf $stamp $log $pid;
-      test -f $pid && kill \`cat $pid\` || true" EXIT
+trap "rm -f $socket $conf $stamp $log;
+      test -f $pid && kill \`cat $pid\` || true; rm -f $pid" EXIT
 
 cat > "$conf"<<EOF
 (use-modules (srfi srfi-26))
diff --git a/tests/misbehaved-client.sh b/tests/misbehaved-client.sh
index cb06677..e473ad6 100644
--- a/tests/misbehaved-client.sh
+++ b/tests/misbehaved-client.sh
@@ -26,8 +26,8 @@ pid="t-pid-$$"
 
 herd="herd -s $socket"
 
-trap "rm -f $socket $conf $stamp $log $pid;
-      test -f $pid && kill \`cat $pid\` || true" EXIT
+trap "rm -f $socket $conf $stamp $log;
+      test -f $pid && kill \`cat $pid\` || true; rm -f $pid" EXIT
 
 rm -f "$pid"
 shepherd -I -s "$socket" -c /dev/null -l "$log" --pid="$pid" &
diff --git a/tests/no-home.sh b/tests/no-home.sh
index 132753b..5f8d752 100644
--- a/tests/no-home.sh
+++ b/tests/no-home.sh
@@ -32,8 +32,8 @@ pid="t-pid-$$"
 
 herd="herd -s $socket"
 
-trap "rm -f $socket $pid;
-      test -f $pid && kill \`cat $pid\` || true" EXIT
+trap "rm -f $socket;
+      test -f $pid && kill \`cat $pid\` || true; rm -f $pid" EXIT
 
 # Make sure 'dmd' starts even though $HOME is not writable.
 shepherd -I -s "$socket" -c /dev/null -l /dev/null --pid="$pid" &
diff --git a/tests/respawn.sh b/tests/respawn.sh
index 629e684..695d536 100644
--- a/tests/respawn.sh
+++ b/tests/respawn.sh
@@ -30,8 +30,8 @@ pid="t-pid-$$"
 herd="herd -s $socket"
 
 trap "cat $log || true ;
-  rm -f $socket $conf $stamp $log $pid $service1_pid $service2_pid ;
-  test -f $pid && kill \`cat $pid\` || true ;
+  rm -f $socket $conf $stamp $log ;
+  test -f $pid && kill \`cat $pid\` || true ; rm -f $pid ;
   test -f $service1_pid && kill \`cat $service1_pid\` || true ;
   test -f $service2_pid && kill \`cat $service2_pid\` || true ;
   rm -f $service1_pid $service2_pid" EXIT
diff --git a/tests/sigint.sh b/tests/sigint.sh
index 1fe1a3f..4c78ff7 100644
--- a/tests/sigint.sh
+++ b/tests/sigint.sh
@@ -1,5 +1,5 @@
 # GNU Shepherd --- Make sure SIGINT is correctly handled.
-# Copyright © 2014 Ludovic Courtès <address@hidden>
+# Copyright © 2014, 2016 Ludovic Courtès <address@hidden>
 #
 # This file is part of the GNU Shepherd.
 #
@@ -26,8 +26,8 @@ pid="t-pid-$$"
 
 herd="herd -s $socket"
 
-trap "rm -f $socket $conf $stamp $pid;
-      test -f $pid && kill \`cat $pid\` || true" EXIT
+trap "rm -f $socket $conf $stamp;
+      test -f $pid && kill \`cat $pid\` || true; rm -f $pid" EXIT
 
 cat > "$conf"<<EOF
 (use-modules (srfi srfi-26))
diff --git a/tests/status-sexp.sh b/tests/status-sexp.sh
index b47ce9a..02bba3d 100644
--- a/tests/status-sexp.sh
+++ b/tests/status-sexp.sh
@@ -26,8 +26,8 @@ pid="t-pid-$$"
 
 herd="herd -s $socket"
 
-trap "rm -f $socket $conf $stamp $log $pid;
-      test -f $pid && kill \`cat $pid\` || true" EXIT
+trap "rm -f $socket $conf $stamp $log;
+      test -f $pid && kill \`cat $pid\` || true; rm -f $pid" EXIT
 
 cat > "$conf"<<EOF
 (register-services



reply via email to

[Prev in Thread] Current Thread [Next in Thread]