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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 4a9b332..5ecc12b 100755
--- a/check
+++ b/check
@@ -204,6 +204,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
@@ -612,6 +619,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] "
@@ -624,41 +638,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

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux