Skip to content

Commit f545737

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent de69e6f commit f545737

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

t/README

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,10 @@ appropriately before running "make".
196196
variable to "1" or "0", respectively.
197197

198198
--stress::
199-
--stress=<N>::
200199
Run the test script repeatedly in multiple parallel jobs until
201200
one of them fails. Useful for reproducing rare failures in
202201
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
204203
environment variable, or twice the number of available
205204
processors (as shown by the 'getconf' utility), or 8.
206205
Implies `--verbose -x --immediate` to get the most information
@@ -211,6 +210,9 @@ appropriately before running "make".
211210
'.stress-<nr>' suffix, and the trash directory of the failed
212211
test job is renamed to end with a '.stress-failed' suffix.
213212

213+
--stress-jobs=<N>::
214+
Override the number of parallel jobs. Implies `--stress`.
215+
214216
--stress-limit=<N>::
215217
When combined with --stress run the test script repeatedly
216218
this many times in each of the parallel jobs or until one of

t/test-lib.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,16 @@ do
147147
--stress)
148148
stress=t ;;
149149
--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;
150156
stress=${opt#--*=}
151157
case "$stress" in
152158
*[!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
154160
exit 1
155161
;;
156162
*) # Good.

0 commit comments

Comments
 (0)