diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:49:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:49:25 +0000 |
commit | 464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch) | |
tree | 6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /tests/r_corrupt_fs/script | |
parent | Initial commit. (diff) | |
download | e2fsprogs-upstream.tar.xz e2fsprogs-upstream.zip |
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/r_corrupt_fs/script')
-rw-r--r-- | tests/r_corrupt_fs/script | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/r_corrupt_fs/script b/tests/r_corrupt_fs/script new file mode 100644 index 0000000..f6d3a89 --- /dev/null +++ b/tests/r_corrupt_fs/script @@ -0,0 +1,45 @@ +if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then + echo "$test_name: $test_description: skipped (no debugfs/resize2fs)" + return 0 +fi + +OUT=$test_name.log +if [ -f $test_dir/expect.gz ]; then + EXP=$test_name.tmp + gunzip < $test_dir/expect.gz > $EXP1 +else + EXP=$test_dir/expect +fi + +echo mke2fs -q -F -t ext4 -o Linux -b 1024 test.img 32M > $OUT.new +$MKE2FS -q -F -t ext4 -o Linux -b 1024 $TMPFILE 32M >> $OUT.new 2>&1 + +echo debugfs -w -R \"set_bg 1 free_blocks_count 65536\" /tmp/foo.img >> $OUT.new +$DEBUGFS -w -R "set_bg 1 free_blocks_count 65536" $TMPFILE > /dev/null 2>&1 + +if timeout -v 1s true > /dev/null 2>&1 ; then + TIMEOUT="timeout -v 30s" +else + TIMEOUT= +fi + +echo resize2fs -P /tmp/foo.img >> $OUT.new +$TIMEOUT $RESIZE2FS -P $TMPFILE >> $OUT.new 2>&1 + +sed -f $cmd_dir/filter.sed < $OUT.new > $OUT + +rm -f $TMPFILE $OUT.new + +cmp -s $OUT $EXP +status=$? + +if [ "$status" = 0 ] ; then + echo "$test_name: $test_description: ok" + touch $test_name.ok +else + echo "$test_name: $test_description: failed" + diff $DIFF_OPTS $EXP $OUT > $test_name.failed + rm -f $test_name.tmp +fi + +unset IMAGE OUT EXP TIMEOUT |