[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] signal-tests can hang when port is already in
From: |
Felix |
Subject: |
[Chicken-hackers] [PATCH] signal-tests can hang when port is already in use |
Date: |
Mon, 27 Aug 2012 21:52:49 +0200 (CEST) |
The attached patch fixes a problem that caused the tests to hang in
the salmonella runs. The signal-test forks a child process that waits
for a tcp message before it terminates. If the port is in use and the
"tcp-listen" operation fails, the error will be shown but not
terminate the program (it is raised in a thread) and so the child
process will hang indefinitely. The TCP-operations have been removed
and the child is simply terminated via SIGTERM.
Fixes #907.
cheers,
felix
>From 947c8dc37b6c273749dc31f35a3c48be1075ddc8 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Mon, 27 Aug 2012 21:49:54 +0200
Subject: [PATCH] in signal-tests terminate child process by signal instead of
tcp-message because the test will never finish if the tcp-listen operation
fails, for example, when the port is already in use
---
tests/signal-tests.scm | 20 ++------------------
1 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/tests/signal-tests.scm b/tests/signal-tests.scm
index 6f00440..b9e5f41 100644
--- a/tests/signal-tests.scm
+++ b/tests/signal-tests.scm
@@ -7,10 +7,7 @@
(exit))
-;;XXX not tested yet
-
-
-(use posix srfi-18 extras tcp)
+(use posix srfi-18 extras)
(define received1 0)
@@ -36,14 +33,6 @@
(define (child)
(print "child started")
- (thread-start!
- (lambda ()
- (let-values (((i o) (tcp-accept (tcp-listen 9999))))
- (tick #\!)
- (assert (string=? "ok." (read-line i)))
- (print "client connected.")
- (close-input-port i)
- (close-output-port o))))
(thread-start!
(lambda ()
(do () (#f)
@@ -76,10 +65,5 @@
(set! sent2 (add1 sent2))
(process-signal pid signal/usr2)))))
(printf "~%signals sent: ~a USR1, ~a USR2~%" sent1 sent2)
- (print "connecting ...")
- (let-values (((i o) (tcp-connect "localhost" 9999)))
- (display "ok.\n" o)
- (close-input-port i)
- (close-output-port o)
- (sleep 1))
+ (print "terminating child process ...")
(process-signal pid))
--
1.7.0.4
- [Chicken-hackers] [PATCH] signal-tests can hang when port is already in use,
Felix <=