summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-02-14 02:18:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-02-14 02:18:42 (GMT)
commitfeb9a9b202c12289150de45473846f4272aac1bd (patch)
tree1d320a306783104f678ec9993dbbf6dbdf1fd29e /t/test-lib.sh
parent29825a8dbf77e268b90a05f633124e9db6b314e7 (diff)
parent7d661e5ed16dca303d7898f5ab0cc2ffc69e0499 (diff)
downloadgit-feb9a9b202c12289150de45473846f4272aac1bd.zip
git-feb9a9b202c12289150de45473846f4272aac1bd.tar.gz
git-feb9a9b202c12289150de45473846f4272aac1bd.tar.bz2
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
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 42b1a0a..8665b0a 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -149,7 +149,7 @@ do
--stress=*)
stress=${opt#--*=}
case "$stress" in
- *[^0-9]*|0*|"")
+ *[!0-9]*|0*|"")
echo "error: --stress=<N> requires the number of jobs to run" >&2
exit 1
;;
@@ -157,6 +157,17 @@ do
;;
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 ;;
esac
@@ -242,8 +253,10 @@ then
exit 1
' TERM INT
- cnt=0
- while ! test -e "$stressfail"
+ cnt=1
+ while ! test -e "$stressfail" &&
+ { test -z "$stress_limit" ||
+ test $cnt -le $stress_limit ; }
do
$TEST_SHELL_PATH "$0" "$@" >"$TEST_RESULTS_BASE.stress-$job_nr.out" 2>&1 &
test_pid=$!
@@ -266,6 +279,7 @@ then
if test -f "$stressfail"
then
+ stress_exit=1
echo "Log(s) of failed test run(s):"
for failed_job_nr in $(sort -n "$stressfail")
do