svn rev #21754: trunk/src/ kadmin/passwd/unit-test/ kadmin/passwd/unit-test/config/ ...

raeburn@MIT.EDU raeburn at MIT.EDU
Thu Jan 15 19:33:04 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=21754
Commit By: raeburn
Log Message:
Use valgrind in more cases if VALGRIND is set.


Changed Files:
U   trunk/src/kadmin/passwd/unit-test/Makefile.in
U   trunk/src/kadmin/passwd/unit-test/config/unix.exp
U   trunk/src/lib/kadm5/unit-test/Makefile.in
U   trunk/src/lib/kadm5/unit-test/config/unix.exp
U   trunk/src/lib/rpc/unit-test/Makefile.in
Modified: trunk/src/kadmin/passwd/unit-test/Makefile.in
===================================================================
--- trunk/src/kadmin/passwd/unit-test/Makefile.in	2009-01-15 23:22:53 UTC (rev 21753)
+++ trunk/src/kadmin/passwd/unit-test/Makefile.in	2009-01-16 00:33:00 UTC (rev 21754)
@@ -16,10 +16,10 @@
 	$(ENV_SETUP) $(RUNTEST) --tool kpasswd KPASSWD=../kpasswd \
 		KINIT=$(BUILDTOP)/clients/kinit/kinit \
 		KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy \
-		PRIOCNTL_HACK=@PRIOCNTL_HACK@
+		PRIOCNTL_HACK=@PRIOCNTL_HACK@ VALGRIND="$(VALGRIND)"
 
 unit-test-setup::
-	$(ENV_SETUP) $(START_SERVERS)
+	$(ENV_SETUP) $(VALGRIND) $(START_SERVERS)
 
 unit-test-cleanup::
 	$(ENV_SETUP) $(STOP_SERVERS)

Modified: trunk/src/kadmin/passwd/unit-test/config/unix.exp
===================================================================
--- trunk/src/kadmin/passwd/unit-test/config/unix.exp	2009-01-15 23:22:53 UTC (rev 21753)
+++ trunk/src/kadmin/passwd/unit-test/config/unix.exp	2009-01-16 00:33:00 UTC (rev 21754)
@@ -1,3 +1,44 @@
+if { [string length $VALGRIND] } {
+    rename spawn valgrind_aux_spawn
+    proc spawn { args } {
+	global VALGRIND
+	upvar 1 spawn_id spawn_id
+	set newargs {}
+	set inflags 1
+	set eatnext 0
+	foreach arg $args {
+	    if { $arg == "-ignore" \
+		     || $arg == "-open" \
+		     || $arg == "-leaveopen" } {
+		lappend newargs $arg
+		set eatnext 1
+		continue
+	    }
+	    if [string match "-*" $arg] {
+		lappend newargs $arg
+		continue
+	    }
+	    if { $eatnext } {
+		set eatnext 0
+		lappend newargs $arg
+		continue
+	    }
+	    if { $inflags } {
+		set inflags 0
+		# Only run valgrind for local programs, not
+		# system ones.
+#&&![string match "/bin/sh" $arg] sh is used to start kadmind!
+		if [string match "/" [string index $arg 0]]&&![string match "/bin/ls" $arg]&&![regexp {/kshd$} $arg] {
+		    set newargs [concat $newargs $VALGRIND]
+		}
+	    }
+	    lappend newargs $arg
+	}
+	set pid [eval valgrind_aux_spawn $newargs]
+	return $pid
+    }
+}
+
 # Hack around Solaris 9 kernel race condition that causes last output
 # from a pty to get dropped.
 if { $PRIOCNTL_HACK } {

Modified: trunk/src/lib/kadm5/unit-test/Makefile.in
===================================================================
--- trunk/src/lib/kadm5/unit-test/Makefile.in	2009-01-15 23:22:53 UTC (rev 21753)
+++ trunk/src/lib/kadm5/unit-test/Makefile.in	2009-01-16 00:33:00 UTC (rev 21754)
@@ -87,28 +87,28 @@
 	unit-test-server-cleanup
 
 test-randkey:: randkey-test
-	$(ENV_SETUP) ./randkey-test
+	$(ENV_SETUP) $(VALGRIND) ./randkey-test
 
 test-handle-server:: server-handle-test
-	$(ENV_SETUP) ./server-handle-test
+	$(ENV_SETUP) $(VALGRIND) ./server-handle-test
 
 test-handle-client:: client-handle-test
-	$(ENV_SETUP) ./client-handle-test
+	$(ENV_SETUP) $(VALGRIND) ./client-handle-test
 
 test-noauth: init-test
-	$(ENV_SETUP) ./init-test
+	$(ENV_SETUP) $(VALGRIND) ./init-test
 
 test-destroy: destroy-test
-	$(ENV_SETUP) ./destroy-test
+	$(ENV_SETUP) $(VALGRIND) ./destroy-test
 
 unit-test-client-setup::
-	$(ENV_SETUP) $(START_SERVERS)
+	$(ENV_SETUP) $(VALGRIND) $(START_SERVERS)
 
 unit-test-client-cleanup::
 	$(ENV_SETUP) $(STOP_SERVERS)
 
 unit-test-server-setup::
-	$(ENV_SETUP) $(START_SERVERS_LOCAL)
+	$(ENV_SETUP) $(VALGRIND) $(START_SERVERS_LOCAL)
 
 unit-test-server-cleanup::
 	$(ENV_SETUP) $(STOP_SERVERS_LOCAL)
@@ -118,7 +118,8 @@
 		KINIT=$(BUILDTOP)/clients/kinit/kinit \
 		KDESTROY=$(BUILDTOP)/clients/kdestroy/kdestroy \
 		KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local \
-		PRIOCNTL_HACK=@PRIOCNTL_HACK@ $(RUNTESTFLAGS)
+		PRIOCNTL_HACK=@PRIOCNTL_HACK@ VALGRIND="$(VALGRIND)" \
+		$(RUNTESTFLAGS)
 	-mv api.log capi.log
 	-mv api.sum capi.sum
 
@@ -126,7 +127,8 @@
 	$(ENV_SETUP) $(RUNTEST) --tool api RPC=0 API=$(SRVTCL) \
 		LOCKTEST=./lock-test \
 		KADMIN_LOCAL=$(BUILDTOP)/kadmin/cli/kadmin.local \
-		PRIOCNTL_HACK=@PRIOCNTL_HACK@ $(RUNTESTFLAGS)
+		PRIOCNTL_HACK=@PRIOCNTL_HACK@ VALGRIND="$(VALGRIND)" \
+		$(RUNTESTFLAGS)
 	-mv api.log sapi.log
 	-mv api.sum sapi.sum
 

Modified: trunk/src/lib/kadm5/unit-test/config/unix.exp
===================================================================
--- trunk/src/lib/kadm5/unit-test/config/unix.exp	2009-01-15 23:22:53 UTC (rev 21753)
+++ trunk/src/lib/kadm5/unit-test/config/unix.exp	2009-01-16 00:33:00 UTC (rev 21754)
@@ -14,6 +14,47 @@
 	set wait_status_index 3
 }
 
+if { [string length $VALGRIND] } {
+    rename spawn valgrind_aux_spawn
+    proc spawn { args } {
+	global VALGRIND
+	upvar 1 spawn_id spawn_id
+	set newargs {}
+	set inflags 1
+	set eatnext 0
+	foreach arg $args {
+	    if { $arg == "-ignore" \
+		     || $arg == "-open" \
+		     || $arg == "-leaveopen" } {
+		lappend newargs $arg
+		set eatnext 1
+		continue
+	    }
+	    if [string match "-*" $arg] {
+		lappend newargs $arg
+		continue
+	    }
+	    if { $eatnext } {
+		set eatnext 0
+		lappend newargs $arg
+		continue
+	    }
+	    if { $inflags } {
+		set inflags 0
+		# Only run valgrind for local programs, not
+		# system ones.
+#&&![string match "/bin/sh" $arg] sh is used to start kadmind!
+		if [string match "/" [string index $arg 0]]&&![string match "/bin/ls" $arg]&&![regexp {/kshd$} $arg] {
+		    set newargs [concat $newargs $VALGRIND]
+		}
+	    }
+	    lappend newargs $arg
+	}
+	set pid [eval valgrind_aux_spawn $newargs]
+	return $pid
+    }
+}
+
 # Hack around Solaris 9 kernel race condition that causes last output
 # from a pty to get dropped.
 if { $PRIOCNTL_HACK } {

Modified: trunk/src/lib/rpc/unit-test/Makefile.in
===================================================================
--- trunk/src/lib/rpc/unit-test/Makefile.in	2009-01-15 23:22:53 UTC (rev 21753)
+++ trunk/src/lib/rpc/unit-test/Makefile.in	2009-01-16 00:33:00 UTC (rev 21754)
@@ -49,7 +49,7 @@
 PASS=@PASS@
 unit-test-body:
 	$(RM) krb5cc_rpc_test_*
-	$(ENV_SETUP) $(START_SERVERS)
+	$(ENV_SETUP) $(VALGRIND) $(START_SERVERS)
 	RPC_TEST_SRVTAB=/tmp/rpc_test_v5srvtab.$$$$ ; export RPC_TEST_SRVTAB ; \
 	trap "echo Failed, cleaning up... ; rm -f $$RPC_TEST_SRVTAB ; $(ENV_SETUP) $(STOP_SERVERS) ; trap '' 0 ; exit 1" 0 1 2 3 14 15 ; \
 	if $(ENV_SETUP) \




More information about the cvs-krb5 mailing list