Whamcloud - gitweb
tests: don't run sed multiple times on test output
[tools/e2fsprogs.git] / tests / r_fixup_lastbg / script
index 0451421..9fc0ec5 100755 (executable)
@@ -5,8 +5,7 @@ if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then
 fi
 
 EXP=$test_dir/expect
-OUT=$test_name.out
-LOG=$test_name.log
+OUT=$test_name.log
 E2FSCK=../e2fsck/e2fsck
 
 $MKE2FS -T ext4 -b 1024 -F -U 56d3ee50-8532-4f29-8181-d7c6ea4a94a6 $TMPFILE 20000 > $OUT 2>&1
@@ -20,17 +19,17 @@ $RESIZE2FS_EXE -f -p $TMPFILE 20004 >> $OUT 2>&1
 $DUMPE2FS $TMPFILE 2>&1 | grep -A10 '^Group 2:' >> $OUT
 $E2FSCK -fy $TMPFILE >> $OUT 2>&1
 
-sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" < $OUT > $LOG
-rm -rf $OUT
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.new
+mv $OUT.new $OUT
 
-cmp -s $LOG $EXP
-RC=$?
-if [ $RC -eq 0 ]; then
+cmp -s $OUT $EXP
+status=$?
+if [ $status -eq 0 ]; then
        echo "$test_name: $test_description: ok"
        touch $test_name.ok
 else
        echo "$test_name: $test_description: failed"
-       diff -u $EXP $LOG > $test_name.failed
+       diff -u $EXP $OUT > $test_name.failed
 fi
 
-unset EXP LOG OUT E2FSCK
+unset EXP OUT E2FSCK