OSDN Git Service

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