File tree 3 files changed +18
-5
lines changed
3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 5
5
(defun ~= (a b)
6
6
(>= 2 (abs (- a b))))
7
7
8
- (deftest test-dispatcher-balancing ()
9
- " Make sure all the workers share."
8
+ (deftest test-dispatcher-balanced ()
9
+ " Make sure all the workers share equally for similarly timed jobs ."
10
10
(define-actor counter ((c 0 )) (increment)
11
11
(sleep 0.025 )
12
12
(incf c increment))
15
15
(dotimes (i 40 ) (send actor 1 ))
16
16
(close-actor actor)
17
17
(let ((stores (join-actor actor)))
18
- (is (~= (first stores) (second stores)))))
18
+ (is (~= (first stores) (second stores))))))
19
19
20
+ (deftest test-dispatcher-unbalanced ()
21
+ " Make sure a worker with slow jobs doesn't fill up."
20
22
(define-actor sleeper ((c 0 )) (time )
21
23
(sleep time )
22
24
(incf c))
28
30
(is (equal ' ((5 20 )) (close-and-join-actors actor)))))
29
31
30
32
(deftest test-dispatcher-registry ()
33
+ " Test registering a dispatcher with a global name."
31
34
(define-actor counter ((c 0 )) (increment)
32
35
(incf c increment))
33
36
Original file line number Diff line number Diff line change 4
4
(deftest fuzz-basic-tests (&optional (times 1024 ))
5
5
" Detect rare race conditions by brute force."
6
6
(dotimes (i times)
7
- (let ((*standard-output* (make-broadcast-stream )))
8
- (is (fiasco :run-tests :thespis/test/basic )))))
7
+ (is (fiasco :run-tests
8
+ :thespis/test/basic
9
+ :stream (make-broadcast-stream )))))
10
+
11
+ (deftest fuzz-dispatcher-tests (&optional (times 16 ))
12
+ " Don't try as many reps here because it is too slow."
13
+ (dotimes (i times)
14
+ (is (fiasco :run-tests
15
+ :thespis/test/dispatcher
16
+ :stream (make-broadcast-stream )))))
Original file line number Diff line number Diff line change 11
11
:depends-on (# :thespis # :fiasco)
12
12
:components ((:module " test"
13
13
:components ((:file " basic" )
14
+ (:file " dispatcher" )
14
15
(:file " fuzz" ))))
15
16
:perform (asdf :test-op
16
17
(o c)
17
18
(multiple-value-bind (stat result)
18
19
(uiop :symbol-call :fiasco :run-tests
19
20
' (:thespis/test/basic
21
+ :thespis/test/dispatcher
20
22
:thespis/test/fuzz ))
21
23
(print result)
22
24
(assert (eql t stat)))))
You can’t perform that action at this time.
0 commit comments