Whamcloud - gitweb
Many files:
[tools/e2fsprogs.git] / tests / f_swapfs / script
1 IMAGE=$test_dir/image.gz
2 VERIFY_FSCK_OPT=-yf
3 SWAP_FSCK_OPT=-Sy
4 NATIVE_FSCK_OPT=-sy
5 OUT=$test_name.log
6 EXP=$test_dir/expect
7
8 gunzip < $IMAGE > $TMPFILE
9
10 echo "Swapfs test" > $OUT
11
12 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
13 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
14 status=$?
15 echo Exit status is $status >> $OUT.new
16 sed -e '2d' $OUT.new >> $OUT
17
18 echo e2fsck $SWAP_FSCK_OPT -N test_filesys > $OUT.new
19 $FSCK $SWAP_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
20 status=$?
21 echo Exit status is $status >> $OUT.new
22 sed -e '2d' $OUT.new >> $OUT
23
24 echo Running debugfs.... >> $OUT
25 $DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE >> $OUT 2>&1
26 status=$?
27 echo Exit status is $status >> $OUT
28
29 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
30 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
31 status=$?
32 echo Exit status is $status >> $OUT.new
33 sed -e '2d' $OUT.new >> $OUT
34
35 echo e2fsck $NATIVE_FSCK_OPT -N test_filesys > $OUT.new
36 $FSCK $NATIVE_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
37 status=$?
38 echo Exit status is $status >> $OUT.new
39 sed -e '2d' $OUT.new >> $OUT
40
41 echo Running debugfs.... >> $OUT
42 $DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE >> $OUT 2>&1
43 status=$?
44 echo Exit status is $status >> $OUT
45
46 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
47 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
48 status=$?
49 echo Exit status is $status >> $OUT.new
50 sed -e '2d' $OUT.new >> $OUT
51 rm -f $OUT.new
52
53 rm $TMPFILE
54
55 #
56 # Do the verification
57 #
58
59 rm -f $test_name.ok $test_name.failed
60 cmp -s $OUT $EXP
61 status=$?
62
63 if [ "$status" = 0 ] ; then
64         echo "ok"
65         touch $test_name.ok
66 else
67         echo "failed"
68         diff -c $EXP $OUT > $test_name.failed
69 fi
70
71 unset IMAGE VERIFY_FSCK_OPT SWAP_FSCK_OPT NATIVE_FSCK_OPT OUT EXP