run_check_stdout() uses "... | tee ... || _fail".  However, since tee
won't fail, _fail() is not called even if first command fails. 

Fix this by checking PIPESTATUS in the end.

Signed-off-by: Tomohiro Misono <misono.tomoh...@jp.fujitsu.com>
---
 tests/common | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/common b/tests/common
index d0324a6..b7d3436 100644
--- a/tests/common
+++ b/tests/common
@@ -154,9 +154,12 @@ run_check_stdout()
        echo "############### $@" >> "$RESULTS" 2>&1
        if [[ $TEST_LOG =~ tty ]]; then echo "CMD(stdout): $@" > /dev/tty; fi
        if [ "$1" = 'root_helper' ]; then
-               "$@" 2>&1 | tee -a "$RESULTS" || _fail "failed: $@"
+               "$@" 2>&1 | tee -a "$RESULTS"
        else
-               $INSTRUMENT "$@" 2>&1 | tee -a "$RESULTS" || _fail "failed: $@"
+               $INSTRUMENT "$@" 2>&1 | tee -a "$RESULTS"
+       fi
+       if [ ${PIPESTATUS[0]} -ne 0 ]; then
+               _fail "failed: $@"
        fi
 }
 
-- 
2.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to