All checks were successful
/ test (push) Successful in 9s
This was motivated by trying to allow for completely cleaning up resource pools, which involved removing their use of fiberize which currently has no destroy mechanism. As part of this, there's a new parallelism limiter mechanism using resource pools rather than fibers, and also a fixed size resource pool. The tests now drain? and destroy the resource pools to check cleaning up.
31 lines
863 B
Scheme
31 lines
863 B
Scheme
(define-module (tests)
|
|
#:use-module (ice-9 exceptions)
|
|
#:use-module (fibers)
|
|
#:export (run-fibers-for-tests
|
|
assert-no-heap-growth))
|
|
|
|
(define* (run-fibers-for-tests thunk #:key (drain? #t))
|
|
(let ((result
|
|
(run-fibers
|
|
(lambda ()
|
|
(with-exception-handler
|
|
(lambda (exn)
|
|
exn)
|
|
(lambda ()
|
|
(simple-format #t "running ~A\n" thunk)
|
|
(with-exception-handler
|
|
(lambda (exn)
|
|
(backtrace)
|
|
(raise-exception exn))
|
|
thunk)
|
|
#t)
|
|
#:unwind? #t))
|
|
#:hz 0
|
|
#:parallelism 1
|
|
#:drain? drain?)))
|
|
(if (exception? result)
|
|
(raise-exception result)
|
|
result)))
|
|
|
|
(define (assert-no-heap-growth thunk)
|
|
(thunk))
|