From a7f0f623b8192620291b9e041073cef0e7185104 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 4 May 1996 02:20:51 +0000 Subject: [PATCH] work around process group problems; recognize certain failure modes (e.g., connection closed) better; work around gnu getopt problem git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7898 dc483132-0cff-0310-8789-dd5450dbe970 --- src/tests/dejagnu/krb-root/ChangeLog | 26 ++++++++++++++++++++++++ src/tests/dejagnu/krb-root/rlogin.exp | 21 ++++++++++++++++--- src/tests/dejagnu/krb-root/telnet.exp | 29 +++++++++++++++++++++------ 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/tests/dejagnu/krb-root/ChangeLog b/src/tests/dejagnu/krb-root/ChangeLog index f2c11997d..3f0d1db5c 100644 --- a/src/tests/dejagnu/krb-root/ChangeLog +++ b/src/tests/dejagnu/krb-root/ChangeLog @@ -1,3 +1,29 @@ +Fri Mar 29 01:34:47 1996 Marc Horowitz + + * telnet.exp (start_telnet_daemon) use sh -c around telnetd + invocation to avoid having the rlogin die when the first telnetd + exits. + (telnet_test) If telnet finishes (prints connection closed), but + doesnt exit by an expect timeout, then kill the telnet so the + tests can go on. + +Fri Mar 29 01:09:14 1996 Ken Raeburn + + * rlogin.exp (rlogin_test): Make connection-closed patterns the + same, so the correct matching will happen when that message is + really expected. + +Thu Mar 28 18:17:31 1996 Ken Raeburn + + * rlogin.exp (rlogin_test), telnet.exp (telnet_test): Handle + failures from closed connections. + + * telnet.exp (telnet_test): Move -- before hostname. + +Thu Mar 28 16:37:36 1996 Mark Eichin + + * telnet.exp (telnet_test): use -- to end the getopt arguments. + Tue Mar 19 10:03:01 1996 Ezra Peisach * telnet.exp: Put back in the encrypted telnet tests. diff --git a/src/tests/dejagnu/krb-root/rlogin.exp b/src/tests/dejagnu/krb-root/rlogin.exp index 49ab15f81..87263e8b6 100644 --- a/src/tests/dejagnu/krb-root/rlogin.exp +++ b/src/tests/dejagnu/krb-root/rlogin.exp @@ -54,8 +54,10 @@ proc start_rlogin_daemon { option } { # The -p argument tells it to accept a single connection, so we # don't need to use inetd. The 3543 is the port to listen at. # Note that tmppwd here is a shell variable, which is set in - # setup_root_shell, not a TCL variable. - send -i $rlogin_spawn_id "$KRLOGIND -k -c -D 3543 -S \$tmppwd/srvtab -M $REALMNAME -L $LOGINKRB5 $option &\r" + # setup_root_shell, not a TCL variable. The sh -c is to workaround + # the broken controlling tty handling in hpux, and shouldn't hurt + # anything else. + send -i $rlogin_spawn_id "sh -c \"$KRLOGIND -k -c -D 3543 -S \$tmppwd/srvtab -M $REALMNAME -L $LOGINKRB5 $option\" &\r" expect { -i $rlogin_spawn_id -re "$ROOT_PROMPT" { } @@ -147,6 +149,11 @@ proc rlogin_test { } { catch "expect_after" return } + "onnection closed." { + fail "$testname (connection closed)" + catch "expect_after" + return + } eof { fail "$testname (eof)" catch "expect_after" @@ -186,7 +193,7 @@ proc rlogin_test { } { expect -re "$SHELL_PROMPT" send "exit\r" expect { - "Connection closed.\r" { + "onnection closed." { pass $testname } } @@ -211,6 +218,11 @@ proc rlogin_test { } { catch "expect_after" return } + "onnection closed" { + fail "$testname (connection closed)" + catch "expect_after" + return + } eof { fail "$testname (eof)" catch "expect_after" @@ -263,6 +275,9 @@ proc rlogin_test { } { "Closed connection.\r" { pass $testname } + "onnection closed" { + pass $testname + } } expect_after diff --git a/src/tests/dejagnu/krb-root/telnet.exp b/src/tests/dejagnu/krb-root/telnet.exp index 9fbd9567e..fb62effaf 100644 --- a/src/tests/dejagnu/krb-root/telnet.exp +++ b/src/tests/dejagnu/krb-root/telnet.exp @@ -55,7 +55,7 @@ proc start_telnet_daemon { } { # we don't need to use inetd. The 3023 is the port to listen at. # Note that tmppwd here is a shell variable, which is set in # setup_root_shell, not a TCL variable. - send -i $rlogin_spawn_id "$TELNETD -debug -t \$tmppwd/srvtab -R $REALMNAME -L $LOGINKRB5 -X KERBEROS_V4 3023 &\r" + send -i $rlogin_spawn_id "sh -c \"$TELNETD -debug -t \$tmppwd/srvtab -R $REALMNAME -L \\\r$LOGINKRB5 -X KERBEROS_V4 3023\" &\r" expect { -i $rlogin_spawn_id -re "$ROOT_PROMPT" { } @@ -140,16 +140,17 @@ proc telnet_test { } { # Start up our telnet connection. We first try it without # authentication, so the daemon should prompt for a login. - spawn $TELNET $hostname -3023 + spawn $TELNET -- $hostname -3023 + set telnet_pid [exp_pid] expect_after { timeout { - fail $testname + fail "$testname (timeout)" catch "expect_after" return } eof { - fail $testname + fail "$testname (eof)" catch "expect_after" return } @@ -198,6 +199,17 @@ proc telnet_test { } { expect_after +# on hpux 10.x, the child telnet will hang in an ioctl(). This will +# wait a while for an EOF, and kill the process if it doesn't exit by +# itself. The hang doesn't happen when telnet is run at the shell. + + expect { + eof { } + timeout { + stop_telnet_daemon + } + } + if ![check_exit_status "exit status"] { return } @@ -210,7 +222,7 @@ proc telnet_test { } { # Try an authenticated connection. start_telnet_daemon - spawn $TELNET -a -k $REALMNAME $hostname -3023 + spawn $TELNET -a -k $REALMNAME -- $hostname -3023 expect_after { timeout { @@ -218,6 +230,11 @@ proc telnet_test { } { catch "expect_after" return } + "Connection closed by foreign host.\r" { + fail "$testname (connection closed)" + catch "expect_after" + return + } eof { fail "$testname (eof)" catch "expect_after" @@ -283,7 +300,7 @@ proc telnet_test { } { # Try an authenticated encrypted connection. start_telnet_daemon - spawn $TELNET -a -x -k $REALMNAME $hostname -3023 + spawn $TELNET -a -x -k $REALMNAME -- $hostname -3023 expect_after { timeout { -- 2.26.2