[gnutls-devel] [PATCH 2/8] guile: tests: Make sure no processes are left behind.

Ludovic Courtès ludo at gnu.org
Thu Feb 11 23:04:32 CET 2016


Before that, child processes would be left behind and become zombies.

* guile/tests/anonymous-auth.scm, guile/tests/openpgp-auth.scm,
guile/tests/session-record-port.scm, guile/tests/x509-auth.scm:
Add (waitpid pid) call on the server side.
---
 guile/tests/anonymous-auth.scm      | 3 ++-
 guile/tests/openpgp-auth.scm        | 3 ++-
 guile/tests/session-record-port.scm | 1 +
 guile/tests/x509-auth.scm           | 3 ++-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/guile/tests/anonymous-auth.scm b/guile/tests/anonymous-auth.scm
index d01884d..a12eeb5 100644
--- a/guile/tests/anonymous-auth.scm
+++ b/guile/tests/anonymous-auth.scm
@@ -71,7 +71,8 @@
          (let* ((buf (make-u8vector (u8vector-length %message)))
                 (amount (record-receive! server buf)))
            (bye server close-request/rdwr)
-           (and (= amount (u8vector-length %message))
+           (and (zero? (cdr (waitpid pid)))
+                (= amount (u8vector-length %message))
                 (equal? buf %message))))
 
        ;; client-side (child process)
diff --git a/guile/tests/openpgp-auth.scm b/guile/tests/openpgp-auth.scm
index 49b4817..8c732ce 100644
--- a/guile/tests/openpgp-auth.scm
+++ b/guile/tests/openpgp-auth.scm
@@ -81,7 +81,8 @@
          (let ((msg (read (session-record-port server)))
                (auth-type (session-authentication-type server)))
            (bye server close-request/rdwr)
-           (and (eq? auth-type credentials/certificate)
+           (and (zero? (cdr (waitpid pid)))
+                (eq? auth-type credentials/certificate)
                 (equal? msg %message))))
 
        ;; client-side (child process)
diff --git a/guile/tests/session-record-port.scm b/guile/tests/session-record-port.scm
index 8291880..0eafefa 100644
--- a/guile/tests/session-record-port.scm
+++ b/guile/tests/session-record-port.scm
@@ -100,6 +100,7 @@
            ;; Make sure we got everything right.
            (and (eq? (session-record-port server)
                      (session-record-port server))
+                (zero? (cdr (waitpid pid)))
                 (= amount (u8vector-length %message))
                 (equal? buf %message)
                 (eof-object?
diff --git a/guile/tests/x509-auth.scm b/guile/tests/x509-auth.scm
index 609251d..21f192f 100644
--- a/guile/tests/x509-auth.scm
+++ b/guile/tests/x509-auth.scm
@@ -87,7 +87,8 @@
          (let ((msg (read (session-record-port server)))
                (auth-type (session-authentication-type server)))
            (bye server close-request/rdwr)
-           (and (eq? auth-type credentials/certificate)
+           (and (zero? (cdr (waitpid pid)))
+                (eq? auth-type credentials/certificate)
                 (equal? msg %message))))
 
        ;; client-side (child process)
-- 
2.6.3




More information about the Gnutls-devel mailing list