tests: introduce --stress-jobs=<N>
The --stress option currently accepts an argument, but it is confusing to at least this user that the argument does not define the maximal number of stress iterations, but instead the number of jobs to run in parallel per stress iteration. Let's introduce a separate option for that, whose name makes it more obvious what it is about, and let --stress=<N> error out with a helpful suggestion about the two options tha could possibly have been meant. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Mar 3, 2019 at 06:44 UTC
f54573714429ce249bab7422a51f3a8c37016080
2 files changed
+11
-3
t/README
+4
-2
@@ -196,11 +196,10 @@ appropriately before running "make".
196
variable to "1" or "0", respectively.
197
198
--stress::
199
---stress=<N>::
199
Run the test script repeatedly in multiple parallel jobs until
200
one of them fails. Useful for reproducing rare failures in
201
flaky tests. The number of parallel jobs is, in order of
203
- precedence: <N>, or the value of the GIT_TEST_STRESS_LOAD
202
+ precedence: the value of the GIT_TEST_STRESS_LOAD
203
environment variable, or twice the number of available
204
processors (as shown by the 'getconf' utility), or 8.
205
Implies `--verbose -x --immediate` to get the most information
@@ -211,6 +210,9 @@ appropriately before running "make".
210
'.stress-<nr>' suffix, and the trash directory of the failed
211
test job is renamed to end with a '.stress-failed' suffix.
212
213
+--stress-jobs=<N>::
214
+ Override the number of parallel jobs. Implies `--stress`.
215
+
216
--stress-limit=<N>::
217
When combined with --stress run the test script repeatedly
218
this many times in each of the parallel jobs or until one of
t/test-lib.sh
+7
-1
@@ -147,10 +147,16 @@ do
147
--stress)
148
stress=t ;;
149
--stress=*)
150
+ echo "error: --stress does not accept an argument: '$opt'" >&2
151
+ echo "did you mean --stress-jobs=${opt#*=} or --stress-limit=${opt#*=}?" >&2
152
+ exit 1
153
+ ;;
154
+ --stress-jobs=*)
155
+ stress=t;
156
stress=${opt#--*=}
157
case "$stress" in
158
*[!0-9]*|0*|"")
153
- echo "error: --stress=<N> requires the number of jobs to run" >&2
159
+ echo "error: --stress-jobs=<N> requires the number of jobs to run" >&2
160
exit 1
161
;;
162
*) # Good.