Make tests/test-captive.sh stable (attempt 2).

This commit is contained in:
Richard W.M. Jones 2019-10-19 18:33:03 +01:00
parent 1c50b60365
commit ce06df6749
3 changed files with 46 additions and 11 deletions

View File

@ -0,0 +1,39 @@
From 740f6dee658ee6adb356d9600e2b51bb22dbce1e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 19 Oct 2019 18:31:24 +0100
Subject: [PATCH 1/2] tests/test-captive.sh: Increase sleep times.
Short sleeps in this test make the test very prone to failure on slow
or heavily loaded machines.
Fixes commit 38165d0f8f5a4eb898d756a561811c2fe042fe4d.
See also
https://www.redhat.com/archives/libguestfs/2019-October/msg00115.html
---
tests/test-captive.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test-captive.sh b/tests/test-captive.sh
index 88c0d81..8890073 100755
--- a/tests/test-captive.sh
+++ b/tests/test-captive.sh
@@ -72,13 +72,13 @@ fi
# Check that nbdkit death from unhandled signal affects exit status
status=0
nbdkit -U - -P captive.pid example1 --run '
-test ! -s captive.pid || sleep 1
+test ! -s captive.pid || sleep 5
if test ! -s captive.pid; then
echo "no pidfile yet"
exit 10
fi
kill -s ABRT $(cat captive.pid) || exit 10
-sleep 1
+sleep 5
' > captive.out || status=$?
if test $status != $(( 128 + $(kill -l ABRT) )); then
echo "$0: unexpected exit status $status"
--
2.23.0

View File

@ -1,19 +1,14 @@
From 05e478255b23a7149e5189fe718dad53a4488701 Mon Sep 17 00:00:00 2001
From f4e7db5062dc59662ce05796f95f93017187f1d6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 19 Oct 2019 18:31:24 +0100
Subject: [PATCH] tests/test-captive.sh: Revert sleep back to 5 seconds.
Date: Sat, 19 Oct 2019 18:52:47 +0100
Subject: [PATCH 2/2] tests/test-captive.sh: Remove useless sleep.
For unknown reasons this makes the test very prone to failure on slow
or heavily loaded machines.
Reverts sleep change from
commit 38165d0f8f5a4eb898d756a561811c2fe042fe4d.
---
tests/test-captive.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test-captive.sh b/tests/test-captive.sh
index 88c0d81..b62d5fc 100755
index 8890073..22a90ca 100755
--- a/tests/test-captive.sh
+++ b/tests/test-captive.sh
@@ -44,7 +44,7 @@ rm -f $files
@ -21,7 +16,7 @@ index 88c0d81..b62d5fc 100755
nbdkit -U $sock example1 --run '
- sleep 1; echo nbd=$nbd; echo port=$port; echo socket=$unixsocket
+ sleep 5; echo nbd=$nbd; echo port=$port; echo socket=$unixsocket
+ echo nbd=$nbd; echo port=$port; echo socket=$unixsocket
' > captive.out
# Check the output.

View File

@ -42,7 +42,8 @@ Source2: libguestfs.keyring
%endif
# Make tests/test-captive.sh stable.
Patch1: 0001-tests-test-captive.sh-Revert-sleep-back-to-5-seconds.patch
Patch1: 0001-tests-test-captive.sh-Increase-sleep-times.patch
Patch2: 0002-tests-test-captive.sh-Remove-useless-sleep.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool