svn rev #22006: branches/krb5-1-7/src/tests/dejagnu/ krb-standalone/

tlyu@MIT.EDU tlyu at MIT.EDU
Tue Feb 17 11:10:12 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22006
Commit By: tlyu
Log Message:
ticket: 6355
version_fixed: 1.7
status: resolved

pull up r21855 from trunk

 ------------------------------------------------------------------------
 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.

 ------------------------------------------------------------------------


Changed Files:
U   branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rcp.exp
U   branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rsh.exp
U   branches/krb5-1-7/src/tests/dejagnu/krb-standalone/sample.exp
U   branches/krb5-1-7/src/tests/dejagnu/t_inetd.c
Modified: branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rcp.exp
===================================================================
--- branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rcp.exp	2009-02-13 22:23:24 UTC (rev 22005)
+++ branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rcp.exp	2009-02-17 16:10:11 UTC (rev 22006)
@@ -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: branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rsh.exp
===================================================================
--- branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rsh.exp	2009-02-13 22:23:24 UTC (rev 22005)
+++ branches/krb5-1-7/src/tests/dejagnu/krb-standalone/rsh.exp	2009-02-17 16:10:11 UTC (rev 22006)
@@ -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: branches/krb5-1-7/src/tests/dejagnu/krb-standalone/sample.exp
===================================================================
--- branches/krb5-1-7/src/tests/dejagnu/krb-standalone/sample.exp	2009-02-13 22:23:24 UTC (rev 22005)
+++ branches/krb5-1-7/src/tests/dejagnu/krb-standalone/sample.exp	2009-02-17 16:10:11 UTC (rev 22006)
@@ -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: branches/krb5-1-7/src/tests/dejagnu/t_inetd.c
===================================================================
--- branches/krb5-1-7/src/tests/dejagnu/t_inetd.c	2009-02-13 22:23:24 UTC (rev 22005)
+++ branches/krb5-1-7/src/tests/dejagnu/t_inetd.c	2009-02-17 16:10:11 UTC (rev 22006)
@@ -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