|
33 | 33 | (if (seq val) |
34 | 34 | (assoc-in m path (coerce val)) |
35 | 35 | (assoc-in m path default)))) |
| 36 | + {} |
36 | 37 | config-mapping)) |
37 | 38 |
|
38 | 39 | (def ^:private ^java.util.Random rnd (java.util.Random. (System/currentTimeMillis))) |
|
111 | 112 |
|
112 | 113 | (defn- run-n |
113 | 114 | "Run tests in parallel on nthreads, dividing msec equally between the tests. |
114 | | - Returns a list of maps of :iter, :seed, :test." |
| 115 | + Returns a list of maps of :iter, :seed" |
115 | 116 | [{:keys [nthreads msec]} tests] |
116 | 117 | (mapcat #(run-one % |
117 | 118 | {:msec (/ msec (count tests)) |
|
152 | 153 | (defn run-suite |
153 | 154 | "Designed for test suite use." |
154 | 155 | [{:keys [nthreads msec progress]} tests] |
155 | | - (let [progress (or progress #(prf "."))] |
156 | | - (reduce |
157 | | - (fn [{:keys [failures iters tests]} result] |
158 | | - (when (:exception result) |
159 | | - (.printStackTrace ^Throwable (:exception result))) |
160 | | - (if (:exception result) |
161 | | - (prn result) |
162 | | - (progress)) |
163 | | - {:failures (+ failures (if (:exception result) 1 0)) |
164 | | - :iters (+ iters (:iter result)) |
165 | | - :tests (+ tests (/ 1 nthreads))}) |
166 | | - {:failures 0 :iters 0 :tests 0} |
167 | | - (run-n {:nthreads nthreads |
168 | | - :msec msec} |
169 | | - tests)))) |
| 156 | + (let [progress (or progress #(prf ".")) |
| 157 | + ret (reduce |
| 158 | + (fn [{:keys [failures iters nresults]} result] |
| 159 | + (when (:exception result) |
| 160 | + (.printStackTrace ^Throwable (:exception result))) |
| 161 | + (if (:exception result) |
| 162 | + (prn result) |
| 163 | + (progress)) |
| 164 | + {:failures (+ failures (if (:exception result) 1 0)) |
| 165 | + :iters (+ iters (:iter result)) |
| 166 | + :nresults (+ nresults 1)}) |
| 167 | + {:failures 0 :iters 0 :nresults 0} |
| 168 | + (run-n {:nthreads nthreads |
| 169 | + :msec msec} |
| 170 | + tests))] |
| 171 | + (-> ret |
| 172 | + (assoc :tests (/ (:nresults ret) nthreads)) |
| 173 | + (dissoc :nresults)))) |
170 | 174 |
|
171 | 175 | (defn -main |
172 | 176 | "Command line entry point. Calls System.exit!" |
|
0 commit comments