[lvm-devel] [PATCH] test: lvmetad_dump always timed out when using nc

Eric Ren zren at suse.com
Wed Dec 13 11:13:03 UTC 2017


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 at 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




More information about the lvm-devel mailing list