|
232 | 232 | (defn run-testables |
233 | 233 | "Run a collection of testables, returning a result collection." |
234 | 234 | [testables test-plan] |
| 235 | + (print "run-testables got a collection of size" (count testables) |
| 236 | + " the first of which is " |
| 237 | + (:kaocha.testable/type (first testables)) |
| 238 | + ) |
235 | 239 | (let [load-error? (some ::load-error testables)] |
236 | 240 | (loop [result [] |
237 | 241 | [test & testables] testables] |
|
249 | 253 | (defn run-testables-parallel |
250 | 254 | "Run a collection of testables, returning a result collection." |
251 | 255 | [testables test-plan] |
| 256 | + |
| 257 | + (print "run-testables-parallel got a collection of size" (count testables)) |
252 | 258 | (let [load-error? (some ::load-error testables) |
253 | 259 | ;; results (watch/make-queue) |
254 | | - put-return (fn [acc value] |
255 | | - (if (instance? BlockingQueue value) |
256 | | - (.drainTo value acc) |
257 | | - (.put acc value)) |
258 | | - acc) |
259 | | - futures (map #(future (run-testable % test-plan)) testables)] |
260 | | - (println "Running in parallel!") |
| 260 | + ;; put-return (fn [acc value] |
| 261 | + ;; (if (instance? BlockingQueue value) |
| 262 | + ;; (.drainTo value acc) |
| 263 | + ;; (.put acc value)) |
| 264 | + ;; acc) |
| 265 | + futures (doall (map #(future (do (println "Firing off future!" (Thread/currentThread)) (binding [*config* (dissoc *config* :parallel)] (run-testable % test-plan)))) testables))] |
261 | 266 | (comment (loop [result [] ;(ArrayBlockingQueue. 1024) |
262 | 267 | [test & testables] testables] |
263 | 268 | (if test |
|
271 | 276 | ;(recur (doto result (.put r)) testables) |
272 | 277 | (recur (conj result r) testables))) |
273 | 278 | result))) |
274 | | - (map deref futures) |
275 | | - )) |
| 279 | + futures)) |
276 | 280 |
|
277 | 281 | (defn test-seq [testable] |
278 | 282 | (cond->> (mapcat test-seq (remove ::skip (or (:kaocha/tests testable) |
|
0 commit comments