From 30084381b0478836fd0355bf2efa29b14b3fa93c Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 9 Mar 2012 15:03:13 +0100
Subject: [PATCH] Enable pipefail mode for shell tests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These allow more accurate checks.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 htools/offline-test.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/htools/offline-test.sh b/htools/offline-test.sh
index 3b86d6be0..f5708a195 100755
--- a/htools/offline-test.sh
+++ b/htools/offline-test.sh
@@ -21,6 +21,7 @@
 # programs, checking basic command line functionality.
 
 set -e
+set -o pipefail
 
 . $(dirname $0)/cli-tests-defs.sh
 
@@ -49,7 +50,7 @@ echo OK
 
 echo Checking extra arguments
 for prog in hspace hbal hinfo; do
-  ! $prog unexpected-argument 2>&1 | \
+  (! $prog unexpected-argument 2>&1 ) | \
     grep -q "Error: this program doesn't take any arguments"
 done
 echo OK
@@ -131,10 +132,10 @@ echo OK
 
 echo IAllocator checks
 # test that on invalid files it can't parse the request
-! hail /dev/null 2>&1 | grep -q "Invalid JSON"
+(! hail /dev/null 2>&1 ) | grep -q "Invalid JSON"
 ! hail <(echo '[]') >/dev/null 2>&1
-! hail <(echo '{}') 2>&1 | grep -q "key 'request' not found"
-! hail <(echo '{"request": 0}') 2>&1 | grep -q "key 'request'"
+(! hail <(echo '{}') 2>&1 ) | grep -q "key 'request' not found"
+(! hail <(echo '{"request": 0}') 2>&1 ) | grep -q "key 'request'"
 ! hail $TESTDATA_DIR/hail-invalid-reloc.json >/dev/null 2>&1
 
 # just test that it can read the file, print the cluster and generate
-- 
GitLab