guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/02: tests: Don't use a guardian when testing for GC'd


From: Ludovic Courtès
Subject: [Guile-commits] 01/02: tests: Don't use a guardian when testing for GC'd ports.
Date: Tue, 12 May 2020 09:01:39 -0400 (EDT)

civodul pushed a commit to branch master
in repository guile.

commit 2ba61b8aea95f8dfc11443c7f964886887bc5117
Author: Ludovic Courtès <address@hidden>
AuthorDate: Tue May 12 14:44:53 2020 +0200

    tests: Don't use a guardian when testing for GC'd ports.
    
    This is a followup to 1008ea315483d1fb41b2a8c10680e511238836d0.
    
    * test-suite/tests/ports.test ("non-revealed port is closed"): Don't use
    a guardian.
---
 test-suite/tests/ports.test | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index 0ade4d4..d2b3b0f 100644
--- a/test-suite/tests/ports.test
+++ b/test-suite/tests/ports.test
@@ -616,19 +616,16 @@
 
 (pass-if "revealed port fdes not closed"
   (let* ((port (open-file "/dev/null" "r0"))
-         (fdes (port->fdes port))     ;increments revealed count of PORT
-         (guardian (make-guardian)))
-    (guardian port)
+         (fdes (port->fdes port)))
     (set! port #f)
     (gc)
-    (if (port? (guardian))
-        (and (zero? (seek fdes 0 SEEK_CUR))
-             (begin
-               (close-fdes fdes)
-               #t))
-        (begin
-          (close-fdes fdes)
-          (throw 'unresolved)))))
+
+    ;; Note: We can't know for sure whether PORT was GC'd; using a
+    ;; guardian is not an option because it would keep it alive.
+    (and (zero? (seek fdes 0 SEEK_CUR))
+         (begin
+           (close-fdes fdes)
+           #t))))
 
 (when (provided? 'threads)
   (let* ((p (pipe))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]