run_e2fsck revision 65f0aab98b20b5994a726ab90d355248bcddfffd
1if [ "$DESCRIPTION"x != x ]; then
2	printf "%s" "$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=tmp_expect
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=tmp_expect
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'  | tr -d \\015 >> $OUT1
54rm -f $OUT1.new
55
56if [ "$ONE_PASS_ONLY" != "true" ]; then
57	$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
58	status=$?
59	echo Exit status is $status >> $OUT2.new
60	sed -e '1d' $OUT2.new | sed -e '/^JFS DEBUG:/d'  > $OUT2
61	rm -f $OUT2.new
62fi
63
64eval $AFTER_CMD
65
66if [ "$SKIP_UNLINK" != "true" ] ; then
67	rm $TMPFILE
68fi
69
70if [ "$SKIP_VERIFY" != "true" ] ; then
71	rm -f $test_name.ok $test_name.failed
72	cmp -s $OUT1 $EXP1
73	status1=$?
74	if [ "$ONE_PASS_ONLY" != "true" ]; then
75		cmp -s $OUT2 $EXP2
76		status2=$?
77	else
78		status2=0
79	fi
80
81	if [ "$status1" = 0 -a "$status2" = 0 ] ; then
82		echo "ok"
83		touch $test_name.ok
84	else
85		echo "failed"
86		diff $DIFF_OPTS $EXP1 $OUT1 > $test_name.failed
87		if [ "$ONE_PASS_ONLY" != "true" ]; then
88			diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
89		fi
90	fi
91	rm -f tmp_expect
92fi
93
94if [ "$SKIP_CLEANUP" != "true" ] ; then
95	unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
96	unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
97	unset DESCRIPTION SKIP_UNLINK AFTER_CMD
98fi
99
100