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>
master
Misono, Tomohiro 2017-09-05 14:49:02 +09:00 committed by David Sterba
parent dbe96ecd3f
commit 02e9bb9f23
1 changed files with 5 additions and 2 deletions

View File

@ -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
}