Skip to content

Commit feb9a9b

Browse files
committed
Merge branch 'sg/stress-test'
Test improvement. * sg/stress-test: test-lib: fix non-portable pattern bracket expressions test-lib: make '--stress' more bisect-friendly
2 parents 29825a8 + 7d661e5 commit feb9a9b

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

t/README

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ appropriately before running "make".
211211
'.stress-<nr>' suffix, and the trash directory of the failed
212212
test job is renamed to end with a '.stress-failed' suffix.
213213

214+
--stress-limit=<N>::
215+
When combined with --stress run the test script repeatedly
216+
this many times in each of the parallel jobs or until one of
217+
them fails, whichever comes first.
218+
214219
You can also set the GIT_TEST_INSTALLED environment variable to
215220
the bindir of an existing git installation to test that installation.
216221
You still need to have built this git sandbox, from which various

t/test-lib-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ test_set_port () {
12891289
port=$(($port + 10000))
12901290
fi
12911291
;;
1292-
*[^0-9]*|0*)
1292+
*[!0-9]*|0*)
12931293
error >&7 "invalid port number: $port"
12941294
;;
12951295
*)

t/test-lib.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,25 @@ do
149149
--stress=*)
150150
stress=${opt#--*=}
151151
case "$stress" in
152-
*[^0-9]*|0*|"")
152+
*[!0-9]*|0*|"")
153153
echo "error: --stress=<N> requires the number of jobs to run" >&2
154154
exit 1
155155
;;
156156
*) # Good.
157157
;;
158158
esac
159159
;;
160+
--stress-limit=*)
161+
stress_limit=${opt#--*=}
162+
case "$stress_limit" in
163+
*[!0-9]*|0*|"")
164+
echo "error: --stress-limit=<N> requires the number of repetitions" >&2
165+
exit 1
166+
;;
167+
*) # Good.
168+
;;
169+
esac
170+
;;
160171
*)
161172
echo "error: unknown test option '$opt'" >&2; exit 1 ;;
162173
esac
@@ -242,8 +253,10 @@ then
242253
exit 1
243254
' TERM INT
244255

245-
cnt=0
246-
while ! test -e "$stressfail"
256+
cnt=1
257+
while ! test -e "$stressfail" &&
258+
{ test -z "$stress_limit" ||
259+
test $cnt -le $stress_limit ; }
247260
do
248261
$TEST_SHELL_PATH "$0" "$@" >"$TEST_RESULTS_BASE.stress-$job_nr.out" 2>&1 &
249262
test_pid=$!
@@ -266,6 +279,7 @@ then
266279

267280
if test -f "$stressfail"
268281
then
282+
stress_exit=1
269283
echo "Log(s) of failed test run(s):"
270284
for failed_job_nr in $(sort -n "$stressfail")
271285
do

0 commit comments

Comments
 (0)