8244602: Add JTREG_REPEAT_COUNT to repeat execution of a test

Reviewed-by: ihse, erikj
This commit is contained in:
Aleksey Shipilev 2021-12-07 11:32:17 +00:00
parent 07669e3bc6
commit b2638e5efd
3 changed files with 28 additions and 1 deletions

View File

@ -194,6 +194,8 @@ TEST FAILURE</code></pre>
<p>Generate AOT modules before testing for the specified module, or set of modules. If multiple modules are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
<h4 id="retry_count">RETRY_COUNT</h4>
<p>Retry failed tests up to a set number of times. Defaults to 0.</p>
<h4 id="repeat_count">REPEAT_COUNT</h4>
<p>Repeat the tests for a set number of times. Defaults to 0.</p>
<h3 id="gtest-keywords">Gtest keywords</h3>
<h4 id="repeat">REPEAT</h4>
<p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>

View File

@ -421,6 +421,10 @@ modules. If multiple modules are specified, they should be separated by space
Retry failed tests up to a set number of times. Defaults to 0.
#### REPEAT_COUNT
Repeat the tests for a set number of times. Defaults to 0.
### Gtest keywords
#### REPEAT

View File

@ -200,7 +200,7 @@ $(eval $(call SetTestOpt,FAILURE_HANDLER_TIMEOUT,JTREG))
$(eval $(call ParseKeywordVariable, JTREG, \
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR FAILURE_HANDLER_TIMEOUT \
TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM RUN_PROBLEM_LISTS \
RETRY_COUNT MAX_OUTPUT $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
RETRY_COUNT REPEAT_COUNT MAX_OUTPUT $(CUSTOM_JTREG_SINGLE_KEYWORDS), \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
EXTRA_PROBLEM_LISTS LAUNCHER_OPTIONS \
$(CUSTOM_JTREG_STRING_KEYWORDS), \
@ -745,6 +745,15 @@ define SetupRunJtregTestBody
JTREG_RETAIN ?= fail,error
JTREG_RUN_PROBLEM_LISTS ?= false
JTREG_RETRY_COUNT ?= 0
JTREG_REPEAT_COUNT ?= 0
ifneq ($$(JTREG_RETRY_COUNT), 0)
ifneq ($$(JTREG_REPEAT_COUNT), 0)
$$(info Error: Cannot use both JTREG_RETRY_COUNT and JTREG_REPEAT_COUNT together.)
$$(info Please choose one or the other.)
$$(error Cannot continue)
endif
endif
ifneq ($$(JTREG_LAUNCHER_OPTIONS), )
$1_JTREG_LAUNCHER_OPTIONS += $$(JTREG_LAUNCHER_OPTIONS)
@ -869,6 +878,18 @@ define SetupRunJtregTestBody
done
endif
ifneq ($$(JTREG_REPEAT_COUNT), 0)
$1_COMMAND_LINE := \
for i in {1..$$(JTREG_REPEAT_COUNT)}; do \
$$(PRINTF) "\nRepeating Jtreg run: $$$$i out of $$(JTREG_REPEAT_COUNT)\n"; \
$$($1_COMMAND_LINE); \
if [ "`$$(CAT) $$($1_EXITCODE)`" != "0" ]; then \
$$(PRINTF) "\nFailures detected, no more repeats.\n"; \
break; \
fi; \
done
endif
run-test-$1: pre-run-test clean-workdir-$1
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')