|
47 | 47 | ;:monotonic monotonic/workload
|
48 | 48 | ;:multimonotonic multimonotonic/workload
|
49 | 49 | ;:pages pages/workload
|
| 50 | + :none (fn [_] tests/noop-test) |
50 | 51 | :register register/workload})
|
51 | 52 |
|
| 53 | +(def standard-workloads |
| 54 | + "The workload names we run for test-all by default." |
| 55 | + (remove #{:none} (keys workloads))) |
| 56 | + |
| 57 | +(def workloads-expected-to-pass |
| 58 | + "A collection of workload names which we expect should actually pass." |
| 59 | + (remove #{:register :counter-dec} standard-workloads)) |
| 60 | + |
52 | 61 | (def workload-options
|
53 | 62 | "For each workload, a map of workload options to all the values that option
|
54 | 63 | supports."
|
|
73 | 82 | [nil "--mvcc"
|
74 | 83 | "Enable MVCC engine"
|
75 | 84 | :default false]
|
76 |
| - ["-w" "--workload NAME" "Test workload to run" |
77 |
| - :parse-fn keyword |
78 |
| - :missing (str "--workload " (cli/one-of workloads)) |
79 |
| - :validate [workloads (cli/one-of workloads)]] |
80 | 85 | ["-e" "--engine NAME"
|
81 | 86 | "What Tarantool data engine should we use?"
|
82 | 87 | :default "memtx"]])
|
83 | 88 |
|
| 89 | +(def test-all-opts |
| 90 | + "Command line options for testing everything." |
| 91 | + [[nil "--only-workloads-expected-to-pass" "Don't run tests which we know fail." |
| 92 | + :default false] |
| 93 | + ["-w" "--workload NAME" |
| 94 | + "Test workload to run. If omitted, runs all workloads." |
| 95 | + :parse-fn keyword |
| 96 | + :default nil |
| 97 | + :validate [workloads (cli/one-of workloads)]]]) |
| 98 | + |
| 99 | +(def single-test-opts |
| 100 | + "Command line options for single tests." |
| 101 | + [["-w" "--workload NAME" "Test workload to run" |
| 102 | + :parse-fn keyword |
| 103 | + :missing (str "--workload " (cli/one-of workloads)) |
| 104 | + :validate [workloads (cli/one-of workloads)]]]) |
| 105 | + |
84 | 106 | (def crash-pattern
|
85 | 107 | "An egrep pattern we use to find crashes in the Tarantool logs."
|
86 | 108 | (str/join "|"
|
|
148 | 170 | :exceptions (checker/unhandled-exceptions)
|
149 | 171 | :workload (:checker workload)})})))
|
150 | 172 |
|
| 173 | +(defn all-test-options |
| 174 | + "Takes base cli options, a collection of workloads, and a test count, |
| 175 | + and constructs a sequence of test options." |
| 176 | + [cli workloads] |
| 177 | + (for [w workloads, i (range (:test-count cli))] |
| 178 | + (assoc cli |
| 179 | + :workload w))) |
| 180 | + |
| 181 | +(defn all-tests |
| 182 | + "Takes parsed CLI options and constructs a sequence of test options, by |
| 183 | + combining all workloads." |
| 184 | + [test-fn opts] |
| 185 | + (let [workloads (if-let [w (:workload opts)] [w] |
| 186 | + (if (:only-workloads-expected-to-pass opts) |
| 187 | + workloads-expected-to-pass |
| 188 | + standard-workloads))] |
| 189 | + (->> (all-test-options opts workloads) |
| 190 | + (map test-fn)))) |
| 191 | + |
151 | 192 | (defn -main
|
152 | 193 | "Handles command line arguments."
|
153 | 194 | [& args]
|
154 | 195 | (cli/run! (merge (cli/single-test-cmd {:test-fn tarantool-test
|
155 |
| - :opt-spec cli-opts}) |
| 196 | + :opt-spec (concat cli-opts single-test-opts)}) |
| 197 | + (cli/test-all-cmd {:tests-fn (partial all-tests tarantool-test) |
| 198 | + :opt-spec (concat cli-opts test-all-opts)}) |
156 | 199 | (cli/serve-cmd))
|
157 | 200 | args))
|
0 commit comments