[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-scheme] branch master updated: tests/distributed-hash-table: Fix
From: |
gnunet |
Subject: |
[gnunet-scheme] branch master updated: tests/distributed-hash-table: Fix spurious test failure. |
Date: |
Tue, 15 Feb 2022 13:22:36 +0100 |
This is an automated email from the git hooks/post-receive script.
maxime-devos pushed a commit to branch master
in repository gnunet-scheme.
The following commit(s) were added to refs/heads/master by this push:
new f9447cf tests/distributed-hash-table: Fix spurious test failure.
f9447cf is described below
commit f9447cf239db3b07e06665aa0216d30b6ef16122
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Tue Feb 15 11:23:48 2022 +0000
tests/distributed-hash-table: Fix spurious test failure.
* tests/distributed-hash-table.scm (determine-reported-errors): Wait
until the error has been reported before returning the errors.
---
tests/distributed-hash-table.scm | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tests/distributed-hash-table.scm b/tests/distributed-hash-table.scm
index 9671a46..90b8f73 100644
--- a/tests/distributed-hash-table.scm
+++ b/tests/distributed-hash-table.scm
@@ -650,16 +650,21 @@ supported."
(test-assert "(DHT) close, not connected --> all fibers stop, no callbacks
called"
(close-not-connected-no-fallbacks "dht" connect disconnect!))
-(define* (determine-reported-errors proc #:key (n-connections 1))
+(define* (determine-reported-errors proc #:key (n-connections 1) (n-errors 1))
(call-with-spawner/wait*
(lambda (config spawn)
(define errors '())
(define currently-connected? #false)
(define times-connected 0)
+ (define times-errored 0)
(define finally-disconnected-c (make-condition))
+ (define all-errors-c (make-condition))
(parameterize ((error-reporter (lambda foo
(assert (> times-connected 0))
- (set! errors (cons foo errors)))))
+ (set! times-errored (+ 1 times-errored))
+ (set! errors (cons foo errors))
+ (when (>= times-errored n-errors)
+ (signal-condition! all-errors-c)))))
(define (connected)
(assert (not currently-connected?))
(set! currently-connected? #true)
@@ -675,7 +680,10 @@ supported."
#:spawn spawn))
;; Give 'error-reporter' a chance to be called too often
(sleep 0.001)
+ ;; The error handler and 'disconnected' are called in no particular
+ ;; order, so we have to wait for both.
(wait finally-disconnected-c)
+ (wait all-errors-c)
(and (not currently-connected?)
(= times-connected n-connections) errors)))
`(("dht" . ,proc))))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet-scheme] branch master updated: tests/distributed-hash-table: Fix spurious test failure.,
gnunet <=