All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: master - tests: detect nc or socat
Date: Sun,  2 Mar 2014 20:56:05 +0000 (UTC)	[thread overview]
Message-ID: <20140302205605.0CC786022B@fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6df716332c25a49ca41f9d68e10afca68dc5dd62
Commit:        6df716332c25a49ca41f9d68e10afca68dc5dd62
Parent:        6c377f5b3c36cc0514210821b3d0b72c10d2a819
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Sun Mar 2 21:48:28 2014 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Sun Mar 2 21:48:28 2014 +0100

tests: detect nc or socat

Since shell is not in -o pipefail mode here,
we need to generate separate failure ahead of tee.
---
 test/lib/aux.sh |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 67e046d..f450e63 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -87,15 +87,20 @@ prepare_lvmetad() {
 }
 
 lvmetad_talk() {
-    if type -p socat >& /dev/null; then
-	socat "unix-connect:$TESTDIR/lvmetad.socket" -
-    elif echo | nc -U "$TESTDIR/lvmetad.socket"; then
-	nc -U "$TESTDIR/lvmetad.socket"
-    else
-	echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2
-	echo "# failed to contact lvmetad"
-	exit 1
-    fi | tee -a lvmetad-talk.txt
+	local use=nc
+	if type -p socat >& /dev/null; then
+		use=socat
+	elif echo | not nc -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"
+	else
+		socat "unix-connect:$TESTDIR/lvmetad.socket" -
+	fi | tee -a lvmetad-talk.new
 }
 
 lvmetad_dump() {



                 reply	other threads:[~2014-03-02 20:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140302205605.0CC786022B@fedorahosted.org \
    --to=zkabelac@fedoraproject.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.