From: Zhao Lei Date: Tue, 22 Sep 2015 00:45:20 +0000 (+1000) Subject: generic/014: Fix wrong return value in output X-Git-Tag: v2022.05.01~2786 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=ed731fec7c4a5528a0e7afa03ce188d7e34192c7 generic/014: Fix wrong return value in output Current code always output "truncfile returned 0" because $? was modified by previous command. Use $ret to indicate the correct return value from truncfile. [dchinner: fix formatting issues, update commit message.] Signed-off-by: Zhao Lei Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/tests/generic/014 b/tests/generic/014 index 79619619..a144a474 100755 --- a/tests/generic/014 +++ b/tests/generic/014 @@ -61,12 +61,13 @@ echo "brevity is wit..." echo "------" echo "test 1" echo "------" -if ! src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1 -then - out=`cat $tmp.out` - echo "truncfile returned $? : \"$out\"" +src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1 +ret=$? +if [ "$ret" -ne 0 ]; then + out=`cat $tmp.out` + echo "truncfile returned $ret : \"$out\"" else - echo "OK" + echo "OK" fi exit