summaryrefslogtreecommitdiff
path: root/tests/j_short_trans_mcsum_64bit/script
diff options
context:
space:
mode:
authorAndreas Dilger <adilger@dilger.ca>2018-05-01 22:26:03 -0600
committerTheodore Ts'o <tytso@mit.edu>2018-06-22 17:59:35 -0400
commitc5d9d3ce5f564c055087bd69dbf71e64d9fe4461 (patch)
tree9b04670725948de78afa5498877caecf93569cad /tests/j_short_trans_mcsum_64bit/script
parentb7454eb8ee781a7a581b61007e2ca892f72e1a6f (diff)
downloade2fsprogs-c5d9d3ce5f564c055087bd69dbf71e64d9fe4461.tar.gz
tests: don't run sed multiple times on test output
Don't call sed multiple times on the output, and avoid the use of temporary files, or if possible. It would be convenient to use "sed -i" to only update the output file once, but this is not portable to all platforms. [ Fixed a few test regression failures --tytso ] Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tests/j_short_trans_mcsum_64bit/script')
-rw-r--r--tests/j_short_trans_mcsum_64bit/script27
1 files changed, 9 insertions, 18 deletions
diff --git a/tests/j_short_trans_mcsum_64bit/script b/tests/j_short_trans_mcsum_64bit/script
index a8f4e937..511d4b70 100644
--- a/tests/j_short_trans_mcsum_64bit/script
+++ b/tests/j_short_trans_mcsum_64bit/script
@@ -12,42 +12,33 @@ else
EXP=$test_dir/expect
fi
-cp /dev/null $OUT
+$MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal,metadata_csum -T ext4 $TMPFILE 131072 > $OUT.new 2>&1
-$MKE2FS -F -o Linux -b 4096 -O 64bit,has_journal,metadata_csum -T ext4 $TMPFILE 131072 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT 2>&1
-
-$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-rm -f $OUT.new
bitmaps="$($DUMPE2FS $TMPFILE 2>&1 | grep 'bitmap at' | sed -e 's/^.*bitmap at \([0-9]*\).*$/\1/g' | tr '\n' ',')"
-$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
+$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
-echo "debugfs write journal" >> $OUT
+echo "debugfs write journal" >> $OUT.new
echo "jo -c" > $TMPFILE.cmd
echo "jw -b $bitmaps /dev/zero" >> $TMPFILE.cmd
echo "jc" >> $TMPFILE.cmd
$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE 2>> $OUT.new > /dev/null
-sed -f $cmd_dir/filter.sed < $OUT.new >> $OUT
-rm -rf $OUT.new
-$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT
+$DUMPE2FS $TMPFILE 2>&1 | grep '^Journal features:' >> $OUT.new
test -d "$JOURNAL_DUMP_DIR" -a -w "$JOURNAL_DUMP_DIR" && cp "$TMPFILE" "$JOURNAL_DUMP_DIR/$test_name.img"
echo "logdump -c" > $TMPFILE.cmd
-$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
-rm -rf $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
-$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-rm -f $OUT.new
-
-rm -f $TMPFILE $TMPFILE.cmd
+sed -f $cmd_dir/filter.sed $OUT.new > $OUT
+rm -f $TMPFILE $TMPFILE.cmd $OUT.new
cmp -s $OUT $EXP
status=$?