xfstests: fix last test runtime output
authorDave Chinner <dchinner@redhat.com>
Wed, 1 May 2013 08:31:59 +0000 (08:31 +0000)
committerRich Johnston <rjohnston@sgi.com>
Fri, 3 May 2013 14:22:12 +0000 (09:22 -0500)
Prior to the test directory split-up, xfstests used to output the
time it previously took to run a specific test in it's output. This
was broken during the split up, as test identifiers changed and the
result output changed.

To fix this, the search for previous test results needs to look at
the sequence number rather than the absolute sequence for the test.
The new output looks the same as the old functionality:

generic/001 4s ... 5s
generic/002 1s ... 0s
generic/005 1s ... 1s
generic/006 1s ... 1s
generic/007 2s ... 1s

Where the first column is the time of the previous test run, and the
second column is the time that this run took.

Further, the check files used to generate this information are not
being output properly in the result directory, and so various log
files are not getting written to the correct location or file names.
For example, the calls to _check_test_fs would output failures to
".full", while other messages would be output to check.full, but
none would output to the corect location of RESULT_BASE/check.full.

Fix all this mess up so that all the check files for a specific run
end up in RESULT_BASE, and ensure the timing code checks the right
file and dumps output.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
check

diff --git a/check b/check
index 966fbe556b6a6225c38ee3c2619e54034a501000..a79747ecabad70d6016da415b31b7e30df018ca0 100755 (executable)
--- a/check
+++ b/check
@@ -293,14 +293,17 @@ fi
 
 _wrapup()
 {
+    seq="check"
+    check="$RESULT_BASE/check"
+
     if $showme
     then
        :
     elif $needwrap
     then
-       if [ -f check.time -a -f $tmp.time ]
+       if [ -f $check.time -a -f $tmp.time ]
        then
-           cat check.time $tmp.time \
+           cat $check.time $tmp.time \
            | $AWK_PROG '
        { t[$1] = $2 }
 END    { if (NR > 0) {
@@ -308,13 +311,13 @@ END       { if (NR > 0) {
          }
        }' \
            | sort -n >$tmp.out
-           mv $tmp.out check.time
+           mv $tmp.out $check.time
        fi
 
-       echo "" >>check.log
-       date >>check.log
-       echo $list | fmt | sed -e 's/^/    /' -e "s;$SRC_DIR/;;g" >>check.log
-       $interrupt && echo "Interrupted!" >>check.log
+       echo "" >>$check.log
+       date >>$check.log
+       echo $list | fmt | sed -e 's/^/    /' -e "s;$SRC_DIR/;;g" >>$check.log
+       $interrupt && echo "Interrupted!" >>$check.log
         
         if [ ! -z "$n_try" -a $n_try != 0 ]
        then
@@ -324,18 +327,18 @@ END       { if (NR > 0) {
        if [ ! -z "$notrun" ]
        then
            echo "Not run:$notrun"
-           echo "Not run:$notrun" >>check.log
+           echo "Not run:$notrun" >>$check.log
        fi
 
         if [ ! -z "$n_bad" -a $n_bad != 0 ]
        then
            echo "Failures:$bad"
            echo "Failed $n_bad of $n_try tests"
-           echo "Failures:$bad" | fmt >>check.log
-           echo "Failed $n_bad of $n_try tests" >>check.log
+           echo "Failures:$bad" | fmt >>$check.log
+           echo "Failed $n_bad of $n_try tests" >>$check.log
        else
            echo "Passed all $n_try tests"
-           echo "Passed all $n_try tests" >>check.log
+           echo "Passed all $n_try tests" >>$check.log
        fi
        needwrap=false
     fi
@@ -346,10 +349,19 @@ 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
+rm -f $check.full
 
-[ -f check.time ] || touch check.time
+[ -f $check.time ] || touch $check.time
 
 # print out our test configuration
 echo "FSTYP         -- `_full_fstyp_details`"
@@ -385,13 +397,7 @@ if [ ! -z "$SCRATCH_DEV" ]; then
   fi
 fi
 
-mkdir -p $RESULT_BASE
-if [ ! -d $RESULT_BASE ]; then
-       echo "failed to create results directory $RESULTS_BASE"
-       exit 1;
-fi
-
-seq="check"
+seqres="$check"
 _check_test_fs
 
 for seq in $list
@@ -432,7 +438,7 @@ do
        fi
 
        # slashes now in names, sed barfs on them so use grep
-       lasttime=`grep -w ^$seq check.time | awk '// {print $2}'`
+       lasttime=`grep -w ^$seqnum $check.time | awk '// {print $2}'`
        if [ "X$lasttime" != X ]; then
                echo -n " ${lasttime}s ..."
        else