Fix job unit tests

This commit is contained in:
Renaud Casenave-Péré 2016-04-04 22:44:29 +02:00
parent 383e156c91
commit cdfd5f6bb5
2 changed files with 11 additions and 11 deletions

View file

@ -12,7 +12,7 @@
(defmacro with-new-job-thread (count &body body)
`(progn
(dotimes (i ,count)
(push-new-job-thread #'stoe/core/jobs::start-job-thread))
(push-new-job-thread (format nil "Test thread ~d" i)))
,@body
(mapc (lambda (thread) (terminate-thread thread))
stoe/core/jobs::*thread-list*)

View file

@ -21,25 +21,25 @@
(plan 3)
(with-new-job-thread 1
(push-new-job #'counter '(0))
(async-job () (counter 0))
(sleep 1)
(push-new-job #'counter '(0))
(async-job () (counter 0))
(sleep 1)
(push-new-job #'counter '(0))
(async-job () (counter 0))
(sleep 1))
(is (size stoe/core/jobs::*job-queue*) 0 "1 thread, 3 jobs, 1 at a time.")
(push-new-job #'counter '(0))
(push-new-job #'counter '(0))
(push-new-job #'counter '(0))
(with-new-job-thread 2
(async-job () (counter 0))
(async-job () (counter 0))
(async-job () (counter 0))
(with-new-job-thread 1
(sleep 1))
(is (size stoe/core/jobs::*job-queue*) 0 "1 thread, 3 jobs, all at once.")
(with-new-job-thread 3
(push-new-job #'counter '(0))
(push-new-job #'counter '(0))
(push-new-job #'counter '(0))
(async-job () (counter 0))
(async-job () (counter 0))
(async-job () (counter 0))
(sleep 1))
(is (size stoe/core/jobs::*job-queue*) 0 "3 threads, 3 jobs, all at once.")