common/quota: remove redundant SELinux detection code
[xfstests-dev.git] / check
1 #!/bin/bash
2 #
3 # Control script for QA
4 #
5 # Copyright (c) 2000-2002,2006 Silicon Graphics, Inc.  All Rights Reserved.
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation.
10 #
11 # This program is distributed in the hope that it would be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write the Free Software Foundation,
18 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 #
20 #
21
22 tmp=/tmp/$$
23 status=0
24 needwrap=true
25 needsum=true
26 n_try=0
27 try=""
28 n_bad=0
29 sum_bad=0
30 bad=""
31 n_notrun=0
32 notrun=""
33 interrupt=true
34 diff="diff -u"
35 showme=false
36 have_test_arg=false
37 randomize=false
38 export here=`pwd`
39 xfile=""
40 brief_test_summary=false
41 err_msg=""
42 do_report=false
43 DUMP_OUTPUT=false
44
45 # start the initialisation work now
46 iam=check
47
48 export MSGVERB="text:action"
49 export QA_CHECK_FS=${QA_CHECK_FS:=true}
50
51 # number of diff lines from a failed test, 0 for whole output
52 export DIFF_LENGTH=${DIFF_LENGTH:=10}
53
54 # by default don't output timestamps
55 timestamp=${TIMESTAMP:=false}
56
57 rm -f $tmp.list $tmp.tmp $tmp.grep $here/$iam.out $tmp.xlist $tmp.report.*
58
59 SRC_GROUPS="generic shared"
60 export SRC_DIR="tests"
61
62 usage()
63 {
64     echo "Usage: $0 [options] [testlist]"'
65
66 check options
67     -nfs                test NFS
68     -cifs               test CIFS
69     -overlay            test overlay
70     -tmpfs              test TMPFS
71     -l                  line mode diff
72     -udiff              show unified diff (default)
73     -n                  show me, do not run tests
74     -T                  output timestamps
75     -r                  randomize test order
76     -d                  dump test output to stdout
77     -b                  brief test summary
78     -R fmt[,fmt]        generate report in formats specified. Supported format: [xunit]
79     --large-fs          optimise scratch device for large filesystems
80     -s section          run only specified section from config file
81     -S section          exclude the specified section from the config file
82
83 testlist options
84     -g group[,group...] include tests from these groups
85     -x group[,group...] exclude tests from these groups
86     -X exclude_file     exclude individual tests
87     -E external_file    exclude individual tests
88     [testlist]          include tests matching names in testlist
89
90 testlist argument is a list of tests in the form of <test dir>/<test name>.
91
92 <test dir> is a directory under tests that contains a group file,
93 with a list of the names of the tests in that directory.
94
95 <test name> may be either a specific test file name (e.g. xfs/001) or
96 a test file name match pattern (e.g. xfs/*).
97
98 group argument is either a name of a tests group to collect from all
99 the test dirs (e.g. quick) or a name of a tests group to collect from
100 a specific tests dir in the form of <test dir>/<group name> (e.g. xfs/quick).
101
102 exclude_file argument refers to a name of a file inside each test directory.
103 for every test dir where this file is found, the listed test names are
104 excluded from the list of tests to run from that test dir.
105
106 external_file argument is a path to a single file containing a list of tests
107 to exclude in the form of <test dir>/<test name>.
108
109 examples:
110  check xfs/001
111  check -g quick
112  check -g xfs/quick
113  check -x stress xfs/*
114  check -X .exclude -g auto
115  check -E ~/.xfstests.exclude
116 '
117             exit 0
118 }
119
120 get_sub_group_list()
121 {
122         local d=$1
123         local grp=$2
124
125         test -s "$SRC_DIR/$d/group" || return 1
126
127         local grpl=$(sed -n < $SRC_DIR/$d/group \
128                 -e 's/#.*//' \
129                 -e 's/$/ /' \
130                 -e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
131         echo $grpl
132 }
133
134 get_group_list()
135 {
136         local grp=$1
137         local grpl=""
138         local sub=$(dirname $grp)
139
140         if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
141                 # group is given as <subdir>/<group> (e.g. xfs/quick)
142                 grp=$(basename $grp)
143                 get_sub_group_list $sub $grp
144                 return
145         fi
146
147         for d in $SRC_GROUPS $FSTYP; do
148                 if ! test -d "$SRC_DIR/$d" ; then
149                         continue
150                 fi
151                 grpl="$grpl $(get_sub_group_list $d $grp)"
152         done
153         echo $grpl
154 }
155
156 # Find all tests, excluding files that are test metadata such as group files.
157 # It matches test names against $VALID_TEST_NAME defined in common/rc
158 get_all_tests()
159 {
160         touch $tmp.list
161         for d in $SRC_GROUPS $FSTYP; do
162                 if ! test -d "$SRC_DIR/$d" ; then
163                         continue
164                 fi
165                 ls $SRC_DIR/$d/* | \
166                         grep -v "\..*" | \
167                         grep "^$SRC_DIR/$d/$VALID_TEST_NAME"| \
168                         grep -v "group\|Makefile" >> $tmp.list 2>/dev/null
169         done
170 }
171
172 # takes the list of tests to run in $tmp.list, and removes the tests passed to
173 # the function from that list.
174 trim_test_list()
175 {
176         test_list="$*"
177
178         rm -f $tmp.grep
179         numsed=0
180         for t in $test_list
181         do
182             if [ $numsed -gt 100 ]; then
183                 grep -v -f $tmp.grep <$tmp.list >$tmp.tmp
184                 mv $tmp.tmp $tmp.list
185                 numsed=0
186                 rm -f $tmp.grep
187             fi
188             echo "^$t\$" >>$tmp.grep
189             numsed=`expr $numsed + 1`
190         done
191         grep -v -f $tmp.grep <$tmp.list >$tmp.tmp
192         mv $tmp.tmp $tmp.list
193 }
194
195
196 _wallclock()
197 {
198     date "+%s"
199 }
200
201 _timestamp()
202 {
203     now=`date "+%T"`
204     echo -n " [$now]"
205 }
206
207 _prepare_test_list()
208 {
209         unset list
210         # Tests specified on the command line
211         if [ -s $tmp.arglist ]; then
212                 cat $tmp.arglist > $tmp.list
213         else
214                 touch $tmp.list
215         fi
216
217         # Specified groups to include
218         for group in $GROUP_LIST; do
219                 list=$(get_group_list $group)
220                 if [ -z "$list" ]; then
221                         echo "Group \"$group\" is empty or not defined?"
222                         exit 1
223                 fi
224
225                 for t in $list; do
226                         grep -s "^$t\$" $tmp.list >/dev/null || \
227                                                         echo "$t" >>$tmp.list
228                 done
229         done
230
231         if ! $have_test_arg && [ -z "$GROUP_LIST" ]; then
232                 # no test numbers, do everything
233                 get_all_tests
234         fi
235
236         # Specified groups to exclude
237         for xgroup in $XGROUP_LIST; do
238                 list=$(get_group_list $xgroup)
239                 if [ -z "$list" ]; then
240                         echo "Group \"$xgroup\" is empty or not defined?"
241                         exit 1
242                 fi
243
244                 trim_test_list $list
245         done
246
247         # sort the list of tests into numeric order
248         list=`sort -n $tmp.list | uniq`
249         rm -f $tmp.list $tmp.tmp $tmp.grep
250
251         if $randomize
252         then
253                 list=`echo $list | awk -f randomize.awk`
254         fi
255 }
256
257 # Process command arguments first.
258 while [ $# -gt 0 ]; do
259         case "$1" in
260         -\? | -h | --help) usage ;;
261
262         -nfs)           FSTYP=nfs ;;
263         -cifs)          FSTYP=cifs ;;
264         -overlay)       FSTYP=overlay; export OVERLAY=true ;;
265         -tmpfs)         FSTYP=tmpfs ;;
266
267         -g)     group=$2 ; shift ;
268                 GROUP_LIST="$GROUP_LIST ${group//,/ }"
269                 ;;
270
271         -x)     xgroup=$2 ; shift ;
272                 XGROUP_LIST="$XGROUP_LIST ${xgroup//,/ }"
273                 ;;
274
275         -X)     xfile=$2; shift ;
276                 for d in $SRC_GROUPS $FSTYP; do
277                         [ -f $SRC_DIR/$d/$xfile ] || continue
278                         for f in `sed "s/#.*$//" $SRC_DIR/$d/$xfile`; do
279                                 echo $d/$f >> $tmp.xlist
280                         done
281                 done
282                 ;;
283         -E)     xfile=$2; shift ;
284                 if [ -f $xfile ]; then
285                         sed "s/#.*$//" "$xfile" >> $tmp.xlist
286                 fi
287                 ;;
288         -s)     RUN_SECTION="$RUN_SECTION $2"; shift ;;
289         -S)     EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;;
290         -l)     diff="diff" ;;
291         -udiff) diff="$diff -u" ;;
292
293         -n)     showme=true ;;
294         -r)     randomize=true ;;
295
296         -T)     timestamp=true ;;
297         -d)     DUMP_OUTPUT=true ;;
298         -b)     brief_test_summary=true;;
299         -R)     report_fmt=$2 ; shift ;
300                 REPORT_LIST="$REPORT_LIST ${report_fmt//,/ }"
301                 do_report=true
302                 ;;
303         --large-fs) export LARGE_SCRATCH_DEV=yes ;;
304         --extra-space=*) export SCRATCH_DEV_EMPTY_SPACE=${r#*=} ;;
305
306         -*)     usage ;;
307         *)      # not an argument, we've got tests now.
308                 have_test_arg=true ;;
309         esac
310
311         # if we've found a test specification, the break out of the processing
312         # loop before we shift the arguments so that this is the first argument
313         # that we process in the test arg loop below.
314         if $have_test_arg; then
315                 break;
316         fi
317
318         shift
319 done
320
321 # we need common/config, source it after processing args, overlay needs FSTYP
322 # set before sourcing common/config
323 if ! . ./common/config; then
324         echo "$iam: failed to source common/config"
325         exit 1
326 fi
327
328 # Process tests from command line now.
329 if $have_test_arg; then
330         while [ $# -gt 0 ]; do
331                 case "$1" in
332                 -*)     echo "Arguments before tests, please!"
333                         status=1
334                         exit $status
335                         ;;
336                 *)      # Expand test pattern (e.g. xfs/???, *fs/001)
337                         list=$(cd $SRC_DIR; echo $1)
338                         for t in $list; do
339                                 test_dir=`dirname $t`
340                                 test_dir=${test_dir#$SRC_DIR/*}
341                                 test_name=`basename $t`
342                                 group_file=$SRC_DIR/$test_dir/group
343
344                                 if egrep -q "^$test_name" $group_file; then
345                                         # in group file ... OK
346                                         echo $SRC_DIR/$test_dir/$test_name \
347                                                 >>$tmp.arglist
348                                 else
349                                         # oops
350                                         echo "$t - unknown test, ignored"
351                                 fi
352                         done
353                         ;;
354                 esac
355
356                 shift
357         done
358 fi
359
360 # we need common/rc
361 if ! . ./common/rc
362 then
363     echo "check: failed to source common/rc"
364     exit 1
365 fi
366
367 if [ `id -u` -ne 0 ]
368 then
369     echo "check: QA must be run as root"
370     exit 1
371 fi
372
373 _wipe_counters()
374 {
375         n_try="0"
376         n_bad="0"
377         n_notrun="0"
378         unset try notrun bad
379 }
380
381 _wrapup()
382 {
383         seq="check"
384         check="$RESULT_BASE/check"
385
386         if $showme; then
387                 if $needwrap; then
388                         if $do_report; then
389                                 _make_section_report
390                         fi
391                         needwrap=false
392                 fi
393         elif $needwrap; then
394                 if [ -f $check.time -a -f $tmp.time ]; then
395                         cat $check.time $tmp.time  \
396                                 | $AWK_PROG '
397                                 { t[$1] = $2 }
398                                 END {
399                                         if (NR > 0) {
400                                                 for (i in t) print i " " t[i]
401                                         }
402                                 }' \
403                                 | sort -n >$tmp.out
404                         mv $tmp.out $check.time
405                 fi
406
407                 echo "" >>$check.log
408                 date >>$check.log
409
410                 echo "SECTION       -- $section" >>$tmp.summary
411                 echo "=========================" >>$tmp.summary
412                 if [ ! -z "$n_try" -a $n_try != 0 ]; then
413                         if [ $brief_test_summary == "false" ]; then
414                                 echo "Ran:$try"
415                                 echo "Ran:$try" >>$tmp.summary
416                         fi
417                         echo "Ran:$try" >>$check.log
418                 fi
419
420                 $interrupt && echo "Interrupted!" | tee -a $check.log
421
422                 if [ ! -z "$notrun" ]; then
423                         if [ $brief_test_summary == "false" ]; then
424                                 echo "Not run:$notrun"
425                                 echo "Not run:$notrun" >>$tmp.summary
426                         fi
427                         echo "Not run:$notrun" >>$check.log
428                 fi
429
430                 if [ ! -z "$n_bad" -a $n_bad != 0 ]; then
431                         echo "Failures:$bad"
432                         echo "Failed $n_bad of $n_try tests"
433                         echo "Failures:$bad" >>$check.log
434                         echo "Failed $n_bad of $n_try tests" >>$check.log
435                         echo "Failures:$bad" >>$tmp.summary
436                         echo "Failed $n_bad of $n_try tests" >>$tmp.summary
437                 else
438                         echo "Passed all $n_try tests"
439                         echo "Passed all $n_try tests" >>$check.log
440                         echo "Passed all $n_try tests" >>$tmp.summary
441                 fi
442                 echo "" >>$tmp.summary
443                 if $do_report; then
444                         _make_section_report
445                 fi
446                 needwrap=false
447         fi
448
449         sum_bad=`expr $sum_bad + $n_bad`
450         _wipe_counters
451         rm -f /tmp/*.rawout /tmp/*.out /tmp/*.err /tmp/*.time
452         if ! $OPTIONS_HAVE_SECTIONS; then
453                 rm -f $tmp.*
454         fi
455 }
456
457 _summary()
458 {
459         _wrapup
460         if $showme; then
461                 :
462         elif $needsum; then
463                 count=`wc -L $tmp.summary | cut -f1 -d" "`
464                 cat $tmp.summary
465                 needsum=false
466         fi
467         rm -f $tmp.*
468 }
469
470 _check_filesystems()
471 {
472         if [ -f ${RESULT_DIR}/require_test ]; then
473                 _check_test_fs || err=true
474                 rm -f ${RESULT_DIR}/require_test*
475         fi
476         if [ -f ${RESULT_DIR}/require_scratch ]; then
477                 _check_scratch_fs || err=true
478                 rm -f ${RESULT_DIR}/require_scratch*
479         fi
480 }
481
482 _prepare_test_list
483
484 if $OPTIONS_HAVE_SECTIONS; then
485         trap "_summary; exit \$status" 0 1 2 3 15
486 else
487         trap "_wrapup; exit \$status" 0 1 2 3 15
488 fi
489
490 for section in $HOST_OPTIONS_SECTIONS; do
491         OLD_FSTYP=$FSTYP
492         OLD_TEST_FS_MOUNT_OPTS=$TEST_FS_MOUNT_OPTS
493         get_next_config $section
494
495         # Do we need to run only some sections ?
496         if [ ! -z "$RUN_SECTION" ]; then
497                 skip=true
498                 for s in $RUN_SECTION; do
499                         if [ $section == $s ]; then
500                                 skip=false
501                                 break;
502                         fi
503                 done
504                 if $skip; then
505                         continue
506                 fi
507         fi
508
509         # Did this section get excluded?
510         if [ ! -z "$EXCLUDE_SECTION" ]; then
511                 skip=false
512                 for s in $EXCLUDE_SECTION; do
513                         if [ $section == $s ]; then
514                                 skip=true
515                                 break;
516                         fi
517                 done
518                 if $skip; then
519                         continue
520                 fi
521         fi
522
523         mkdir -p $RESULT_BASE
524         if [ ! -d $RESULT_BASE ]; then
525                 echo "failed to create results directory $RESULT_BASE"
526                 status=1
527                 exit
528         fi
529
530         if $OPTIONS_HAVE_SECTIONS; then
531                 echo "SECTION       -- $section"
532         fi
533
534         sect_start=`_wallclock`
535         if $RECREATE_TEST_DEV || [ "$OLD_FSTYP" != "$FSTYP" ]; then
536                 echo "RECREATING    -- $FSTYP on $TEST_DEV"
537                 _test_unmount 2> /dev/null
538                 if ! _test_mkfs >$tmp.err 2>&1
539                 then
540                         echo "our local _test_mkfs routine ..."
541                         cat $tmp.err
542                         echo "check: failed to mkfs \$TEST_DEV using specified options"
543                         status=1
544                         exit
545                 fi
546                 if ! _test_mount
547                 then
548                         echo "check: failed to mount $TEST_DEV on $TEST_DIR"
549                         status=1
550                         exit
551                 fi
552                 _prepare_test_list
553         elif [ "$OLD_TEST_FS_MOUNT_OPTS" != "$TEST_FS_MOUNT_OPTS" ]; then
554                 _test_unmount 2> /dev/null
555                 if ! _test_mount
556                 then
557                         echo "check: failed to mount $TEST_DEV on $TEST_DIR"
558                         status=1
559                         exit
560                 fi
561         fi
562
563         init_rc
564
565         seq="check"
566         check="$RESULT_BASE/check"
567
568         # don't leave old full output behind on a clean run
569         rm -f $check.full
570
571         [ -f $check.time ] || touch $check.time
572
573         # print out our test configuration
574         echo "FSTYP         -- `_full_fstyp_details`"
575         echo "PLATFORM      -- `_full_platform_details`"
576         if [ ! -z "$SCRATCH_DEV" ]; then
577           echo "MKFS_OPTIONS  -- `_scratch_mkfs_options`"
578           echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
579         fi
580         echo
581         needwrap=true
582
583         if [ ! -z "$SCRATCH_DEV" ]; then
584           _scratch_unmount 2> /dev/null
585           # call the overridden mkfs - make sure the FS is built
586           # the same as we'll create it later.
587
588           if ! _scratch_mkfs >$tmp.err 2>&1
589           then
590               echo "our local _scratch_mkfs routine ..."
591               cat $tmp.err
592               echo "check: failed to mkfs \$SCRATCH_DEV using specified options"
593               status=1
594               exit
595           fi
596
597           # call the overridden mount - make sure the FS mounts with
598           # the same options that we'll mount with later.
599           if ! _scratch_mount >$tmp.err 2>&1
600           then
601               echo "our local mount routine ..."
602               cat $tmp.err
603               echo "check: failed to mount \$SCRATCH_DEV using specified options"
604               status=1
605               exit
606           fi
607         fi
608
609         seqres="$check"
610         _check_test_fs
611
612         for seq in $list
613         do
614             err=false
615             err_msg=""
616             if [ ! -f $seq ]; then
617                 # Try to get full name in case the user supplied only seq id
618                 # and the test has a name. A bit of hassle to find really
619                 # the test and not its sample output or helping files.
620                 bname=$(basename $seq)
621                 full_seq=$(find $(dirname $seq) -name $bname* -executable |
622                     awk '(NR == 1 || length < length(shortest)) { shortest = $0 }\
623                         END { print shortest }')
624                 if [ -f $full_seq ] \
625                     && [ x$(echo $bname | grep -o "^$VALID_TEST_ID") != x ]; then
626                     seq=$full_seq
627                 fi
628             fi
629
630             # the filename for the test and the name output are different.
631             # we don't include the tests/ directory in the name output.
632             export seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"`
633
634             # Similarly, the result directory needs to replace the tests/
635             # part of the test location.
636             group=`dirname $seq`
637             if $OPTIONS_HAVE_SECTIONS; then
638                 export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;${RESULT_BASE}/$section;"`
639                 REPORT_DIR="$RESULT_BASE/$section"
640             else
641                 export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"`
642                 REPORT_DIR="$RESULT_BASE"
643             fi
644             seqres="$REPORT_DIR/$seqnum"
645
646             mkdir -p $RESULT_DIR
647
648             echo -n "$seqnum"
649
650             if $showme; then
651                 echo
652                 start=0
653                 stop=0
654                 n_notrun=`expr $n_notrun + 1`
655                 if $do_report; then
656                         _make_testcase_report "list"
657                 fi
658                 continue
659             fi
660             tc_status="pass"
661             if [ ! -f $seq ]; then
662                 echo " - no such test?"
663             else
664                 # really going to try and run this one
665                 #
666                 rm -f $seqres.out.bad
667
668                 # check if we really should run it
669                 if [ -s $tmp.xlist ]; then
670                         if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then
671                                 echo "       [expunged]"
672                                 continue
673                         fi
674                 fi
675
676                 # slashes now in names, sed barfs on them so use grep
677                 lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
678                 if [ "X$lasttime" != X ]; then
679                         echo -n " ${lasttime}s ..."
680                 else
681                         echo -n "       "       # prettier output with timestamps.
682                 fi
683                 rm -f core $seqres.notrun
684
685                 start=`_wallclock`
686                 $timestamp && echo -n " ["`date "+%T"`"]"
687                 [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
688                 $LOGGER_PROG "run xfstest $seqnum"
689                 if [ -w /dev/kmsg ]; then
690                         export date_time=`date +"%F %T"`
691                         echo "run fstests $seqnum at $date_time" > /dev/kmsg
692                         # _check_dmesg depends on this log in dmesg
693                         touch ${RESULT_DIR}/check_dmesg
694                 fi
695                 if [ "$DUMP_OUTPUT" = true ]; then
696                         ./$seq 2>&1 | tee $tmp.rawout
697                         # Because $? would get tee's return code
698                         sts=${PIPESTATUS[0]}
699                 else
700                         ./$seq >$tmp.rawout 2>&1
701                         sts=$?
702                 fi
703                 $timestamp && _timestamp
704                 stop=`_wallclock`
705
706                 _fix_malloc <$tmp.rawout >$tmp.out
707                 rm -f $tmp.rawout
708
709                 if [ -f core ]
710                 then
711                     err_msg="[dumped core]"
712                     echo -n " $err_msg"
713                     mv core $RESULT_BASE/$seqnum.core
714                     err=true
715                 fi
716
717                 if [ -f $seqres.notrun ]
718                 then
719                     $timestamp || echo -n " [not run] "
720                     $timestamp && echo " [not run]" && echo -n "        $seqnum -- "
721                     cat $seqres.notrun
722                     notrun="$notrun $seqnum"
723                     n_notrun=`expr $n_notrun + 1`
724                     tc_status="notrun"
725                 else
726                     if [ $sts -ne 0 ]
727                     then
728                         err_msg="[failed, exit status $sts]"
729                         echo -n " $err_msg"
730                         err=true
731                     fi
732                     if [ ! -f $seq.out ]
733                     then
734                         _dump_err "no qualified output"
735                         err=true
736                     else
737
738                         # coreutils 8.16+ changed quote formats in error messages from
739                         # `foo' to 'foo'. Filter old versions to match the new version.
740                         sed -i "s/\`/\'/g" $tmp.out
741                         if diff $seq.out $tmp.out >/dev/null 2>&1
742                         then
743                             if $err
744                             then
745                                 :
746                             else
747                                 echo "$seqnum `expr $stop - $start`" >>$tmp.time
748                                 echo -n " `expr $stop - $start`s"
749                             fi
750                             echo ""
751                         else
752                             echo " - output mismatch (see $seqres.out.bad)"
753                             mv $tmp.out $seqres.out.bad
754                             $diff $seq.out $seqres.out.bad | {
755                                 if test "$DIFF_LENGTH" -le 0; then
756                                         cat
757                                 else
758                                         head -n "$DIFF_LENGTH"
759                                         echo "..."
760                                         echo "(Run '$diff $seq.out $seqres.out.bad'" \
761                                                 " to see the entire diff)"
762                                 fi; } | \
763                                 sed -e 's/^\(.\)/    \1/'
764                             err_msg="output mismatch (see $diff $seq.out $seqres.out.bad)"
765                             err=true
766                         fi
767                     fi
768                     try="$try $seqnum"
769                     n_try=`expr $n_try + 1`
770                     _check_filesystems
771                     _check_dmesg || err=true
772                 fi
773
774             fi
775
776             # come here for each test, except when $showme is true
777             #
778             if $err
779             then
780                 bad="$bad $seqnum"
781                 n_bad=`expr $n_bad + 1`
782                 quick=false
783                 tc_status="fail"
784             fi
785             if $do_report; then
786                 _make_testcase_report "$tc_status"
787             fi
788             seq="after_$seqnum"
789         done
790         sect_stop=`_wallclock`
791         interrupt=false
792         _wrapup
793         interrupt=true
794         echo
795
796         _test_unmount 2> /dev/null
797         _scratch_unmount 2> /dev/null
798 done
799
800 interrupt=false
801 status=`expr $sum_bad`
802 exit