From 02e9bb9f236e28801a7a2cb66c82ea9d04260018 Mon Sep 17 00:00:00 2001 From: "Misono, Tomohiro" Date: Tue, 5 Sep 2017 14:49:02 +0900 Subject: [PATCH] btrfs-progs: test: fix run_check_stdout() call _fail() 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 Signed-off-by: David Sterba --- tests/common | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/common b/tests/common index ebd41ba..d450c2c 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.7.4