Further test stability patches from upstream.

This commit is contained in:
Richard W.M. Jones 2019-10-19 19:45:05 +01:00
parent 53652f6834
commit 17c0b58450
5 changed files with 54 additions and 12 deletions

View File

@ -1,7 +1,7 @@
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/3] tests/test-captive.sh: Increase sleep times.
Subject: [PATCH 1/4] 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.

View File

@ -1,7 +1,7 @@
From f4e7db5062dc59662ce05796f95f93017187f1d6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 19 Oct 2019 18:52:47 +0100
Subject: [PATCH 2/3] tests/test-captive.sh: Remove useless sleep.
Subject: [PATCH 2/4] tests/test-captive.sh: Remove useless sleep.
---
tests/test-captive.sh | 2 +-

View File

@ -1,7 +1,7 @@
From c3c6d81418c4dc23ac81dc2a6f5751a8c82667a3 Mon Sep 17 00:00:00 2001
From b6cbb0edc94772ce063bc4a64d1940519fd87fa2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 19 Oct 2019 19:11:22 +0100
Subject: [PATCH 3/3] tests/test-socket-activation.c: Don't check nbdkit exit
Subject: [PATCH 3/4] tests/test-socket-activation.c: Don't check nbdkit exit
status.
In this test we run nbdkit as a subprocess of the test. The test
@ -13,17 +13,19 @@ is not relevant so ignore the exit status.
This makes the test more stable.
---
tests/test-socket-activation.c | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
tests/test-socket-activation.c | 25 +------------------------
1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/tests/test-socket-activation.c b/tests/test-socket-activation.c
index 2141d6d..64ec327 100644
index 2141d6d..ec91114 100644
--- a/tests/test-socket-activation.c
+++ b/tests/test-socket-activation.c
@@ -88,30 +88,9 @@ cleanup (void)
@@ -86,32 +86,9 @@ static pid_t pid = 0;
static void
cleanup (void)
{
int status;
- int status;
-
- if (pid > 0) {
+ if (pid > 0)
kill (pid, SIGTERM);

View File

@ -0,0 +1,39 @@
From 57ae3c6098c35256ab1e3679f77ed28b5aad982a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 19 Oct 2019 19:42:40 +0100
Subject: [PATCH 4/4] tests/test-captive.sh: Better test for pidfile.
This test was still unstable on slower machines. Improve the test for
the pidfile to make it more stable.
Fixes commit 740f6dee658ee6adb356d9600e2b51bb22dbce1e
and commit 38165d0f8f5a4eb898d756a561811c2fe042fe4d.
---
tests/test-captive.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/test-captive.sh b/tests/test-captive.sh
index 22a90ca..82697a5 100755
--- a/tests/test-captive.sh
+++ b/tests/test-captive.sh
@@ -72,10 +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 5
-if test ! -s captive.pid; then
- echo "no pidfile yet"
- exit 10
+for i in {1..60}; do
+ if test -s captive.pid; then break; fi
+ sleep 1
+done
+if ! test -s captive.pid; then
+ echo "$0: no pidfile yet"
+ exit 10
fi
kill -s ABRT $(cat captive.pid) || exit 10
sleep 5
--
2.23.0

View File

@ -41,11 +41,12 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name
Source2: libguestfs.keyring
%endif
# Make tests/test-captive.sh stable.
# Make tests/test-captive.sh and tests/test-socket-activation stable.
# All upstream after nbdkit 1.15.5.
Patch1: 0001-tests-test-captive.sh-Increase-sleep-times.patch
Patch2: 0002-tests-test-captive.sh-Remove-useless-sleep.patch
# Make tests/test-socket-activation stable.
Patch3: 0003-tests-test-socket-activation.c-Don-t-check-nbdkit-ex.patch
Patch4: 0004-tests-test-captive.sh-Better-test-for-pidfile.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool