[netfilter-cvslog] r3321 - trunk/nfsim-testsuite

rusty at netfilter.org rusty at netfilter.org
Sat Dec 11 01:10:24 CET 2004


Author: rusty at netfilter.org
Date: 2004-12-11 01:10:24 +0100 (Sat, 11 Dec 2004)
New Revision: 3321

Added:
   trunk/nfsim-testsuite/expected-failures
Modified:
   trunk/nfsim-testsuite/test.sh
Log:
Add support for expected failures.


Added: trunk/nfsim-testsuite/expected-failures
===================================================================
--- trunk/nfsim-testsuite/expected-failures	2004-12-10 23:51:47 UTC (rev 3320)
+++ trunk/nfsim-testsuite/expected-failures	2004-12-11 00:10:24 UTC (rev 3321)
@@ -0,0 +1,5 @@
+2.6.10-rc3-bk3:01iptables/20ipt_MARK.sim
+2.6.10-rc3-bk3:03NAT/03ip_dnat.sim
+2.6.10-rc3-bk3:03NAT/05dnat_reply.sim
+2.6.10-rc3-bk3:03NAT/13ip_nat_fill.sim
+2.6.10-rc3-bk3:03NAT/17masq.sim

Modified: trunk/nfsim-testsuite/test.sh
===================================================================
--- trunk/nfsim-testsuite/test.sh	2004-12-10 23:51:47 UTC (rev 3320)
+++ trunk/nfsim-testsuite/test.sh	2004-12-11 00:10:24 UTC (rev 3321)
@@ -1,8 +1,6 @@
 #! /bin/sh
 # Shell script to run test suite.
 
-set -e
-
 NFSIM=nfsim
 NFSIM_ARGS="-q"
 
@@ -25,6 +23,7 @@
 done
 
 NFSIM_ARGS="$NFSIM_ARGS -e -a"
+KVERSION=`echo version kernel | $NFSIM -q`
 
 # Creates a temporary file and exports the name of the file to
 # the provided argument.  Exits on error.
@@ -54,11 +53,17 @@
 }
 export -f create_tempfile
 
+expected_failure()
+{
+    grep -q ${KVERSION}:$1 expected-failures
+}
+
 failed()
 {
     echo
     echo "Test for $1 failed." >&2
-    if [ -n "$KEEP_GOING" ]; then return 0; fi
+    if expected_failure $f; then return 0; fi
+    if [ -n "$KEEP_GOING" ]; then return 1; fi
     exit 1
 }
 
@@ -111,17 +116,41 @@
 	    *~)
 		continue;;
 	    *.sh)
-		sh -e $EXTRA_ARGS "$f" || failed "$f" || FAILED=1;;
+		sh -e $EXTRA_ARGS "$f"
+		;;
 	    *.sim)
-		$NFSIM $NFSIM_ARGS < "$f" || failed "$f" || FAILED=1;;
+		$NFSIM $NFSIM_ARGS < "$f"
+		;;
 	    *)
 		echo Unknown test type "$f" >&2
-		failed "$f" || FAILED=1;;
+		exit 1
 	esac
-	if [ -z "$VERBOSE" ]; then
-	    echo -n .
+	if [ $? -ne 0 ]; then
+	    if expected_failure $f; then 
+		if [ -z "$VERBOSE" ]; then
+		    echo -n x
+		else
+		    echo Test $f failed as expected.
+		fi
+	    else
+		echo Test $f failed >&2
+		if [ -z "$KEEP_GOING" ]; then exit 1; fi
+		FAILED=1
+	    fi
 	else
-	    echo Tests $f succeeded.
+	    if expected_failure $f; then
+		if [ -z "$VERBOSE" ]; then
+		    echo -n !
+		else
+		    echo Test $f unexpectedly succeeded!
+		fi
+	    else
+		if [ -z "$VERBOSE" ]; then
+		    echo -n .
+		else
+		    echo Test $f succeeded.
+		fi
+	    fi
 	fi
     done
     if [ -z "$VERBOSE" ]; then echo; fi




More information about the netfilter-cvslog mailing list