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