Make unit tests work & run tests on darcs record
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 #|
2009-04-06 tobias 24 (5am:test (bytearray-threads :depends-on bytearray)
2009-04-02 tobias 25 "Concurrent qbytearray creation."
22:17:02 ' 26 (parallel-test
' 27 (dotimes (x 5)
2009-04-06 tobias 28 (5am:run 'bytearray))))
11:50:14 ' 29 |#
2009-04-02 tobias 30
22:17:02 ' 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 |#