Whamcloud - gitweb
2bce9733d91a9eb1dd52165aa7866002a748b58b
[tools/e2fsprogs.git] / tests / j_corrupt_journal_block / 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 echo >> $OUT
33 rm -f $TMPFILE.cmd
34
35 rm -f $TMPFILE
36
37 cmp -s $OUT $EXP
38 status=$?
39
40 if [ "$status" = 0 ] ; then
41         echo "$test_name: $test_description: ok"
42         touch $test_name.ok
43 else
44         echo "$test_name: $test_description: failed"
45         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
46         rm -f $test_name.tmp
47 fi
48
49 unset IMAGE FSCK_OPT OUT EXP
50
51 else #if test -x $DEBUGFS_EXE; then
52         echo "$test_name: $test_description: skipped"
53 fi