svn rev #23566: trunk/src/tests/dejagnu/config/

epeisach@MIT.EDU epeisach at MIT.EDU
Fri Jan 1 21:16:23 EST 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=23566
Commit By: epeisach
Log Message:
Test -P options to kdc and kadmind to write out a pid file. Verify contents of 
pid file match pid of executable.




Changed Files:
U   trunk/src/tests/dejagnu/config/default.exp
Modified: trunk/src/tests/dejagnu/config/default.exp
===================================================================
--- trunk/src/tests/dejagnu/config/default.exp	2010-01-01 23:20:56 UTC (rev 23565)
+++ trunk/src/tests/dejagnu/config/default.exp	2010-01-02 02:16:23 UTC (rev 23566)
@@ -1701,6 +1701,8 @@
     # 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 @@
 
     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 @@
     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 @@
     # 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 @@
     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"
     }




More information about the cvs-krb5 mailing list