8192995: run-test gtest should use all jvm variants, not just "server"
Reviewed-by: erikj
--- a/doc/testing.html Mon Dec 04 19:12:57 2017 +0100
+++ b/doc/testing.html Mon Dec 04 19:49:01 2017 +0100
@@ -57,6 +57,7 @@
<h3 id="gtest">Gtest</h3>
<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>
<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>
+<p>For Gtest, there is a separate test suite for each JVM variant. The JVM variant is defined by adding <code>/<variant></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>
<h2 id="test-results-and-summary">Test results and summary</h2>
<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>
<pre><code>==============================
--- a/doc/testing.md Mon Dec 04 19:12:57 2017 +0100
+++ b/doc/testing.md Mon Dec 04 19:49:01 2017 +0100
@@ -81,6 +81,12 @@
instance `gtest:LogDecorations` or `gtest:LogDecorations.level_test_vm`. This
can be particularly useful if you want to run a shaky test repeatedly.
+For Gtest, there is a separate test suite for each JVM variant. The JVM variant
+is defined by adding `/<variant>` to the test descriptor, e.g.
+`gtest:Log/client`. 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 `gtest:all` will be equivalent to `gtest:all/server`.
+
## Test results and summary
At the end of the test run, a summary of all tests run will be presented. This
--- a/make/RunTests.gmk Mon Dec 04 19:12:57 2017 +0100
+++ b/make/RunTests.gmk Mon Dec 04 19:49:01 2017 +0100
@@ -88,6 +88,9 @@
-timeoutHandlerTimeout:0
endif
+GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
+GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
+
################################################################################
# Parse control variables
################################################################################
@@ -166,16 +169,23 @@
# Helper function to determine if a test specification is a Gtest test
#
# It is a Gtest test if it is either "gtest", or "gtest:" followed by an optional
-# test filter string.
+# test filter string, and an optional "/<variant>" to select a specific JVM
+# variant. If no variant is specified, all found variants are tested.
define ParseGtestTestSelection
$(if $(filter gtest%, $1), \
$(if $(filter gtest, $1), \
- gtest:all \
+ $(addprefix gtest:all/, $(GTEST_VARIANTS)) \
, \
- $(if $(filter gtest:, $1), \
- gtest:all \
+ $(if $(strip $(or $(filter gtest/%, $1) $(filter gtest:/%, $1))), \
+ $(patsubst gtest:/%, gtest:all/%, $(patsubst gtest/%, gtest:/%, $1)) \
, \
- $1 \
+ $(if $(filter gtest:%, $1), \
+ $(if $(findstring /, $1), \
+ $1 \
+ , \
+ $(addprefix $1/, $(GTEST_VARIANTS)) \
+ ) \
+ ) \
) \
) \
)
@@ -320,7 +330,12 @@
$1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
$1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
- $1_TEST_NAME := $$(strip $$(patsubst gtest:%, %, $$($1_TEST)))
+ $1_VARIANT := $$(lastword $$(subst /, , $$($1_TEST)))
+ ifeq ($$(filter $$($1_VARIANT), $$(GTEST_VARIANTS)), )
+ $$(error Invalid gtest variant '$$($1_VARIANT)'. Valid variants: $$(GTEST_VARIANTS))
+ endif
+ $1_TEST_NAME := $$(strip $$(patsubst %/$$($1_VARIANT), %, \
+ $$(patsubst gtest:%, %, $$($1_TEST))))
ifneq ($$($1_TEST_NAME), all)
$1_GTEST_FILTER := --gtest_filter=$$($1_TEST_NAME)*
endif
@@ -334,7 +349,7 @@
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
- $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/server/gtestLauncher \
+ $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
-jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
--gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
$$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \