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