run_e2fsck revision eb92f5741fdbb968045d49a2cad153fe7e21c32e
1if [ "$DESCRIPTION"x != x ]; then
2	test_description="$DESCRIPTION"
3fi
4if [ "$IMAGE"x = x ]; then
5	IMAGE=$test_dir/image.gz
6fi
7
8if [ "$FSCK_OPT"x = x ]; then
9	FSCK_OPT=-yf
10fi
11
12if [ "$SECOND_FSCK_OPT"x = x ]; then
13	SECOND_FSCK_OPT=-yf
14fi
15
16if [ "$OUT1"x = x ]; then
17	OUT1=$test_name.1.log
18fi
19
20if [ "$OUT2"x = x ]; then
21	OUT2=$test_name.2.log
22fi
23
24if [ "$EXP1"x = x ]; then
25	if [ -f $test_dir/expect.1.gz ]; then
26		EXP1=$test_name.1.tmp
27		gunzip < $test_dir/expect.1.gz > $EXP1
28	else
29		EXP1=$test_dir/expect.1
30	fi
31fi
32
33if [ "$EXP2"x = x ]; then
34	if [ -f $test_dir/expect.2.gz ]; then
35		EXP2=$test_name.2.tmp
36		gunzip < $test_dir/expect.2.gz > $EXP2
37	else
38		EXP2=$test_dir/expect.2
39	fi
40fi
41
42if [ "$SKIP_GUNZIP" != "true" ] ; then
43	gunzip < $IMAGE > $TMPFILE
44fi
45
46cp /dev/null $OUT1
47
48eval $PREP_CMD
49
50$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT1.new 2>&1
51status=$?
52echo Exit status is $status >> $OUT1.new
53sed -e '1d' $OUT1.new | sed -e '/^JFS DEBUG:/d' | \
54	    sed -e "s;$TMPFILE;test.img;" | tr -d \\015 >> $OUT1
55rm -f $OUT1.new
56
57if [ "$ONE_PASS_ONLY" != "true" ]; then
58	$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
59	status=$?
60	echo Exit status is $status >> $OUT2.new
61	sed -e '1d' $OUT2.new | sed -e '/^JFS DEBUG:/d' | \
62	    sed -e "s;$TMPFILE;test.img;" > $OUT2
63	rm -f $OUT2.new
64fi
65
66eval $AFTER_CMD
67
68if [ "$SKIP_VERIFY" != "true" ] ; then
69	rm -f $test_name.ok $test_name.failed
70	cmp -s $OUT1 $EXP1
71	status1=$?
72	if [ "$ONE_PASS_ONLY" != "true" ]; then
73		cmp -s $OUT2 $EXP2
74		status2=$?
75	else
76		status2=0
77	fi
78	if [ "$PASS_ZERO" = "true" ]; then
79		cmp -s $test_name.0.log	$test_dir/expect.0
80		status3=$?
81	else
82		status3=0
83	fi
84
85	if [ -z "$test_description" ] ; then
86		description="$test_name"
87	else
88		description="$test_name: $test_description"
89	fi
90
91	if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
92		echo "$description: ok"
93		touch $test_name.ok
94	else
95		echo "$description: failed"
96		rm -f $test_name.failed
97		if [ "$PASS_ZERO" = "true" ]; then
98			diff $DIFF_OPTS $test_dir/expect.0 \
99				$test_name.0.log >> $test_name.failed
100		fi
101		diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
102		if [ "$ONE_PASS_ONLY" != "true" ]; then
103			diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
104		fi
105	fi
106	rm -f tmp_expect
107fi
108
109if [ "$SKIP_CLEANUP" != "true" ] ; then
110	unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
111	unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
112	unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
113fi
114
115