chiark / gitweb /
Testing: Move expect_before timeout to right place
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 29 Oct 2015 01:57:00 +0000 (01:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Nov 2015 21:08:39 +0000 (21:08 +0000)
Otherwise it relates to the default spawn id which is stdin.  The
effect is that (a) the timeout is for the whole script, not each
expect, and (b) when stdin is /dev/null Tcl gets EOF, closes it, and
then complains
  error writing "stdout": bad file number
(which is rather daft).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/autotest

index f2b2870665fcc91a70234744b76df552331ba6d2..60ef3ffce6357007db3af862c2a4affcd27fbdbb 100755 (executable)
@@ -31,9 +31,7 @@ proc timeout-abort {} {
      send_log "\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
      error "aborting due to timeout"
 }
-set timeout 15
-
-expect_after timeout timeout-abort
+set timeout 10
 
 proc elog {args} {
      set m "[list expect [lindex $args end]]"
@@ -57,6 +55,8 @@ proc dospawn {} {
      spawn -nottycopy \
      w3m -config /dev/null -o cgi_bin=$pwd/tests file:///cgi-bin/wrap/Tsuffix
 
+     expect_after timeout timeout-abort
+
      epage {You need to log in}
 }