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