1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00

tests: Avoid race condition in REPL server test.

Fixes <http://bugs.gnu.org/24769>.
Reported by Rob Browning <rlb@defaultvalue.org>.

* test-suite/tests/00-repl-server.test ("simple expression"): Add call
to 'select' before 'display'.
This commit is contained in:
Ludovic Courtès 2016-11-04 22:45:51 +01:00
parent 8d6209ea56
commit 2fbde7f02a

View file

@ -105,8 +105,14 @@ reached."
"scheme@(repl-server)> $1 = 42\n"
(with-repl-server socket
(read-until-prompt socket %last-line-before-prompt)
(display "(+ 40 2)\n(quit)\n" socket)
(read-string socket)))
;; Wait until 'repl-reader' in boot-9 has written the prompt.
;; Otherwise, if we write too quickly, 'repl-reader' checks for
;; 'char-ready?' and doesn't print the prompt.
(match (select (list socket) '() (list socket) 3)
(((_) () ())
(display "(+ 40 2)\n(quit)\n" socket)
(read-string socket)))))
(pass-if "HTTP inter-protocol attack" ;CVE-2016-8606
(with-repl-server socket