guix-commits
[Top][All Lists]
Advanced

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

[dmd] 01/03: tests: Remove race condition in respawn test.


From: Ludovic Courtès
Subject: [dmd] 01/03: tests: Remove race condition in respawn test.
Date: Wed, 06 Jan 2016 22:53:07 +0000

civodul pushed a commit to branch master
in repository dmd.

commit f33f81fb5d3b2cc19c01aefd92eba3916878d683
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jan 6 23:11:00 2016 +0100

    tests: Remove race condition in respawn test.
    
    Fixes <http://bugs.gnu.org/22130>.
    Reported by Mark H Weaver <address@hidden>.
    
    * tests/respawn.sh: Use 'wait_for_file' instead of 'test -f' when
    checking for service PID files right after services have been started.
---
 tests/respawn.sh |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/respawn.sh b/tests/respawn.sh
index d88d33e..b98ce4f 100644
--- a/tests/respawn.sh
+++ b/tests/respawn.sh
@@ -1,5 +1,5 @@
 # GNU dmd --- Test respawnable services.
-# Copyright © 2013, 2014 Ludovic Courtès <address@hidden>
+# Copyright © 2013, 2014, 2016 Ludovic Courtès <address@hidden>
 #
 # This file is part of GNU dmd.
 #
@@ -95,8 +95,13 @@ $deco status dmd
 $deco status test1 | grep started
 $deco status test2 | grep started
 
-test -f "$service1_pid"
-test -f "$service2_pid"
+# The services are started, but that does not mean that they have
+# written their PID file yet, so use 'wait_for_file' rather than
+# 'test -f'.
+wait_for_file "$service1_pid"
+wait_for_file "$service2_pid"
+
+# Make sure the PIDs are valid.
 kill -0 `cat "$service1_pid"`
 kill -0 `cat "$service2_pid"`
 



reply via email to

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