]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - tests/run_e2fsck
ChangeLog, run_e2fsck, expect.1, expect.2, image.gz, name, script:
[thirdparty/e2fsprogs.git] / tests / run_e2fsck
1 if [ "$IMAGE"x = x ]; then
2 IMAGE=$test_dir/image.gz
3 fi
4
5 if [ "$FSCK_OPT"x = x ]; then
6 FSCK_OPT=-yf
7 fi
8
9 if [ "$SECOND_FSCK_OPT"x = x ]; then
10 SECOND_FSCK_OPT=-yf
11 fi
12
13 if [ "$OUT1"x = x ]; then
14 OUT1=$test_name.1.log
15 fi
16
17 if [ "$OUT2"x = x ]; then
18 OUT2=$test_name.2.log
19 fi
20
21 if [ "$EXP1"x = x ]; then
22 EXP1=$test_dir/expect.1
23 fi
24
25 if [ "$EXP2"x = x ]; then
26 EXP2=$test_dir/expect.2
27 fi
28
29 gunzip < $IMAGE > $TMPFILE
30
31 eval $PREP_CMD
32
33 $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1
34 status=$?
35 echo Exit status is $status >> $OUT1.new
36 sed -e '1d' $OUT1.new > $OUT1
37 rm -f $OUT1.new
38
39 if [ "$ONE_PASS_ONLY" != "true" ]; then
40 $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
41 status=$?
42 echo Exit status is $status >> $OUT2.new
43 sed -e '1d' $OUT2.new > $OUT2
44 rm -f $OUT2.new
45 fi
46
47 rm $TMPFILE
48
49 if [ "$SKIP_VERIFY" != "true" ] ; then
50 rm -f $test_name.ok $test_name.failed
51 cmp -s $OUT1 $EXP1
52 status1=$?
53 if [ "$ONE_PASS_ONLY" != "true" ]; then
54 cmp -s $OUT2 $EXP2
55 status2=$?
56 else
57 status2=0
58 fi
59
60 if [ "$status1" = 0 -a "$status2" = 0 ] ; then
61 echo "ok"
62 touch $test_name.ok
63 else
64 echo "failed"
65 diff -c $EXP1 $OUT1 > $test_name.failed
66 if [ "$ONE_PASS_ONLY" != "true" ]; then
67 diff -c $EXP2 $OUT2 >> $test_name.failed
68 fi
69 fi
70 fi
71
72 if [ "$SKIP_CLEANUP" != "true" ] ; then
73 unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 ONE_PASS_ONLY PREP_CMD
74 fi
75