initial import
Annotate for file src/thread.lisp
2009-04-02 tobias 1 (in-package :qt.tests)
22:17:02 ' 2
' 3 (5am:in-suite :qt.suite)
' 4
' 5 ;;; FIXME implement something sensibel and test
' 6 ;;; that it realy tests for races.
' 7
' 8
' 9 (defmacro parallel-test (&body body)
' 10 "Executes BODY concurrently by using threads and tests
' 11 wherther all tests are successfull."
' 12 (let ((threads (gensym))
' 13 (thread (gensym)))
' 14 `(let ((,threads nil))
' 15 (with-timeout (5)
' 16 (dotimes (,(gensym) 2)
' 17 (push (make-thread #'(lambda () ,@body))
' 18 ,threads))
' 19 (dolist (,thread ,threads)
' 20 (5am:is (eql (5am:results-status (join-thread ,thread))
' 21 t)))))))
' 22
' 23 #|
' 24 (5am:test (bytearray-threads :depends-on make-bytearray)
' 25 "Concurrent qbytearray creation."
' 26 (parallel-test
' 27 (dotimes (x 5)
' 28 (5am:run 'make-bytearray))))
' 29 |#
' 30
' 31 ;; FIXME this test does not work realibly
' 32 #|
' 33 (5am:test (gc-object-threads :depends-on gc-object)
' 34 "Concurrent garbage collenction."
' 35 (parallel-test
' 36 (dotimes (x 2)
' 37 (5am:run 'gc-object))))
' 38
' 39
' 40 |#