[PATCH] fstests: Fix wrong ret value in log

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



From: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>

Current code always output "truncfile returned 0" because $? was
modified by previous command.

This patch fixed above bug.

Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
---
 tests/generic/014 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/generic/014 b/tests/generic/014
index 7961961..a775f8b 100755
--- a/tests/generic/014
+++ b/tests/generic/014
@@ -61,10 +61,12 @@ echo "brevity is wit..."
 echo "------"
 echo "test 1"
 echo "------"
-if ! src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
+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 $? : \"$out\""
+    echo "truncfile returned $ret : \"$out\""
 else
     echo "OK"
 fi
-- 
1.8.5.1

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



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux