(with-test (:name (:deadline :get-mutex) :skipped-on '(not (and :sb-thread (not :sb-lutex))))
(assert-timeout
(let ((lock (sb-thread:make-mutex))
- (waitp t))
+ (waitp t))
(sb-thread:make-thread (lambda ()
- (sb-thread:get-mutex lock)
- (setf waitp nil)
- (sleep 5)))
+ (sb-thread:get-mutex lock)
+ (setf waitp nil)
+ (sleep 5)))
(loop while waitp do (sleep 0.01))
(sb-sys:with-deadline (:seconds 1)
(sb-thread:get-mutex lock)))))
(with-test (:name (:deadline :futex-wait-eintr) :skipped-on '(not (and :sb-thread (not :sb-lutex))))
(let ((lock (sb-thread:make-mutex))
- (waitp t))
+ (waitp t))
(sb-thread:make-thread (lambda ()
- (sb-thread:get-mutex lock)
- (setf waitp nil)
- (sleep 5)))
+ (sb-thread:get-mutex lock)
+ (setf waitp nil)
+ (sleep 5)))
(loop while waitp do (sleep 0.01))
(let ((thread (sb-thread:make-thread
- (lambda ()
- (let ((start (get-internal-real-time)))
- (handler-case
- (sb-sys:with-deadline (:seconds 1)
- (sb-thread:get-mutex lock))
- (sb-sys:deadline-timeout (x)
- (declare (ignore x))
- (let ((end (get-internal-real-time)))
- (float (/ (- end start)
- internal-time-units-per-second)
- 0.0)))))))))
+ (lambda ()
+ (let ((start (get-internal-real-time)))
+ (handler-case
+ (sb-sys:with-deadline (:seconds 1)
+ (sb-thread:get-mutex lock))
+ (sb-sys:deadline-timeout (x)
+ (declare (ignore x))
+ (let ((end (get-internal-real-time)))
+ (float (/ (- end start)
+ internal-time-units-per-second)
+ 0.0)))))))))
(sleep 0.3)
(sb-thread:interrupt-thread thread (lambda () 42))
(let ((seconds-passed (sb-thread:join-thread thread)))
- (format t "Deadline in ~S~%" seconds-passed)
- (assert (< seconds-passed 1.2))))))
+ (format t "Deadline in ~S~%" seconds-passed)
+ (assert (< seconds-passed 1.2))))))
;;; on that platform.
(with-test (:name (trace :encapsulate nil)
:fails-on '(or (and :ppc (not :linux)) :sparc :mips)
- :broken-on '(or :darwin :sunos))
+ :broken-on '(or :darwin :sunos))
(let ((out (with-output-to-string (*trace-output*)
(trace trace-this :encapsulate nil)
(assert (eq 'ok (trace-this)))
(with-test (:name (trace-recursive :encapsulate nil)
:fails-on '(or (and :ppc (not :linux)) :sparc :mips :sunos)
- :broken-on '(or :darwin (and :x86 :sunos)))
+ :broken-on '(or :darwin (and :x86 :sunos)))
(let ((out (with-output-to-string (*trace-output*)
(trace trace-fact :encapsulate nil)
(assert (= 120 (trace-fact 5)))
;;; Base-case: detecting exhaustion
(with-test (:name (:exhaust :basic) :broken-on '(and :sunos :x86-64))
(assert (eq :exhausted
- (handler-case
- (recurse)
- (storage-condition (c)
- (declare (ignore c))
- :exhausted)))))
+ (handler-case
+ (recurse)
+ (storage-condition (c)
+ (declare (ignore c))
+ :exhausted)))))
;;; Check that non-local control transfers restore the stack
;;; exhaustion checking after unwinding -- and that previous test
;;; didn't break it.
(with-test (:name (:exhaust :non-local-control) :broken-on '(and :sunos :x86-64))
(let ((exhaust-count 0)
- (recurse-count 0))
+ (recurse-count 0))
(tagbody
:retry
(handler-bind ((storage-condition (lambda (c)
- (declare (ignore c))
- (if (= *count* (incf exhaust-count))
- (go :stop)
- (go :retry)))))
- (incf recurse-count)
- (recurse))
+ (declare (ignore c))
+ (if (= *count* (incf exhaust-count))
+ (go :stop)
+ (go :retry)))))
+ (incf recurse-count)
+ (recurse))
:stop)
(assert (= exhaust-count recurse-count *count*))))
;;; unwind.
(with-test (:name (:exhaust :restarts) :broken-on '(and :sunos :x86-64))
(let ((exhaust-count 0)
- (recurse-count 0))
+ (recurse-count 0))
(block nil
(handler-bind ((storage-condition (lambda (c)
- (declare (ignore c))
- (if (= *count* (incf exhaust-count))
- (return)
- (invoke-restart (find-restart 'ok))))))
- (loop
- (with-simple-restart (ok "ok")
- (incf recurse-count)
- (recurse)))))
+ (declare (ignore c))
+ (if (= *count* (incf exhaust-count))
+ (return)
+ (invoke-restart (find-restart 'ok))))))
+ (loop
+ (with-simple-restart (ok "ok")
+ (incf recurse-count)
+ (recurse)))))
(assert (= exhaust-count recurse-count *count*))))
(with-test (:name (:exhaust :binding-stack))
(format t "Finished running tests.~%")
(let ((skipcount 0))
(cond (*all-failures*
- (format t "Status:~%")
- (dolist (fail (reverse *all-failures*))
- (cond ((eq (car fail) :unhandled-error)
- (format t " ~20a ~a~%"
- "Unhandled error"
- (enough-namestring (second fail))))
- ((eq (car fail) :invalid-exit-status)
- (format t " ~20a ~a~%"
- "Invalid exit status:"
- (enough-namestring (second fail))))
- ((eq (car fail) :skipped-disabled)
- (incf skipcount))
- (t
- (format t " ~20a ~a / ~a~%"
- (ecase (first fail)
- (:expected-failure "Expected failure:")
- (:unexpected-failure "Failure:")
- (:unexpected-success "Unexpected success:")
- (:skipped-broken "Skipped (broken):")
- (:skipped-disabled "Skipped (irrelevant):"))
- (enough-namestring (second fail))
- (third fail)))))
- (when (> skipcount 0)
- (format t " (~a tests skipped for this combination of platform and features)~%"
- skipcount)))
- (t
- (format t "All tests succeeded~%")))))
+ (format t "Status:~%")
+ (dolist (fail (reverse *all-failures*))
+ (cond ((eq (car fail) :unhandled-error)
+ (format t " ~20a ~a~%"
+ "Unhandled error"
+ (enough-namestring (second fail))))
+ ((eq (car fail) :invalid-exit-status)
+ (format t " ~20a ~a~%"
+ "Invalid exit status:"
+ (enough-namestring (second fail))))
+ ((eq (car fail) :skipped-disabled)
+ (incf skipcount))
+ (t
+ (format t " ~20a ~a / ~a~%"
+ (ecase (first fail)
+ (:expected-failure "Expected failure:")
+ (:unexpected-failure "Failure:")
+ (:unexpected-success "Unexpected success:")
+ (:skipped-broken "Skipped (broken):")
+ (:skipped-disabled "Skipped (irrelevant):"))
+ (enough-namestring (second fail))
+ (third fail)))))
+ (when (> skipcount 0)
+ (format t " (~a tests skipped for this combination of platform and features)~%"
+ skipcount)))
+ (t
+ (format t "All tests succeeded~%")))))
(defun pure-runner (files test-fun)
(format t "// Running pure tests (~a)~%" test-fun)
(remove-if (lambda (x)
(or (eq (car x) :expected-failure)
(eq (car x) :unexpected-success)
- (eq (car x) :skipped-broken)
- (eq (car x) :skipped-disabled)))
+ (eq (car x) :skipped-broken)
+ (eq (car x) :skipped-disabled)))
*all-failures*))
(defun setup-cl-user ()
`(progn
(start-test)
(cond
- ((broken-p ,broken-on)
- (fail-test :skipped-broken ',name "Test broken on this platform"))
- ((skipped-p ,skipped-on)
- (fail-test :skipped-disabled ',name "Test disabled for this combination of platform and features"))
- (t
- (block ,block-name
- (handler-bind ((error (lambda (error)
- (if (expected-failure-p ,fails-on)
- (fail-test :expected-failure ',name error)
- (fail-test :unexpected-failure ',name error))
- (return-from ,block-name))))
- (progn
- (log-msg "Running ~S" ',name)
- ,@body
- (if (expected-failure-p ,fails-on)
- (fail-test :unexpected-success ',name nil)
- (log-msg "Success ~S" ',name))))))))))
+ ((broken-p ,broken-on)
+ (fail-test :skipped-broken ',name "Test broken on this platform"))
+ ((skipped-p ,skipped-on)
+ (fail-test :skipped-disabled ',name "Test disabled for this combination of platform and features"))
+ (t
+ (block ,block-name
+ (handler-bind ((error (lambda (error)
+ (if (expected-failure-p ,fails-on)
+ (fail-test :expected-failure ',name error)
+ (fail-test :unexpected-failure ',name error))
+ (return-from ,block-name))))
+ (progn
+ (log-msg "Running ~S" ',name)
+ ,@body
+ (if (expected-failure-p ,fails-on)
+ (fail-test :unexpected-success ',name nil)
+ (log-msg "Success ~S" ',name))))))))))
(defun report-test-status ()
(with-standard-io-syntax
(with-test (:name without-interrupts+condition-wait
:fails-on :sb-lutex
- :skipped-on '(not :sb-thread))
+ :skipped-on '(not :sb-thread))
(let* ((lock (make-mutex))
(queue (make-waitqueue))
(thread (make-thread (lambda ()
(with-test (:name (:timer :relative)
:fails-on '(and :sparc :linux)
- :skipped-on :win32)
+ :skipped-on :win32)
(let* ((has-run-p nil)
(timer (make-timer (lambda () (setq has-run-p t))
:name "simple timer")))
(with-test (:name (:timer :absolute)
:fails-on '(and :sparc :linux)
- :skipped-on :win32)
+ :skipped-on :win32)
(let* ((has-run-p nil)
(timer (make-timer (lambda () (setq has-run-p t))
:name "simple timer")))
(with-test (:name (:timer :repeat-and-unschedule)
:fails-on '(and :sparc :linux)
- :skipped-on :win32)
+ :skipped-on :win32)
(let* ((run-count 0)
timer)
(setq timer