aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-08-28 12:07:52 +0200
committerMaxime Devos <maximedevos@telenet.be>2021-09-21 12:20:52 +0200
commit38b38a8c1be27bc97cd54d3612c1cedf6ddf4198 (patch)
tree2375612d5680c734f8c7c59f84d029bf733aec88 /tests
parent27d839b48cd39527338f2cd85d8c9fa67755f076 (diff)
downloadgnunet-scheme-38b38a8c1be27bc97cd54d3612c1cedf6ddf4198.tar.gz
gnunet-scheme-38b38a8c1be27bc97cd54d3612c1cedf6ddf4198.zip
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?.
Diffstat (limited to 'tests')
-rw-r--r--tests/mq-stream.scm15
1 files 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 @@
490 (values (car sp) (cdr sp))) 490 (values (car sp) (cdr sp)))
491 491
492(test-assert "input eof detected --> handle-input/output! stops (port->message-queue)" 492(test-assert "input eof detected --> handle-input/output! stops (port->message-queue)"
493 (call-with-spawner 493 (call-with-spawner/wait
494 (lambda (spawn) 494 (lambda (spawn)
495 (define-values (alpha beta) (two-sockets)) 495 (define-values (alpha beta) (two-sockets))
496 (define end-of-file (make-condition)) 496 (define end-of-file (make-condition))
@@ -524,14 +524,11 @@
524 ;; If it didn't try to sent the message, that presumably means the 524 ;; If it didn't try to sent the message, that presumably means the
525 ;; 'handle-output!' fiber has completed. 525 ;; 'handle-output!' fiber has completed.
526 #t) 526 #t)
527 ;; Wait until all runnable fibers complete 527 ;; Should make 'yield-many' less fragile.
528 ;; -- TODO this does not seem to include blocking handle-input/output!.
529 #:drain? #t
530 ;; drain? is broken when parallelism is enabled, see <???>.
531 #:parallelism 1)) 528 #:parallelism 1))
532 529
533(test-assert "closed for writing --> handle-input! stops (port->message-queue)" 530(test-assert "closed for writing --> handle-input! stops (port->message-queue)"
534 (call-with-spawner 531 (call-with-spawner/wait
535 (lambda (spawn) 532 (lambda (spawn)
536 (define-values (alpha beta) (two-sockets)) 533 (define-values (alpha beta) (two-sockets))
537 (define received? (make-atomic-box #f)) 534 (define received? (make-atomic-box #f))
@@ -574,7 +571,7 @@
574 (yield-many) 571 (yield-many)
575 (sleep 0.1) ; might not be necessary anymore 572 (sleep 0.1) ; might not be necessary anymore
576 #t) 573 #t)
577 #:drain? #t 574 ;; Should make 'yield-many' less fragile.
578 #:parallelism 1)) 575 #:parallelism 1))
579 576
580;; This detects the absence of the parametrisation of 'current-write-waiter'. 577;; This detects the absence of the parametrisation of 'current-write-waiter'.
@@ -618,7 +615,9 @@
618 (yield-many) 615 (yield-many)
619 (sleep 0.1) 616 (sleep 0.1)
620 (shutdown alpha 0) 617 (shutdown alpha 0)
621 #t))) 618 #t)
619 ;; Should make 'yield-many' less fragile.
620 #:parallelism 1))
622;; ^ if this test blocks, that means not all fibers have stopped 621;; ^ if this test blocks, that means not all fibers have stopped
623 622
624(test-end "mq-stream") 623(test-end "mq-stream")