diff options
author | Misono, Tomohiro <misono.tomohiro@jp.fujitsu.com> | 2017-09-05 14:49:02 +0900 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-09-08 16:15:05 +0200 |
commit | 02e9bb9f236e28801a7a2cb66c82ea9d04260018 (patch) | |
tree | 541d99bcd5db6767767fdeaccc7959ec4a614262 /tests/common | |
parent | dbe96ecd3f38d37ee0793297e7dbfb699b4a5aec (diff) |
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 <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/common')
-rw-r--r-- | tests/common | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/common b/tests/common index ebd41ba9..d450c2c8 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 } |