• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
50echo 'ex /a' > $TMPFILE.cmd
51$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
52rm -rf $TMPFILE.cmd
53$FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT1.new 2>&1
54status=$?
55echo Exit status is $status >> $OUT1.new
56sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
57rm -f $OUT1.new
58
59if [ "$ONE_PASS_ONLY" != "true" ]; then
60	$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1
61	status=$?
62	echo Exit status is $status >> $OUT2.new
63	echo 'ex /a' > $TMPFILE.cmd
64	$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
65	rm -rf $TMPFILE.cmd
66	sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
67	rm -f $OUT2.new
68fi
69
70eval $AFTER_CMD
71
72if [ "$SKIP_VERIFY" != "true" ] ; then
73	rm -f $test_name.ok $test_name.failed
74	cmp -s $OUT1 $EXP1
75	status1=$?
76	if [ "$ONE_PASS_ONLY" != "true" ]; then
77		cmp -s $OUT2 $EXP2
78		status2=$?
79	else
80		status2=0
81	fi
82	if [ "$PASS_ZERO" = "true" ]; then
83		cmp -s $test_name.0.log	$test_dir/expect.0
84		status3=$?
85	else
86		status3=0
87	fi
88
89	if [ -z "$test_description" ] ; then
90		description="$test_name"
91	else
92		description="$test_name: $test_description"
93	fi
94
95	if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
96		echo "$description: ok"
97		touch $test_name.ok
98	else
99		echo "$description: failed"
100		rm -f $test_name.failed
101		if [ "$PASS_ZERO" = "true" ]; then
102			diff $DIFF_OPTS $test_dir/expect.0 \
103				$test_name.0.log >> $test_name.failed
104		fi
105		diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
106		if [ "$ONE_PASS_ONLY" != "true" ]; then
107			diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
108		fi
109	fi
110	rm -f tmp_expect
111fi
112
113if [ "$SKIP_CLEANUP" != "true" ] ; then
114	unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
115	unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
116	unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
117fi
118
119