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
--- 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; \