From: Junio C Hamano Date: Thu, 7 Mar 2019 00:59:54 +0000 (+0900) Subject: Merge branch 'jc/test-yes-doc' X-Git-Tag: v2.22.0-rc0~173 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/19ea7228b0b6a7a573f3601f4cafbf2d07078b34?ds=inline;hp=-c Merge branch 'jc/test-yes-doc' Test doc update. * jc/test-yes-doc: test: caution on our version of 'yes' --- 19ea7228b0b6a7a573f3601f4cafbf2d07078b34 diff --combined t/README index 886bbec5bc,f4e1a82657..7a3d582267 --- a/t/README +++ b/t/README @@@ -211,11 -211,6 +211,11 @@@ appropriately before running "make" '.stress-' suffix, and the trash directory of the failed test job is renamed to end with a '.stress-failed' suffix. +--stress-limit=:: + 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 the bindir of an existing git installation to test that installation. You still need to have built this git sandbox, from which various @@@ -932,6 -927,15 +932,15 @@@ library for your script to use test_oid_init or test_oid_cache. Providing an unknown key is an error. + - yes [] + + This is often seen in modern UNIX but some platforms lack it, so + the test harness overrides the platform implementation with a + more limited one. Use this only when feeding a handful lines of + output to the downstream---unlike the real version, it generates + only up to 99 lines. + + Prerequisites ------------- diff --combined t/test-lib.sh index 8665b0a9b6,541a37f4c0..4e79e140c9 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -149,7 -149,7 +149,7 @@@ d --stress=*) stress=${opt#--*=} case "$stress" in - *[^0-9]*|0*|"") + *[!0-9]*|0*|"") echo "error: --stress= requires the number of jobs to run" >&2 exit 1 ;; @@@ -157,17 -157,6 +157,17 @@@ ;; esac ;; + --stress-limit=*) + stress_limit=${opt#--*=} + case "$stress_limit" in + *[!0-9]*|0*|"") + echo "error: --stress-limit= requires the number of repetitions" >&2 + exit 1 + ;; + *) # Good. + ;; + esac + ;; *) echo "error: unknown test option '$opt'" >&2; exit 1 ;; esac @@@ -253,10 -242,8 +253,10 @@@ the 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=$! @@@ -279,7 -266,6 +279,7 @@@ 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 @@@ -1327,7 -1313,11 +1327,11 @@@ the fi fi - # Provide an implementation of the 'yes' utility + # Provide an implementation of the 'yes' utility; the upper bound + # limit is there to help Windows that cannot stop this loop from + # wasting cycles when the downstream stops reading, so do not be + # tempted to turn it into an infinite loop. cf. 6129c930 ("test-lib: + # limit the output of the yes utility", 2016-02-02) yes () { if test $# = 0 then