]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - tests/j_corrupt_revoke_block/script
tests: clean up $DEBUGFS_EXE usage in scripts
[thirdparty/e2fsprogs.git] / tests / j_corrupt_revoke_block / script
CommitLineData
3819bff4
AD
1if ! test -x $DEBUGFS_EXE; then
2 echo "$test_name: $test_description: skipped (no debugfs)"
3 return 0
4fi
eb266fc5
DW
5
6IMAGE=$test_dir/image.gz
7FSCK_OPT=-fy
8OUT=$test_name.log
9if [ -f $test_dir/expect.gz ]; then
10 EXP=$test_name.tmp
11 gunzip < $test_dir/expect.gz > $EXP1
12else
13 EXP=$test_dir/expect
14fi
15
16cp /dev/null $OUT
17
18gzip -d < $IMAGE > $TMPFILE
19
20$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
21status=$?
22echo Exit status is $status >> $OUT.new
23sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
24rm -f $OUT.new
25
26$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1
27status=$?
28echo Exit status is $status >> $OUT.new
29sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new >> $OUT
30rm -f $OUT.new
31
32echo "cat /a" > $TMPFILE.cmd
63a801de 33echo >> $TMPFILE.cmd
3819bff4 34$DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT
eb266fc5
DW
35rm -f $TMPFILE.cmd
36
37rm -f $TMPFILE
38
39cmp -s $OUT $EXP
40status=$?
41
42if [ "$status" = 0 ] ; then
43 echo "$test_name: $test_description: ok"
44 touch $test_name.ok
45else
46 echo "$test_name: $test_description: failed"
47 diff $DIFF_OPTS $EXP $OUT > $test_name.failed
48 rm -f $test_name.tmp
49fi
50
51unset IMAGE FSCK_OPT OUT EXP