svn rev #21855: trunk/src/tests/dejagnu/ krb-standalone/
raeburn@MIT.EDU
raeburn at MIT.EDU
Fri Jan 30 23:39:37 EST 2009
http://mv.ezproxy.com.ezproxyberklee.flo.org/fisheye/changelog/krb5/?cs=21855
Commit By: raeburn
Log Message:
ticket: 6355
subject: use t_inetd with a ready message and avoid waiting a lot in non-root tests
target_version: 1.7
tags: pullup
Change t_inetd to print a ready message when it has started listening
on the indicated port number.
Look for this message in sample.exp rather than waiting an arbitrary
(and usually excessive) 2s each time for the inetd-mode tests. Use
run_once to perform the standalone-mode test only once per test suite
invocation.
Change rsh and rcp tests to start the servers via t_inetd and avoid
excessive waiting at startup.
In some of my tests, this reduces the tests/dejagnu tests from taking
over 6 minutes to taking around 2 minutes.
(This does mean the server process will no longer have started up
before we launch the client, so it may be slower to respond, but it'll
still be faster than the 2s delay we used before even trying to
connect.)
We can probably eliminate the -D option code from krshd.c now.
The tests run as root (rlogin, telnet) still need updating.
Changed Files:
U trunk/src/tests/dejagnu/krb-standalone/rcp.exp
U trunk/src/tests/dejagnu/krb-standalone/rsh.exp
U trunk/src/tests/dejagnu/krb-standalone/sample.exp
U trunk/src/tests/dejagnu/t_inetd.c
Modified: trunk/src/tests/dejagnu/krb-standalone/rcp.exp
===================================================================
--- trunk/src/tests/dejagnu/krb-standalone/rcp.exp 2009-01-31 04:04:50 UTC (rev 21854)
+++ trunk/src/tests/dejagnu/krb-standalone/rcp.exp 2009-01-31 04:39:34 UTC (rev 21855)
@@ -36,7 +36,7 @@
proc start_rsh_daemon { } {
global REALMNAME
- global KRSHD
+ global KRSHD T_INETD
global RCP
global tmppwd
global krshd_spawn_id
@@ -49,21 +49,20 @@
}
- # The -D argument tells it to accept a single connection, so we
- # don't need to use inetd. The portbase+8 is the port to listen at.
- #
# The -L ENV_SET is for the I/S Athena brokeness in dot files where
# LD_LIBRARY_PATH will be overridden causing the "exec csh -c rcp ..."
# to fail as the .cshrc is read in. We do not use the -f option as
# a users shell might be sh...
# Later a proper fix would be to have kshd exec rcp directly
# shell indirection...
- spawn $KRSHD -k -c -D [expr 8 + $portbase] -P $tmppwd -S $tmppwd/srvtab -M $REALMNAME -L ENV_SET
+ spawn $T_INETD [expr 8 + $portbase] $KRSHD $KRSHD -k -c -P $tmppwd -S $tmppwd/srvtab -M $REALMNAME -L ENV_SET
set krshd_spawn_id $spawn_id
set krshd_pid [exp_pid]
- # Give the rsh daemon a few seconds to get set up.
- sleep 2
+ expect {
+ -ex "Ready!" { }
+ eof { error "couldn't start t_inetd helper" }
+ }
}
# A procedure to stop the rsh daemon.
Modified: trunk/src/tests/dejagnu/krb-standalone/rsh.exp
===================================================================
--- trunk/src/tests/dejagnu/krb-standalone/rsh.exp 2009-01-31 04:04:50 UTC (rev 21854)
+++ trunk/src/tests/dejagnu/krb-standalone/rsh.exp 2009-01-31 04:39:34 UTC (rev 21855)
@@ -35,20 +35,20 @@
proc start_rsh_daemon { option } {
global REALMNAME
- global KRSHD
+ global KRSHD T_INETD
global tmppwd
global krshd_spawn_id
global krshd_pid
global portbase
- # The -D argument tells it to accept a single connection, so we
- # don't need to use inetd. The portbase+8 is the port to listen at.
- spawn $KRSHD -k -c -D [expr 8 + $portbase] -S $tmppwd/srvtab -M $REALMNAME -A $option
+ spawn $T_INETD [expr 8 + $portbase] $KRSHD $KRSHD -k -c -S $tmppwd/srvtab -M $REALMNAME -A $option
set krshd_spawn_id $spawn_id
set krshd_pid [exp_pid]
- # Give the rsh daemon a few seconds to get set up.
- sleep 2
+ expect {
+ -ex "Ready!" { }
+ eof { error "couldn't start t_inetd helper" }
+ }
}
# A procedure to stop the rsh daemon.
Modified: trunk/src/tests/dejagnu/krb-standalone/sample.exp
===================================================================
--- trunk/src/tests/dejagnu/krb-standalone/sample.exp 2009-01-31 04:04:50 UTC (rev 21854)
+++ trunk/src/tests/dejagnu/krb-standalone/sample.exp 2009-01-31 04:39:34 UTC (rev 21855)
@@ -47,6 +47,9 @@
set sserver_spawn_id $spawn_id
verbose "sserver_spawn is $sserver_spawn_id" 1
+
+ # Give sserver some time to start
+ sleep 2
} else {
# Start the sserver
spawn $T_INETD [expr 8 + $portbase] $SSERVER sserver -S $tmppwd/srvtab
@@ -54,11 +57,13 @@
set sserver_spawn_id $spawn_id
verbose "sserver_spawn (t_inetd) is $sserver_spawn_id" 1
+
+ expect {
+ -ex "Ready!" { }
+ eof { error "couldn't start t_inetd helper" }
+ }
}
- # Give sserver some time to start
- sleep 2
-
return 1
}
@@ -171,17 +176,19 @@
return
}
- if ![start_sserver_daemon 0 ] {
- return
- }
+ run_once sample_standalone {
+ if ![start_sserver_daemon 0 ] {
+ return
+ }
- if ![test_sclient sclient] {
- return
- }
+ if ![test_sclient sclient] {
+ return
+ }
- pass "sample - standalone"
+ pass "sample - standalone"
- stop_check_sserver_daemon
+ stop_check_sserver_daemon
+ }
if ![start_sserver_daemon 1 ] {
return
Modified: trunk/src/tests/dejagnu/t_inetd.c
===================================================================
--- trunk/src/tests/dejagnu/t_inetd.c 2009-01-31 04:04:50 UTC (rev 21854)
+++ trunk/src/tests/dejagnu/t_inetd.c 2009-01-31 04:39:34 UTC (rev 21855)
@@ -110,6 +110,7 @@
exit(3);
}
+ printf("Ready!\n");
if ((acc = accept(sock, (struct sockaddr *)&f_inaddr,
&namelen)) == -1) {
com_err(progname, errno, "accepting");
More information about the cvs-krb5
mailing list