X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-concurrency%2Ftests%2Ftest-mailbox.lisp;h=e6cee14bdd56d16b98fe70ece3782fa77983322f;hb=4255b37e50876702d2563f3418a44a3f5bf8a2e8;hp=a0f0386f5804b89da7529dc3b31587661d877167;hpb=374667fd8a38e79869e63d56bacde7ad98a40852;p=sbcl.git diff --git a/contrib/sb-concurrency/tests/test-mailbox.lisp b/contrib/sb-concurrency/tests/test-mailbox.lisp index a0f0386..e6cee14 100644 --- a/contrib/sb-concurrency/tests/test-mailbox.lisp +++ b/contrib/sb-concurrency/tests/test-mailbox.lisp @@ -38,9 +38,31 @@ (3 nil (#\1 #\2 #\3) nil) (0 t nil t)) -;;; FIXME: Several tests disabled on Darwin due to hangs. Something not right -;;; with mailboxes -- or possibly semaphores -- there. -#+(and sb-thread (not darwin)) +#+sb-thread +(deftest mailbox-timeouts + (let* ((mbox (make-mailbox)) + (writers (loop for i from 1 upto 20 + collect (make-thread + (lambda (x) + (loop repeat 50 + do (send-message mbox x) + (sleep 0.001))) + :arguments i))) + (readers (loop repeat 10 + collect (make-thread + (lambda () + (loop while (receive-message mbox :timeout 0.1) + count t)))))) + (mapc #'join-thread writers) + (apply #'+ (mapcar #'join-thread readers))) + 1000) + +;;; FIXME: Several tests disabled on Darwin and SunOS due to hangs. +;;; +;;; On Darwin at least the issues don't seem to have anything to do with +;;; mailboxes per-se, but are rather related to our usage of signal-unsafe +;;; pthread functions inside signal handlers. +#+(and sb-thread (not (or darwin sunos))) (progn ;; Dummy struct for ATOMIC-INCF to work. @@ -148,8 +170,8 @@ (deftest mailbox.single-producer-single-consumer (test-mailbox-producers-consumers :n-senders 1 :n-receivers 1 - :n-messages 10000) - (:received . 10000) + :n-messages 1000) + (:received . 1000) (:garbage . 0) (:errors . 0) (:timeouts . 0)) @@ -157,17 +179,17 @@ (deftest mailbox.single-producer-multiple-consumers (test-mailbox-producers-consumers :n-senders 1 :n-receivers 100 - :n-messages 10000) - (:received . 10000) + :n-messages 1000) + (:received . 1000) (:garbage . 0) (:errors . 0) (:timeouts . 0)) (deftest mailbox.multiple-producers-single-consumer - (test-mailbox-producers-consumers :n-senders 100 + (test-mailbox-producers-consumers :n-senders 10 :n-receivers 1 :n-messages 100) - (:received . 10000) + (:received . 1000) (:garbage . 0) (:errors . 0) (:timeouts . 0)) @@ -175,8 +197,8 @@ (deftest mailbox.multiple-producers-multiple-consumers (test-mailbox-producers-consumers :n-senders 100 :n-receivers 100 - :n-messages 10000) - (:received . 1000000) + :n-messages 1000) + (:received . 100000) (:garbage . 0) (:errors . 0) (:timeouts . 0)) @@ -209,4 +231,4 @@ (:garbage . 0) (:timeouts . 0)) -) ; #+sb-thread (progn ... \ No newline at end of file +) ; #+sb-thread (progn ...