summaryrefslogtreecommitdiff
path: root/tests/f_resize_inode/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/f_resize_inode/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/f_resize_inode/script')
-rw-r--r--tests/f_resize_inode/script83
1 files changed, 28 insertions, 55 deletions
diff --git a/tests/f_resize_inode/script b/tests/f_resize_inode/script
index a4f1949a..58915a74 100644
--- a/tests/f_resize_inode/script
+++ b/tests/f_resize_inode/script
@@ -13,120 +13,93 @@ else
EXP=$test_dir/expect
fi
-cp /dev/null $OUT
-
dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
-echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT
-$MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 |
- sed -f $cmd_dir/filter.sed >> $OUT
+echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT.new
+$MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 >> $OUT.new 2>&1
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-echo ----------------------------------------------- >> $OUT
+echo ----------------------------------------------- >> $OUT.new
-echo " " >> $OUT
-echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img" > $OUT.new
+echo " " >> $OUT.new
+echo "debugfs -R ''set_inode_field <7> block[2] 42'' -w test.img" >> $OUT.new
$DEBUGFS -R "set_inode_field <7> block[2] 42" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-echo ----------------------------------------------- >> $OUT
+echo ----------------------------------------------- >> $OUT.new
-echo " " >> $OUT
-echo "debugfs -R ''clri <7>'' -w test.img" > $OUT.new
+echo " " >> $OUT.new
+echo "debugfs -R ''clri <7>'' -w test.img" >> $OUT.new
$DEBUGFS -R "clri <7>" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-echo ----------------------------------------------- >> $OUT
+echo ----------------------------------------------- >> $OUT.new
-echo " " >> $OUT
-echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img" > $OUT.new
+echo " " >> $OUT.new
+echo "debugfs -R ''set_inode_field <7> bmap[524] 57'' -w test.img" >> $OUT.new
$DEBUGFS -R "set_inode_field <7> bmap[524] 57" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-echo ----------------------------------------------- >> $OUT
+echo ----------------------------------------------- >> $OUT.new
-echo " " >> $OUT
-echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img" > $OUT.new
+echo " " >> $OUT.new
+echo "debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img" >> $OUT.new
$DEBUGFS -R "set_super_value reserved_gdt_blocks 15679" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-echo ----------------------------------------------- >> $OUT
+echo ----------------------------------------------- >> $OUT.new
-echo " " >> $OUT
-echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img" > $OUT.new
+echo " " >> $OUT.new
+echo "debugfs -R ''set_super_value reserved_gdt_blocks 32'' -w test.img" >> $OUT.new
$DEBUGFS -R "set_super_value reserved_gdt_blocks 32" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
-sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
-$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
+$FSCK $FSCK_OPT -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
+sed -f $cmd_dir/filter.sed $OUT.new > $OUT
rm -f $OUT.new
-
cmp -s $OUT $EXP
status=$?