File bug-1072624_test-lvmetad_dump-always-timed-out-when-using-nc.patch of Package device-mapper.18094

From 6ff44e96eb804f9024bf3f606d207bd863f0e672 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Wed, 13 Dec 2017 18:53:00 +0800
Subject: [PATCH] test: lvmetad_dump always timed out when using nc

lvmetad_dump uses either "socat" or "nc" to communicate
with lvmetad. But when using "nc" if "socat" is not
available, nc will listen forever by default, causing the
testcase timed out.

Signed-off-by: Eric Ren <zren@suse.com>
---
 test/lib/aux.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 6bc7bd47e..4603c1504 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -243,14 +243,14 @@ lvmetad_talk() {
 	local use=nc
 	if type -p socat >& /dev/null; then
 		use=socat
-	elif echo | not nc -U "$TESTDIR/lvmetad.socket" ; then
+	elif echo | not nc -w 1 -U "$TESTDIR/lvmetad.socket" ; then
 		echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2
 		echo "## failed to contact lvmetad."
 		return 1
 	fi
 
 	if test "$use" = nc ; then
-		nc -U "$TESTDIR/lvmetad.socket"
+		nc -w 1 -U "$TESTDIR/lvmetad.socket"
 	else
 		socat "unix-connect:$TESTDIR/lvmetad.socket" -
 	fi | tee -a lvmetad-talk.txt
-- 
2.13.6

openSUSE Build Service is sponsored by