gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet-scheme] 203/324: tests/mq-stream: Make tests less fragile.


From: gnunet
Subject: [gnunet-scheme] 203/324: tests/mq-stream: Make tests less fragile.
Date: Tue, 21 Sep 2021 13:24:03 +0200

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit 38b38a8c1be27bc97cd54d3612c1cedf6ddf4198
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat Aug 28 12:07:52 2021 +0200

    tests/mq-stream: Make tests less fragile.
    
    With ‘fragility’ I mean ‘tests sometimes succeeding when they should
    fail’ here.
    
    * tests/mq-stream.scm
      ("input eof detected --> handle-input/output! stops 
(port->message-queue)")
      ("closed for writing --> handle-input! stops (port->message-queue)")
      ("closed for writing --> handle-input! stops (port->message-queue)")
      ("writer blocking and closed for reading --> all fibers stop"):
      Use 'call-with-spawner/wait', #:parallelism 1, and don't bother with
      #:drain?.
---
 tests/mq-stream.scm | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tests/mq-stream.scm b/tests/mq-stream.scm
index ce53f2e..ff64e17 100644
--- a/tests/mq-stream.scm
+++ b/tests/mq-stream.scm
@@ -490,7 +490,7 @@
   (values (car sp) (cdr sp)))
 
 (test-assert "input eof detected --> handle-input/output! stops 
(port->message-queue)"
-  (call-with-spawner
+  (call-with-spawner/wait
    (lambda (spawn)
      (define-values (alpha beta) (two-sockets))
      (define end-of-file (make-condition))
@@ -524,14 +524,11 @@
      ;; If it didn't try to sent the message, that presumably means the
      ;; 'handle-output!' fiber has completed.
      #t)
-   ;; Wait until all runnable fibers complete
-   ;; -- TODO this does not seem to include blocking handle-input/output!.
-   #:drain? #t
-   ;; drain? is broken when parallelism is enabled, see <???>.
+   ;; Should make 'yield-many' less fragile.
    #:parallelism 1))
 
 (test-assert "closed for writing --> handle-input! stops (port->message-queue)"
-  (call-with-spawner
+  (call-with-spawner/wait
    (lambda (spawn)
      (define-values (alpha beta) (two-sockets))
      (define received? (make-atomic-box #f))
@@ -574,7 +571,7 @@
      (yield-many)
      (sleep 0.1) ; might not be necessary anymore
      #t)
-   #:drain? #t
+   ;; Should make 'yield-many' less fragile.
    #:parallelism 1))
 
 ;; This detects the absence of the parametrisation of 'current-write-waiter'.
@@ -618,7 +615,9 @@
      (yield-many)
      (sleep 0.1)
      (shutdown alpha 0)
-     #t)))
+     #t)
+   ;; Should make 'yield-many' less fragile.
+   #:parallelism 1))
 ;; ^ if this test blocks, that means not all fibers have stopped
 
 (test-end "mq-stream")

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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