Skip to content

Commit 799fbf2

Browse files
author
ihse
committed
8192995: run-test gtest should use all jvm variants, not just "server"
Reviewed-by: erikj
1 parent 41f18f0 commit 799fbf2

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

doc/testing.html

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ <h3 id="jtreg">JTReg</h3>
5757
<h3 id="gtest">Gtest</h3>
5858
<p>Since the Hotspot Gtest suite is so quick, the default is to run all tests. This is specified by just <code>gtest</code>, or as a fully qualified test descriptor <code>gtest:all</code>.</p>
5959
<p>If you want, you can single out an individual test or a group of tests, for instance <code>gtest:LogDecorations</code> or <code>gtest:LogDecorations.level_test_vm</code>. This can be particularly useful if you want to run a shaky test repeatedly.</p>
60+
<p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/&lt;variant&gt;</code> to the test descriptor, e.g. <code>gtest:Log/client</code>. If you specify no variant, gtest will run once for each JVM variant present (e.g. server, client). So if you only have the server JVM present, then <code>gtest:all</code> will be equivalent to <code>gtest:all/server</code>.</p>
6061
<h2 id="test-results-and-summary">Test results and summary</h2>
6162
<p>At the end of the test run, a summary of all tests run will be presented. This will have a consistent look, regardless of what test suites were used. This is a sample summary:</p>
6263
<pre><code>==============================

doc/testing.md

+6
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ If you want, you can single out an individual test or a group of tests, for
8181
instance `gtest:LogDecorations` or `gtest:LogDecorations.level_test_vm`. This
8282
can be particularly useful if you want to run a shaky test repeatedly.
8383

84+
For Gtest, there is a separate test suite for each JVM variant. The JVM variant
85+
is defined by adding `/<variant>` to the test descriptor, e.g.
86+
`gtest:Log/client`. If you specify no variant, gtest will run once for each JVM
87+
variant present (e.g. server, client). So if you only have the server JVM
88+
present, then `gtest:all` will be equivalent to `gtest:all/server`.
89+
8490
## Test results and summary
8591

8692
At the end of the test run, a summary of all tests run will be presented. This

make/RunTests.gmk

+22-7
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
8888
-timeoutHandlerTimeout:0
8989
endif
9090

91+
GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
92+
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
93+
9194
################################################################################
9295
# Parse control variables
9396
################################################################################
@@ -166,16 +169,23 @@ hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
166169
# Helper function to determine if a test specification is a Gtest test
167170
#
168171
# It is a Gtest test if it is either "gtest", or "gtest:" followed by an optional
169-
# test filter string.
172+
# test filter string, and an optional "/<variant>" to select a specific JVM
173+
# variant. If no variant is specified, all found variants are tested.
170174
define ParseGtestTestSelection
171175
$(if $(filter gtest%, $1), \
172176
$(if $(filter gtest, $1), \
173-
gtest:all \
177+
$(addprefix gtest:all/, $(GTEST_VARIANTS)) \
174178
, \
175-
$(if $(filter gtest:, $1), \
176-
gtest:all \
179+
$(if $(strip $(or $(filter gtest/%, $1) $(filter gtest:/%, $1))), \
180+
$(patsubst gtest:/%, gtest:all/%, $(patsubst gtest/%, gtest:/%, $1)) \
177181
, \
178-
$1 \
182+
$(if $(filter gtest:%, $1), \
183+
$(if $(findstring /, $1), \
184+
$1 \
185+
, \
186+
$(addprefix $1/, $(GTEST_VARIANTS)) \
187+
) \
188+
) \
179189
) \
180190
) \
181191
)
@@ -320,7 +330,12 @@ define SetupRunGtestTestBody
320330
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
321331
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
322332

323-
$1_TEST_NAME := $$(strip $$(patsubst gtest:%, %, $$($1_TEST)))
333+
$1_VARIANT := $$(lastword $$(subst /, , $$($1_TEST)))
334+
ifeq ($$(filter $$($1_VARIANT), $$(GTEST_VARIANTS)), )
335+
$$(error Invalid gtest variant '$$($1_VARIANT)'. Valid variants: $$(GTEST_VARIANTS))
336+
endif
337+
$1_TEST_NAME := $$(strip $$(patsubst %/$$($1_VARIANT), %, \
338+
$$(patsubst gtest:%, %, $$($1_TEST))))
324339
ifneq ($$($1_TEST_NAME), all)
325340
$1_GTEST_FILTER := --gtest_filter=$$($1_TEST_NAME)*
326341
endif
@@ -334,7 +349,7 @@ define SetupRunGtestTestBody
334349
$$(call LogWarn, Running test '$$($1_TEST)')
335350
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
336351
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
337-
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/server/gtestLauncher \
352+
$$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
338353
-jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
339354
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
340355
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \

0 commit comments

Comments
 (0)