$(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)
+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 } {
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)
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
$(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
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 } {
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) \