1 ;;; WITH-TIMEOUT should accept more than one form in its body.
2 (with-test (:name
(sb-ext:with-timeout
:forms
) :slow t
)
3 (handler-bind ((sb-ext:timeout
#'continue
))
8 ;;; SLEEP should not cons except on 32-bit platforms when
9 ;;; (> (mod seconds 1) (* most-positive-fixnum 1e-9))
10 (with-test (:name
(sleep :non-consing
)
11 :serial t
:skipped-on
:interpreter
)
12 (handler-case (sb-ext:with-timeout
5
13 (ctu:assert-no-consing
(sleep 0.00001s0
))
14 (locally (declare (notinline sleep
))
15 (ctu:assert-no-consing
(sleep 0.00001s0
))
16 (ctu:assert-no-consing
(sleep 0.00001d0
))
17 (ctu:assert-no-consing
(sleep 1/100000003))))
20 ;;; Changes to make SLEEP cons less led to SLEEP
21 ;;; not sleeping at all on 32-bit platforms when
22 ;;; (> (mod seconds 1) (* most-positive-fixnum 1e-9)).
23 (with-test (:name
(sleep :bug-1194673
))
31 ;;; SLEEP should work with large integers as well
32 (with-test (:name
(sleep :pretty-much-forever
)
33 :skipped-on
(:and
(:or
:linux
:darwin
) :sb-safepoint
)) ; hangs
36 (sb-ext:with-timeout
1
37 (sleep (ash 1 (* 2 sb-vm
:n-word-bits
))))
41 ;;; Check that SLEEP called with ratios (with no common factors with
42 ;;; 1000000000, and smaller than 1/1000000000) works more or less as
44 (with-test (:name
(sleep ratio
))
45 (let ((fun0a (checked-compile '(lambda () (sleep 1/7))))
46 (fun0b (checked-compile '(lambda () (sleep 1/100000000000000000000000000))))
47 (fun1 (checked-compile '(lambda (x) (sleep x
))))
48 (start-time (get-universal-time)))
50 (sleep 1/100000000000000000000000000)
54 (funcall fun1
1/100000000000000000000000000)
56 (assert (< (- (get-universal-time) start-time
) 2))))
58 (with-test (:name
(sleep :return-value
))
59 (checked-compile-and-assert ()
60 `(lambda () (sleep 0.001))