Skip to content

Commit

Permalink
8192995: run-test gtest should use all jvm variants, not just "server"
Browse files Browse the repository at this point in the history
Reviewed-by: erikj
  • Loading branch information
ihse committed Dec 4, 2017
1 parent cada667 commit bf6aead
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
1 change: 1 addition & 0 deletions doc/testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ <h3 id="jtreg">JTReg</h3>
<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>/&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>
<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>==============================
Expand Down
6 changes: 6 additions & 0 deletions doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ If you want, you can single out an individual test or a group of tests, for
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
Expand Down
29 changes: 22 additions & 7 deletions make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
-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
################################################################################
Expand Down Expand Up @@ -166,16 +169,23 @@ hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
# 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)) \
) \
) \
) \
) \
)
Expand Down Expand Up @@ -320,7 +330,12 @@ define SetupRunGtestTestBody
$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
Expand All @@ -334,7 +349,7 @@ define SetupRunGtestTestBody
$$(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) \
Expand Down

0 comments on commit bf6aead

Please sign in to comment.