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
This commit is contained in:
Junio C Hamano 2019-02-13 18:18:42 -08:00
commit feb9a9b202
3 changed files with 23 additions and 4 deletions

View File

@ -211,6 +211,11 @@ appropriately before running "make".
'.stress-<nr>' suffix, and the trash directory of the failed '.stress-<nr>' suffix, and the trash directory of the failed
test job is renamed to end with a '.stress-failed' suffix. test job is renamed to end with a '.stress-failed' suffix.
--stress-limit=<N>::
When combined with --stress run the test script repeatedly
this many times in each of the parallel jobs or until one of
them fails, whichever comes first.
You can also set the GIT_TEST_INSTALLED environment variable to You can also set the GIT_TEST_INSTALLED environment variable to
the bindir of an existing git installation to test that installation. the bindir of an existing git installation to test that installation.
You still need to have built this git sandbox, from which various You still need to have built this git sandbox, from which various

View File

@ -1289,7 +1289,7 @@ test_set_port () {
port=$(($port + 10000)) port=$(($port + 10000))
fi fi
;; ;;
*[^0-9]*|0*) *[!0-9]*|0*)
error >&7 "invalid port number: $port" error >&7 "invalid port number: $port"
;; ;;
*) *)

View File

@ -149,7 +149,7 @@ do
--stress=*) --stress=*)
stress=${opt#--*=} stress=${opt#--*=}
case "$stress" in case "$stress" in
*[^0-9]*|0*|"") *[!0-9]*|0*|"")
echo "error: --stress=<N> requires the number of jobs to run" >&2 echo "error: --stress=<N> requires the number of jobs to run" >&2
exit 1 exit 1
;; ;;
@ -157,6 +157,17 @@ do
;; ;;
esac esac
;; ;;
--stress-limit=*)
stress_limit=${opt#--*=}
case "$stress_limit" in
*[!0-9]*|0*|"")
echo "error: --stress-limit=<N> requires the number of repetitions" >&2
exit 1
;;
*) # Good.
;;
esac
;;
*) *)
echo "error: unknown test option '$opt'" >&2; exit 1 ;; echo "error: unknown test option '$opt'" >&2; exit 1 ;;
esac esac
@ -242,8 +253,10 @@ then
exit 1 exit 1
' TERM INT ' TERM INT
cnt=0 cnt=1
while ! test -e "$stressfail" while ! test -e "$stressfail" &&
{ test -z "$stress_limit" ||
test $cnt -le $stress_limit ; }
do do
$TEST_SHELL_PATH "$0" "$@" >"$TEST_RESULTS_BASE.stress-$job_nr.out" 2>&1 & $TEST_SHELL_PATH "$0" "$@" >"$TEST_RESULTS_BASE.stress-$job_nr.out" 2>&1 &
test_pid=$! test_pid=$!
@ -266,6 +279,7 @@ then
if test -f "$stressfail" if test -f "$stressfail"
then then
stress_exit=1
echo "Log(s) of failed test run(s):" echo "Log(s) of failed test run(s):"
for failed_job_nr in $(sort -n "$stressfail") for failed_job_nr in $(sort -n "$stressfail")
do do