Whamcloud - gitweb
tests: clean up $DEBUGFS_EXE usage in scripts
[tools/e2fsprogs.git] / tests / j_corrupt_descr_csum / 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 rm -f $TMPFILE.cmd
36
37 rm -f $TMPFILE
38
39 cmp -s $OUT $EXP
40 status=$?
41
42 if [ "$status" = 0 ] ; then
43         echo "$test_name: $test_description: ok"
44         touch $test_name.ok
45 else
46         echo "$test_name: $test_description: failed"
47         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
48         rm -f $test_name.tmp
49 fi
50
51 unset IMAGE FSCK_OPT OUT EXP