8180651: Make target to run tests on exploded image
authorerikj
Mon, 29 May 2017 14:06:24 +0200
changeset 45266 29347d0c7122
parent 45265 7886ba22a592
child 45267 a08485a70636
child 46223 ec5c9ca9692b
8180651: Make target to run tests on exploded image Reviewed-by: ihse
common/doc/testing.html
common/doc/testing.md
make/Help.gmk
make/Main.gmk
--- a/common/doc/testing.html	Fri May 26 01:00:32 2017 +0000
+++ b/common/doc/testing.html	Mon May 29 14:06:24 2017 +0200
@@ -29,13 +29,15 @@
 </div>
 <h2 id="using-the-run-test-framework">Using the run-test framework</h2>
 <p>This new way of running tests is developer-centric. It assumes that you have built a jdk locally and want to test it. Running common test targets is simple, and more complex ad-hoc combination of tests is possible. The user interface is forgiving, and clearly report errors it cannot resolve.</p>
+<p>The main target &quot;run-test&quot; uses the jdk-image as the tested product. There is also an alternate target &quot;exploded-run-test&quot; that uses the exploded image instead. Not all tests will run successfully on the exploded image, but using this target can greatly improve rebuild times for certain workflows.</p>
 <p>Some example command-lines:</p>
 <pre><code>$ make run-test-tier1
 $ make run-test-jdk_lang JTREG=&quot;JOBS=8&quot;
 $ make run-test TEST=jdk_lang
 $ make run-test-only TEST=&quot;gtest:LogTagSet gtest:LogTagSetDescriptions&quot; GTEST=&quot;REPEAT=-1&quot;
 $ make run-test TEST=&quot;hotspot/test:hotspot_gc&quot; JTREG=&quot;JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug&quot;
-$ make run-test TEST=&quot;jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java&quot;</code></pre>
+$ make run-test TEST=&quot;jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java&quot;
+$ make exploded-run-test TEST=hotspot_tier1</code></pre>
 <h2 id="test-selection">Test selection</h2>
 <p>All functionality is available using the run-test make target. In this use case, the test or tests to be executed is controlled using the <code>TEST</code> variable. To speed up subsequent test runs with no source code changes, run-test-only can be used instead, which do not depend on the source and test image build.</p>
 <p>For some common top-level tests, direct make targets have been generated. This includes all JTreg test groups, the hotspot gtest, and custom tests (if present). This means that <code>make run-test-tier1</code> is equivalent to <code>make run-test TEST=&quot;tier1&quot;</code>, but the latter is more tab-completion friendly. For more complex test runs, the <code>run-test TEST=&quot;x&quot;</code> solution needs to be used.</p>
--- a/common/doc/testing.md	Fri May 26 01:00:32 2017 +0000
+++ b/common/doc/testing.md	Mon May 29 14:06:24 2017 +0200
@@ -7,6 +7,11 @@
 and more complex ad-hoc combination of tests is possible. The user interface is
 forgiving, and clearly report errors it cannot resolve.
 
+The main target "run-test" uses the jdk-image as the tested product. There is
+also an alternate target "exploded-run-test" that uses the exploded image
+instead. Not all tests will run successfully on the exploded image, but using
+this target can greatly improve rebuild times for certain workflows.
+
 Some example command-lines:
 
     $ make run-test-tier1
@@ -15,6 +20,7 @@
     $ make run-test-only TEST="gtest:LogTagSet gtest:LogTagSetDescriptions" GTEST="REPEAT=-1"
     $ make run-test TEST="hotspot/test:hotspot_gc" JTREG="JOBS=1;TIMEOUT=8;VM_OTIONS=-XshowSettings -Xlog:gc+ref=debug"
     $ make run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java"
+    $ make exploded-run-test TEST=hotspot_tier1
 
 ## Test selection
 
--- a/make/Help.gmk	Fri May 26 01:00:32 2017 +0000
+++ b/make/Help.gmk	Mon May 29 14:06:24 2017 +0200
@@ -56,6 +56,8 @@
 	$(info $(_) make test              # Run tests, default is all tests (see TEST below))
 	$(info $(_) make run-test-<test>   # Run test, e.g. run-test-tier1)
 	$(info $(_) make run-test TEST=<t> # Run test(s) given by TEST specification)
+	$(info $(_) make exploded-run-test TEST=<t> # Run test(s) on the exploded image instead of)
+	$(info $(_)                        # the full jdk image)
 	$(info )
 	$(info Targets for cleaning)
 	$(info $(_) make clean             # Remove all files generated by make, but not those)
--- a/make/Main.gmk	Fri May 26 01:00:32 2017 +0000
+++ b/make/Main.gmk	Mon May 29 14:06:24 2017 +0200
@@ -450,13 +450,18 @@
   run-test-$1:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$1")
 
+  exploded-run-test-$1:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
+	    TEST="$1" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
+
 endef
 
 # ALL_NAMED_TESTS is defined in FindTests.gmk
 $(foreach t, $(ALL_NAMED_TESTS), $(eval $(call DeclareRunTestRecipe,$t)))
 ALL_TEST_TARGETS := $(addprefix run-test-, $(ALL_NAMED_TESTS))
+ALL_EXPLODED_TEST_TARGETS := $(addprefix exploded-run-test-, $(ALL_NAMED_TESTS))
 
-ALL_TARGETS += $(ALL_TEST_TARGETS)
+ALL_TARGETS += $(ALL_TEST_TARGETS) $(ALL_EXPLODED_TEST_TARGETS)
 
 ################################################################################
 # Build tests
@@ -485,6 +490,10 @@
 run-test:
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
 
+exploded-run-test:
+	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test \
+	    TEST="$(TEST)" JDK_IMAGE_DIR=$(JDK_OUTPUTDIR))
+
 ifeq ($(BUILD_GTEST), true)
   test-image-hotspot-gtest:
 	+($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk)
@@ -514,7 +523,7 @@
     test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
     test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
     test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
-    run-test
+    run-test exploded-run-test
 
 ################################################################################
 # Run tests
@@ -807,9 +816,11 @@
   test: jdk-image test-image
 
   run-test: jdk-image test-image
+  exploded-run-test: exploded-image test-image
 
   # Declare dependency for all generated test targets
   $(foreach t, $(ALL_TEST_TARGETS), $(eval $t: jdk-image test-image))
+  $(foreach t, $(ALL_EXPLODED_TEST_TARGETS), $(eval $t: exploded-image test-image))
 
   create-buildjdk-copy: jdk.jlink-java java.base-gendata \
       $(addsuffix -java, $(INTERIM_IMAGE_MODULES))