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

rusty at netfilter.org rusty at netfilter.org
Thu Dec 16 02:10:35 CET 2004


Author: rusty at netfilter.org
Date: 2004-12-16 02:10:34 +0100 (Thu, 16 Dec 2004)
New Revision: 3398

Modified:
   trunk/nfsim-testsuite/test-kernel-source
Log:
More precise gcov output (exact number of lines for testing small changes)
More intelligent caching (check for recent changes in nfsim source).
Generic parameter handling: every option passed to test.sh


Modified: trunk/nfsim-testsuite/test-kernel-source
===================================================================
--- trunk/nfsim-testsuite/test-kernel-source	2004-12-16 01:08:46 UTC (rev 3397)
+++ trunk/nfsim-testsuite/test-kernel-source	2004-12-16 01:10:34 UTC (rev 3398)
@@ -15,17 +15,29 @@
     cp simulator $2
 }
 
+# Simple check of cached nfsim: if any source file in nfsim newer, rebuild.
+recent()
+{
+    if [ -n "`find ../nfsim -path ../nfsim/netfilter -prune -o -name config.h -o -type f -name '*.[ch]' -newer $1 -print`" ]; then
+	rm $1
+	return 1
+    fi
+    return 0
+}
+
 usage()
 {
-    echo "Usage: $0 [-v|-vv] <kerneldir> [test]" >&2
+    echo "Usage: $0 <test.sh args> <kerneldir> [test]" >&2
     echo "Compiles up nfsim for the kernel version give, and runs the tests across it"  >&2
     exit 1
 }
 
-if [ x"$1" = x"-v" -o x"$1" = x"-vv" ]; then
-    EXTRA_ARGS=$1
-    shift
-fi
+while true; do
+    case "$1" in
+	-*) EXTRA_ARGS="$1 $EXTRA_ARGS"; shift;;
+	*) break;;
+    esac
+done
 
 if [ $# -gt 0 ] && [ -d "$1" ]; then
     KERNELDIR=$1
@@ -53,7 +65,7 @@
 find . -name '.nfsim*' -mtime +30 -exec rm {} \;
 
 NFSIM=$(pwd)/.nfsim-$(find $KERNELDIR/include/linux/netfilter_ipv4 $KERNELDIR/net/ipv4/netfilter -name '*.[ch]' -exec cat {} \; | md5sum | cut -c1-32)
-if [ -f $NFSIM ]; then
+if [ -f $NFSIM ] && recent $NFSIM; then
     echo Using cached nfsim...
     (cd ../nfsim && make --quiet gcov-clean)
 else
@@ -74,4 +86,6 @@
     echo Something wrong with GCOV analysis: T $TESTED_LINES  U $UNTESTED_LINES C $COMMENT_LINES TOTAL $TOTAL_LINES >&2
     exit 1
 fi
+
 echo GCOV coverage is $(($TESTED_LINES * 100 / ($TESTED_LINES + $UNTESTED_LINES)))%
+echo GCOV $TESTED_LINES of $(($TESTED_LINES + $UNTESTED_LINES))




More information about the netfilter-cvslog mailing list