From: Ken Raeburn Date: Fri, 16 Jan 2009 00:33:00 +0000 (+0000) Subject: Use valgrind in more cases if VALGRIND is set X-Git-Tag: krb5-1.7-alpha1~67 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7d3309ce9f5b00807280fcf75b940491f541d8ed;p=krb5.git Use valgrind in more cases if VALGRIND is set git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21754 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/kadmin/passwd/unit-test/Makefile.in b/src/kadmin/passwd/unit-test/Makefile.in index 969ee8207..37dfaca33 100644 --- a/src/kadmin/passwd/unit-test/Makefile.in +++ b/src/kadmin/passwd/unit-test/Makefile.in @@ -16,10 +16,10 @@ unit-test-body:: $(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) diff --git a/src/kadmin/passwd/unit-test/config/unix.exp b/src/kadmin/passwd/unit-test/config/unix.exp index bd8382e19..479d77243 100644 --- a/src/kadmin/passwd/unit-test/config/unix.exp +++ b/src/kadmin/passwd/unit-test/config/unix.exp @@ -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 } { diff --git a/src/lib/kadm5/unit-test/Makefile.in b/src/lib/kadm5/unit-test/Makefile.in index 8a3cad51c..f7f7fd85f 100644 --- a/src/lib/kadm5/unit-test/Makefile.in +++ b/src/lib/kadm5/unit-test/Makefile.in @@ -87,28 +87,28 @@ unit-test-server: unit-test-server-setup unit-test-server-body \ 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 @@ unit-test-client-body: site.exp test-noauth test-destroy test-handle-client 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 @@ unit-test-server-body: site.exp test-handle-server lock-test $(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 diff --git a/src/lib/kadm5/unit-test/config/unix.exp b/src/lib/kadm5/unit-test/config/unix.exp index a78515f91..3f3665547 100644 --- a/src/lib/kadm5/unit-test/config/unix.exp +++ b/src/lib/kadm5/unit-test/config/unix.exp @@ -14,6 +14,47 @@ if {[info exists exp_version_4]} { 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 } { diff --git a/src/lib/rpc/unit-test/Makefile.in b/src/lib/rpc/unit-test/Makefile.in index ee6f66e60..2b98dbba6 100644 --- a/src/lib/rpc/unit-test/Makefile.in +++ b/src/lib/rpc/unit-test/Makefile.in @@ -49,7 +49,7 @@ unit-test-ok:: unit-test-body 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) \