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