1 ;;;; Tests for async signal safety.
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absoluely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
14 (use-package :test-util
)
16 (with-test (:name
(:async-unwind
:specials
))
17 (let ((*x0
* nil
) (*x1
* nil
) (*x2
* nil
) (*x3
* nil
) (*x4
* nil
))
18 (declare (special *x0
* *x1
* *x2
* *x3
* *x4
*))
22 (sb-ext:schedule-timer
(sb-ext:make-timer
27 (let ((*x0
* (cons nil nil
)) (*x1
* (cons nil nil
))
28 (*x2
* (cons nil nil
)) (*x3
* (cons nil nil
))
29 (*x4
* (cons nil nil
)))
30 (declare (special *x0
* *x1
* *x2
* *x3
* *x4
*)))))
31 (when (not (and (null *x0
*) (null *x1
*) (null *x2
*) (null *x3
*)
33 (format t
"~S ~S ~S ~S ~S~%" *x0
* *x1
* *x2
* *x3
* *x4
*)
41 (with-test (:name
(:signal
:errno
))
44 (timer (make-timer (lambda ()
45 (sb-unix:unix-open
"~!@#$%^&*[]()/\\" 0 0)
46 (assert (= sb-unix
:enoent
47 (sb-unix::get-errno
)))
48 (setq returning t
)))))
49 (schedule-timer timer
0.2)
50 ;; Fail and set errno.
51 (sb-unix:nanosleep -
1 -
1)
52 (setq saved-errno
(sb-unix::get-errno
))
53 (assert (= saved-errno sb-posix
:einval
))
54 ;; Wait, but not with sleep because that will be interrupted and
56 (loop until returning
)
57 (loop repeat
1000000000)
58 (assert (= saved-errno
(sb-unix::get-errno
)))))