From bf4445942d2baf2e7ab1767fb9c86794374f2b46 Mon Sep 17 00:00:00 2001 From: Lukas Czerner Date: Fri, 4 Apr 2014 17:17:53 +1100 Subject: [PATCH] check: Prepare for config section This patch only adds the indentation in place so we will be able to clearly see and review changes made in the second patch which will add a loop (instead of always-true condition introduced in this patch) adding support for config sections. There are no changes in the logic, only indentation changes. Signed-off-by: Lukas Czerner Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- check | 322 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 162 insertions(+), 160 deletions(-) diff --git a/check b/check index b619f6db..b33643c9 100755 --- a/check +++ b/check @@ -356,190 +356,192 @@ END { if (NR > 0) { trap "_wrapup; exit \$status" 0 1 2 3 15 -mkdir -p $RESULT_BASE -if [ ! -d $RESULT_BASE ]; then - echo "failed to create results directory $RESULTS_BASE" - exit 1; -fi - -seq="check" -check="$RESULT_BASE/check" - -# don't leave old full output behind on a clean run -rm -f $check.full - -[ -f $check.time ] || touch $check.time - -# print out our test configuration -echo "FSTYP -- `_full_fstyp_details`" -echo "PLATFORM -- `_full_platform_details`" -if [ ! -z "$SCRATCH_DEV" ]; then - echo "MKFS_OPTIONS -- `_scratch_mkfs_options`" - echo "MOUNT_OPTIONS -- `_scratch_mount_options`" -fi -echo - - -if [ ! -z "$SCRATCH_DEV" ]; then - umount $SCRATCH_DEV 2>/dev/null - # call the overridden mkfs - make sure the FS is built - # the same as we'll create it later. - - if ! _scratch_mkfs $flag >$tmp.err 2>&1 - then - echo "our local _scratch_mkfs routine ..." - cat $tmp.err - echo "check: failed to mkfs \$SCRATCH_DEV using specified options" - exit 1 - fi - - # call the overridden mount - make sure the FS mounts with - # the same options that we'll mount with later. - if ! _scratch_mount >$tmp.err 2>&1 - then - echo "our local mount routine ..." - cat $tmp.err - echo "check: failed to mount \$SCRATCH_DEV using specified options" - exit 1 - fi -fi +if true; then + mkdir -p $RESULT_BASE + if [ ! -d $RESULT_BASE ]; then + echo "failed to create results directory $RESULTS_BASE" + exit 1; + fi -seqres="$check" -_check_test_fs + seq="check" + check="$RESULT_BASE/check" -for seq in $list -do - err=false + # don't leave old full output behind on a clean run + rm -f $check.full - # the filename for the test and the name output are different. - # we don't include the tests/ directory in the name output. - seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"` + [ -f $check.time ] || touch $check.time - # Similarly, the result directory needs to replace the tests/ - # part of the test location. - group=`dirname $seq` - export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"` - mkdir -p $RESULT_DIR - seqres="$RESULT_BASE/$seqnum" + # print out our test configuration + echo "FSTYP -- `_full_fstyp_details`" + echo "PLATFORM -- `_full_platform_details`" + if [ ! -z "$SCRATCH_DEV" ]; then + echo "MKFS_OPTIONS -- `_scratch_mkfs_options`" + echo "MOUNT_OPTIONS -- `_scratch_mount_options`" + fi + echo - echo -n "$seqnum" - if $showme - then - echo - continue - elif [ ! -f $seq ] - then - echo " - no such test?" - else - # really going to try and run this one - # - rm -f $seqres.out.bad - - # check if we really should run it - if [ -s $tmp.xlist ]; then - if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then - echo " [expunged]" - continue - fi + if [ ! -z "$SCRATCH_DEV" ]; then + umount $SCRATCH_DEV 2>/dev/null + # call the overridden mkfs - make sure the FS is built + # the same as we'll create it later. + + if ! _scratch_mkfs $flag >$tmp.err 2>&1 + then + echo "our local _scratch_mkfs routine ..." + cat $tmp.err + echo "check: failed to mkfs \$SCRATCH_DEV using specified options" + exit 1 + fi + + # call the overridden mount - make sure the FS mounts with + # the same options that we'll mount with later. + if ! _scratch_mount >$tmp.err 2>&1 + then + echo "our local mount routine ..." + cat $tmp.err + echo "check: failed to mount \$SCRATCH_DEV using specified options" + exit 1 + fi fi - # slashes now in names, sed barfs on them so use grep - lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'` - if [ "X$lasttime" != X ]; then - echo -n " ${lasttime}s ..." - else - echo -n " " # prettier output with timestamps. - fi - rm -f core $seqres.notrun + seqres="$check" + _check_test_fs - start=`_wallclock` - $timestamp && echo -n " ["`date "+%T"`"]" - [ ! -x $seq ] && chmod u+x $seq # ensure we can run it - $LOGGER_PROG "run xfstest $seqnum" - ./$seq >$tmp.rawout 2>&1 - sts=$? - $timestamp && _timestamp - stop=`_wallclock` + for seq in $list + do + err=false - _fix_malloc <$tmp.rawout >$tmp.out - rm -f $tmp.rawout + # the filename for the test and the name output are different. + # we don't include the tests/ directory in the name output. + seqnum=`echo $seq | sed -e "s;$SRC_DIR/;;"` - if [ -f core ] - then - echo -n " [dumped core]" - mv core $RESULT_BASE/$seqnum.core - err=true - fi + # Similarly, the result directory needs to replace the tests/ + # part of the test location. + group=`dirname $seq` + export RESULT_DIR=`echo $group | sed -e "s;$SRC_DIR;$RESULT_BASE;"` + mkdir -p $RESULT_DIR + seqres="$RESULT_BASE/$seqnum" - if [ -f $seqres.notrun ] - then - $timestamp || echo -n " [not run] " - $timestamp && echo " [not run]" && echo -n " $seqnum -- " - cat $seqres.notrun - notrun="$notrun $seqnum" - else - if [ $sts -ne 0 ] + echo -n "$seqnum" + + if $showme then - echo -n " [failed, exit status $sts]" - err=true - fi - if [ ! -f $seq.out ] + echo + continue + elif [ ! -f $seq ] then - echo " - no qualified output" - err=true + echo " - no such test?" else + # really going to try and run this one + # + rm -f $seqres.out.bad + + # check if we really should run it + if [ -s $tmp.xlist ]; then + if grep $seqnum $tmp.xlist > /dev/null 2>&1 ; then + echo " [expunged]" + continue + fi + fi + + # slashes now in names, sed barfs on them so use grep + lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'` + if [ "X$lasttime" != X ]; then + echo -n " ${lasttime}s ..." + else + echo -n " " # prettier output with timestamps. + fi + rm -f core $seqres.notrun + + start=`_wallclock` + $timestamp && echo -n " ["`date "+%T"`"]" + [ ! -x $seq ] && chmod u+x $seq # ensure we can run it + $LOGGER_PROG "run xfstest $seqnum" + ./$seq >$tmp.rawout 2>&1 + sts=$? + $timestamp && _timestamp + stop=`_wallclock` - # coreutils 8.16+ changed quote formats in error messages from - # `foo' to 'foo'. Filter old versions to match the new version. - sed -i "s/\`/\'/g" $tmp.out - if diff $seq.out $tmp.out >/dev/null 2>&1 + _fix_malloc <$tmp.rawout >$tmp.out + rm -f $tmp.rawout + + if [ -f core ] + then + echo -n " [dumped core]" + mv core $RESULT_BASE/$seqnum.core + err=true + fi + + if [ -f $seqres.notrun ] then - if $err + $timestamp || echo -n " [not run] " + $timestamp && echo " [not run]" && echo -n " $seqnum -- " + cat $seqres.notrun + notrun="$notrun $seqnum" + else + if [ $sts -ne 0 ] then - : - else - echo "$seqnum `expr $stop - $start`" >>$tmp.time - echo -n " `expr $stop - $start`s" + echo -n " [failed, exit status $sts]" + err=true fi - echo "" - else - echo " - output mismatch (see $seqres.out.bad)" - mv $tmp.out $seqres.out.bad - $diff $seq.out $seqres.out.bad | { - if test "$DIFF_LENGTH" -le 0; then - cat + if [ ! -f $seq.out ] + then + echo " - no qualified output" + err=true + else + + # coreutils 8.16+ changed quote formats in error messages from + # `foo' to 'foo'. Filter old versions to match the new version. + sed -i "s/\`/\'/g" $tmp.out + if diff $seq.out $tmp.out >/dev/null 2>&1 + then + if $err + then + : + else + echo "$seqnum `expr $stop - $start`" >>$tmp.time + echo -n " `expr $stop - $start`s" + fi + echo "" else - head -n "$DIFF_LENGTH" - echo "..." - echo "(Run '$diff $seq.out $seqres.out.bad'" \ - " to see the entire diff)" - fi; } | \ - sed -e 's/^\(.\)/ \1/' - err=true + echo " - output mismatch (see $seqres.out.bad)" + mv $tmp.out $seqres.out.bad + $diff $seq.out $seqres.out.bad | { + if test "$DIFF_LENGTH" -le 0; then + cat + else + head -n "$DIFF_LENGTH" + echo "..." + echo "(Run '$diff $seq.out $seqres.out.bad'" \ + " to see the entire diff)" + fi; } | \ + sed -e 's/^\(.\)/ \1/' + err=true + fi + fi fi - fi - fi - fi + fi - # come here for each test, except when $showme is true - # - if $err - then - bad="$bad $seqnum" - n_bad=`expr $n_bad + 1` - quick=false - fi - if [ ! -f $seqres.notrun ] - then - try="$try $seqnum" - n_try=`expr $n_try + 1` - _check_test_fs - fi + # come here for each test, except when $showme is true + # + if $err + then + bad="$bad $seqnum" + n_bad=`expr $n_bad + 1` + quick=false + fi + if [ ! -f $seqres.notrun ] + then + try="$try $seqnum" + n_try=`expr $n_try + 1` + _check_test_fs + fi - seq="after_$seqnum" -done + seq="after_$seqnum" + done +fi interrupt=false status=`expr $n_bad` -- 2.30.2