8197906: Enable CDS mode execution of jtreg tests via make
authormseledtsov
Thu, 15 Feb 2018 13:37:50 -0800
changeset 48980 ab7784555b4c
parent 48979 514c73a1955b
child 48981 19ebb2d56766
8197906: Enable CDS mode execution of jtreg tests via make Summary: changed make file to add this functionality Reviewed-by: iignatyev, ihse Contributed-by: erik.joelsson@oracle.com
test/TestCommon.gmk
--- a/test/TestCommon.gmk	Wed Feb 14 07:08:25 2018 -0800
+++ b/test/TestCommon.gmk	Thu Feb 15 13:37:50 2018 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -173,6 +173,20 @@
   endif
 endif
 
+
+# Optionally create a CDS archive before running tests
+ifeq ($(GENERATE_CDS_ARCHIVE), true)
+  CDS_ARCHIVE_FILE := $(ABS_TEST_OUTPUT_DIR)/cds_archive.jsa
+
+  $(CDS_ARCHIVE_FILE): $(PRODUCT_HOME)
+	$(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \
+	    -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)") -Xshare:dump
+
+  CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)")
+  JTREG_TEST_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
+  TEST_PREREQS += $(CDS_ARCHIVE_FILE)
+endif
+
 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
 ifdef JPRT_ARCHIVE_BUNDLE
   ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
@@ -444,7 +458,7 @@
 PHONY_LIST += jtreg_exists
 
 # Run jtreg
-jtreg_tests: prep jtreg_exists $(PRODUCT_HOME)
+jtreg_tests: prep jtreg_exists $(PRODUCT_HOME) $(TEST_PREREQS)
 	(                                                                    \
 	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
 	    export JT_HOME;                                                  \