------------------------------------------------------------------------
r21855 | raeburn | 2009-01-30 23:39:34 -0500 (Fri, 30 Jan 2009) | 28 lines
Changed paths:
M /trunk/src/tests/dejagnu/krb-standalone/rcp.exp
M /trunk/src/tests/dejagnu/krb-standalone/rsh.exp
M /trunk/src/tests/dejagnu/krb-standalone/sample.exp
M /trunk/src/tests/dejagnu/t_inetd.c
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.
------------------------------------------------------------------------
ticket: 6355
version_fixed: 1.7
status: resolved
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-7@22006
dc483132-0cff-0310-8789-
dd5450dbe970
proc start_rsh_daemon { } {
global REALMNAME
- global KRSHD
+ global KRSHD T_INETD
global RCP
global tmppwd
global krshd_spawn_id
}
- # 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.
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.
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
set sserver_spawn_id $spawn_id
verbose "sserver_spawn (t_inetd) is $sserver_spawn_id" 1
- }
- # Give sserver some time to start
- sleep 2
+ expect {
+ -ex "Ready!" { }
+ eof { error "couldn't start t_inetd helper" }
+ }
+ }
return 1
}
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
exit(3);
}
+ printf("Ready!\n");
if ((acc = accept(sock, (struct sockaddr *)&f_inaddr,
&namelen)) == -1) {
com_err(progname, errno, "accepting");