From: Ezra Peisach Date: Sat, 2 Jan 2010 02:16:23 +0000 (+0000) Subject: Test -P options to kdc and kadmind to write out a pid file. Verify contents of X-Git-Tag: krb5-1.8-alpha1~24 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=21dec6f9e14fae409953cde36a7d81eded4868bf;p=krb5.git Test -P options to kdc and kadmind to write out a pid file. Verify contents of pid file match pid of executable. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23566 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/tests/dejagnu/config/default.exp b/src/tests/dejagnu/config/default.exp index d7c41fe3d..23c60e34a 100644 --- a/src/tests/dejagnu/config/default.exp +++ b/src/tests/dejagnu/config/default.exp @@ -1701,6 +1701,8 @@ proc start_kerberos_daemons { standalone } { # The same thing is done a little later for the kadmind set kdc_lfile $tmppwd/kdc.log set kadmind_lfile $tmppwd/kadmind5.log + set kdc_pidfile $tmppwd/kdc.pid + set kadmind_pidfile $tmppwd/kadmind.pid if ![start_tail $kdc_lfile tailf_spawn_id tailf_pid krb5kdc $standalone] { return 0 @@ -1708,7 +1710,9 @@ proc start_kerberos_daemons { standalone } { envstack_push setup_kerberos_env kdc - spawn $KRB5KDC -r $REALMNAME -n full + # Nuke pid file - to test if setup + file delete $kdc_pidfile + spawn $KRB5KDC -r $REALMNAME -n full -P $kdc_pidfile envstack_pop set kdc_pid [exp_pid] set kdc_spawn_id $spawn_id @@ -1751,6 +1755,20 @@ proc start_kerberos_daemons { standalone } { expect -i $tailf_spawn_id eof wait -i $tailf_spawn_id + if (![file exists $kdc_pidfile]) { + fail "krb5kdc pidfile" + stop_kerberos_daemons + return 0 + } + set f [open $kdc_pidfile "r"] + if {[gets $f foundpid] < 0 || ![string equal $kdc_pid $foundpid]} { + fail "krb5kdc pid file contents" + close $f + stop_kerberos_daemons + return 0 + } + close $f + if {$standalone} { pass "krb5kdc" } @@ -1777,7 +1795,8 @@ proc start_kerberos_daemons { standalone } { # removed when this is fixed envstack_push setup_kerberos_env kdc - spawn $BINSH -c "exec $KADMIND -r $REALMNAME -W -nofork 2>>$kadmind_lfile" + file delete $kadmind_pidfile + spawn $BINSH -c "exec $KADMIND -r $REALMNAME -W -nofork -P $kadmind_pidfile 2>>$kadmind_lfile" envstack_pop set kadmind_pid [exp_pid] set kadmind_spawn_id $spawn_id @@ -1842,6 +1861,20 @@ proc start_kerberos_daemons { standalone } { expect -i $tailf_spawn_id eof wait -i $tailf_spawn_id + if (![file exists $kadmind_pidfile]) { + fail "kadmind pidfile" + stop_kerberos_daemons + return 0 + } + set f [open $kadmind_pidfile "r"] + if {[gets $f foundpid] < 0 || ![string equal $kadmind_pid $foundpid]} { + fail "kadmind pid file contents" + close $f + stop_kerberos_daemons + return 0 + } + close $f + if {$standalone} { pass "kadmind" }