xfs
[Top] [All Lists]

[XFSTESTS v4 2/4] check: Add support for tests without *.out files

To: xfs@xxxxxxxxxxx
Subject: [XFSTESTS v4 2/4] check: Add support for tests without *.out files
From: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Date: Wed, 9 Mar 2016 13:06:36 +0100
Cc: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1457525199-15355-1-git-send-email-agruenba@xxxxxxxxxx>
References: <1457525199-15355-1-git-send-email-agruenba@xxxxxxxxxx>
Add support for tests which report their status through their exit code
instead of producing output that is compared with the expected output.

When such a test returns with exit code 77, it is assumed to have been
skipped; all other non-zero exit codes are treated as test failures.

Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
---
 check | 77 +++++++++++++++++++++++++++++++++++++++++++------------------------
 1 file changed, 50 insertions(+), 27 deletions(-)

diff --git a/check b/check
index 2986d84..1327e1c 100755
--- a/check
+++ b/check
@@ -203,6 +203,13 @@ _prepare_test_list()
        fi
 }
 
+# Check if a test has any .out* files
+has_out_files()
+{
+    set -- "$1".out*
+    [ $# -gt 0 -a -e "$1" ]
+}
+
 # Process command arguments first.
 while [ $# -gt 0 ]; do
        case "$1" in
@@ -635,6 +642,13 @@ for section in $HOST_OPTIONS_SECTIONS; do
                    err=true
                fi
 
+               if ! has_out_files $seq; then
+                   if [ $sts -eq 77 ]; then
+                       cat $tmp.out > $seqres.notrun
+                       sts=0
+                   fi
+               fi
+
                if [ -f $seqres.notrun ]
                then
                    $timestamp || echo -n " [not run] "
@@ -647,41 +661,50 @@ for section in $HOST_OPTIONS_SECTIONS; do
                        echo -n " [failed, exit status $sts]"
                        err=true
                    fi
-                   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
+                   if has_out_files $seq; then
+                       if [ ! -f $seq.out ]
                        then
-                           if $err
+                           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
-                               :
-                           else
-                               echo "$seqnum `expr $stop - $start`" >>$tmp.time
-                               echo -n " `expr $stop - $start`s"
+                               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
-                           echo ""
+                       fi
+                   else
+                       if ! $err; then
+                           mv $tmp.out $seqres.out.good
                        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
-                               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 (see $seqres.out.bad)"
+                           cat $seqres.out.bad
                        fi
                    fi
+
+                   if ! $err; then
+                       echo "$seqnum `expr $stop - $start`" >>$tmp.time
+                       echo -n " `expr $stop - $start`s"
+                       echo ""
+                   fi
+
                    try="$try $seqnum"
                    n_try=`expr $n_try + 1`
                    _check_filesystems
-- 
2.5.0

<Prev in Thread] Current Thread [Next in Thread>