# HG changeset patch # User duke # Date 1499290343 -7200 # Node ID bafbb2256ce9135804f99a03d4260bec921453ef # Parent 4644ed4e32921aa3eebc8a0817a2fcc2bfb48f69# Parent 81a039ba934442c150d914f258e635aff3b8188c Merge diff -r 4644ed4e3292 -r bafbb2256ce9 .hgtags-top-repo --- a/.hgtags-top-repo Wed May 31 17:45:57 2017 +0000 +++ b/.hgtags-top-repo Wed Jul 05 23:32:23 2017 +0200 @@ -420,6 +420,7 @@ 03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6 b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169 4d163ec59d989a9261ed7f848bc6303f90869af5 jdk-9+170 - aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7 df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8 +b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9 +4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171 diff -r 4644ed4e3292 -r bafbb2256ce9 common/autoconf/spec.gmk.in --- a/common/autoconf/spec.gmk.in Wed May 31 17:45:57 2017 +0000 +++ b/common/autoconf/spec.gmk.in Wed Jul 05 23:32:23 2017 +0200 @@ -651,7 +651,7 @@ MV:=@MV@ NAWK:=@NAWK@ NICE:=@NICE@ -PANDOC:=@PANDOC@ +PANDOC:=@FIXPATH@ @PANDOC@ PATCH:=@PATCH@ PRINTF:=@PRINTF@ RM:=@RM@ diff -r 4644ed4e3292 -r bafbb2256ce9 common/doc/building.html --- a/common/doc/building.html Wed May 31 17:45:57 2017 +0000 +++ b/common/doc/building.html Wed Jul 05 23:32:23 2017 +0200 @@ -1,21 +1,23 @@ - - + + - - - + + + OpenJDK Build README - + + - -
-OpenJDK -

OpenJDK

-
+ +
+OpenJDK
OpenJDK
+

Introduction

This README file contains build instructions for the OpenJDK. Building the source code for the OpenJDK requires a certain degree of technical expertise.

@@ -149,50 +151,50 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
PackageVersionPackageVersion
developer/solarisstudio-124/backend12.4-1.0.6.0developer/solarisstudio-124/backend12.4-1.0.6.0
developer/solarisstudio-124/c++12.4-1.0.10.0developer/solarisstudio-124/c++12.4-1.0.10.0
developer/solarisstudio-124/cc12.4-1.0.4.0developer/solarisstudio-124/cc12.4-1.0.4.0
developer/solarisstudio-124/library/c++-libs12.4-1.0.10.0developer/solarisstudio-124/library/c++-libs12.4-1.0.10.0
developer/solarisstudio-124/library/math-libs12.4-1.0.0.1developer/solarisstudio-124/library/math-libs12.4-1.0.0.1
developer/solarisstudio-124/library/studio-gccrt12.4-1.0.0.1developer/solarisstudio-124/library/studio-gccrt12.4-1.0.0.1
developer/solarisstudio-124/studio-common12.4-1.0.0.1developer/solarisstudio-124/studio-common12.4-1.0.0.1
developer/solarisstudio-124/studio-ja12.4-1.0.0.1developer/solarisstudio-124/studio-ja12.4-1.0.0.1
developer/solarisstudio-124/studio-legal12.4-1.0.0.1developer/solarisstudio-124/studio-legal12.4-1.0.0.1
developer/solarisstudio-124/studio-zhCN12.4-1.0.0.1developer/solarisstudio-124/studio-zhCN12.4-1.0.0.1
@@ -211,66 +213,66 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + +
Binary NameCategoryPackageDescriptionBinary NameCategoryPackageDescription
ar.exeDevelbinutilsThe GNU assembler, linker and binary utilitiesar.exeDevelbinutilsThe GNU assembler, linker and binary utilities
make.exeDevelmakeThe GNU version of the 'make' utility built for CYGWINmake.exeDevelmakeThe GNU version of the 'make' utility built for CYGWIN
m4.exeInterpretersm4GNU implementation of the traditional Unix macro processorm4.exeInterpretersm4GNU implementation of the traditional Unix macro processor
cpio.exeUtilscpioA program to manage archives of filescpio.exeUtilscpioA program to manage archives of files
gawk.exeUtilsawkPattern-directed scanning and processing languagegawk.exeUtilsawkPattern-directed scanning and processing language
file.exeUtilsfileDetermines file type using 'magic' numbersfile.exeUtilsfileDetermines file type using 'magic' numbers
zip.exeArchivezipPackage and compress (archive) fileszip.exeArchivezipPackage and compress (archive) files
unzip.exeArchiveunzipExtract compressed files in a ZIP archiveunzip.exeArchiveunzipExtract compressed files in a ZIP archive
free.exeSystemprocpsDisplay amount of free and used memory in the systemfree.exeSystemprocpsDisplay amount of free and used memory in the system
@@ -561,14 +563,14 @@ This is probably an issue with SELinux (See SELinux on Wikipedia). Parts of the VM is built without the -fPIC for performance reasons.

To completely disable SELinux:

-
    +
    1. $ su root
    2. # system-config-securitylevel
    3. In the window that appears, select the SELinux tab
    4. Disable SELinux

    Alternatively, instead of completely disabling it you could disable just this one check.

    -
      +
      1. Select System->Administration->SELinux Management
      2. In the SELinux Management Tool which appears, select "Boolean" from the menu on the left
      3. Expand the "Memory Protection" group
      4. @@ -616,62 +618,62 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + +
        Base OS and ArchitectureOSC/C++ CompilerProcessorsRAM MinimumDISK NeedsBase OS and ArchitectureOSC/C++ CompilerProcessorsRAM MinimumDISK Needs
        Linux X86 (32-bit) and X64 (64-bit)Oracle Enterprise Linux 6.4gcc 4.9.22 or more1 GB6 GBLinux X86 (32-bit) and X64 (64-bit)Oracle Enterprise Linux 6.4gcc 4.9.22 or more1 GB6 GB
        Solaris SPARCV9 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patches4 or more4 GB8 GBSolaris SPARCV9 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patches4 or more4 GB8 GB
        Solaris X64 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patches4 or more4 GB8 GBSolaris X64 (64-bit)Solaris 11 Update 1Studio 12 Update 4 + patches4 or more4 GB8 GB
        Windows X86 (32-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional Edition2 or more2 GB6 GBWindows X86 (32-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional Edition2 or more2 GB6 GB
        Windows X64 (64-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional Edition2 or more2 GB6 GBWindows X64 (64-bit)Windows Server 2012 R2 x64Microsoft Visual Studio C++ 2013 Professional Edition2 or more2 GB6 GB
        Mac OS X X64 (64-bit)Mac OS X 10.9 "Mavericks"Xcode 6.3 or newer2 or more4 GB6 GBMac OS X X64 (64-bit)Mac OS X 10.9 "Mavericks"Xcode 6.3 or newer2 or more4 GB6 GB
        diff -r 4644ed4e3292 -r bafbb2256ce9 common/doc/testing.html --- a/common/doc/testing.html Wed May 31 17:45:57 2017 +0000 +++ b/common/doc/testing.html Wed Jul 05 23:32:23 2017 +0200 @@ -1,19 +1,22 @@ - - + + - - - + + + Testing OpenJDK - + + - - +

        Using the run-test framework

        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.

        +

        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
         $ make run-test-jdk_lang JTREG="JOBS=8"
         $ make run-test TEST=jdk_lang
         $ 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 run-test TEST="jtreg:hotspot/test:hotspot_gc hotspot/test/native_sanity/JniVersion.java" +$ make exploded-run-test TEST=hotspot_tier1

        Test selection

        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 TEST 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.

        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 make run-test-tier1 is equivalent to make run-test TEST="tier1", but the latter is more tab-completion friendly. For more complex test runs, the run-test TEST="x" solution needs to be used.

        diff -r 4644ed4e3292 -r bafbb2256ce9 common/doc/testing.md --- a/common/doc/testing.md Wed May 31 17:45:57 2017 +0000 +++ b/common/doc/testing.md Wed Jul 05 23:32:23 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 diff -r 4644ed4e3292 -r bafbb2256ce9 make/CompileJavaModules.gmk --- a/make/CompileJavaModules.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/CompileJavaModules.gmk Wed Jul 05 23:32:23 2017 +0200 @@ -42,7 +42,8 @@ ################################################################################ -java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline +java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline \ + --doclint-format html4 java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties java.base_CLEAN := intrinsic.properties @@ -95,7 +96,8 @@ ################################################################################ java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \ - '-Xdoclint/package:java.*,javax.*' -Xlint:exports + '-Xdoclint/package:java.*,javax.*' -Xlint:exports \ + --doclint-format html4 java.desktop_COPY := .gif .png .wav .txt .xml .css .pf java.desktop_CLEAN := iio-plugin.properties cursors.properties diff -r 4644ed4e3292 -r bafbb2256ce9 make/Docs.gmk --- a/make/Docs.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/Docs.gmk Wed Jul 05 23:32:23 2017 +0200 @@ -55,7 +55,6 @@ LICENSE_URL := http://www.oracle.com/technetwork/java/javase/terms/license/java9speclicense.html REDISTRIBUTION_URL := http://www.oracle.com/technetwork/java/redist-137594.html - # In order to get a specific ordering it's necessary to specify the total # ordering of tags as the tags are otherwise ordered in order of definition. JAVADOC_TAGS := \ @@ -163,7 +162,7 @@ ################################################################################ -JDK_DOCS_INDEX_HTML_TITLE := Java™ Platform, Standard Edition Development Kit \ +JDK_INDEX_TITLE := Java™ Platform, Standard Edition Development Kit \ (JDK™) $(VERSION_SPECIFICATION) Specification
        $(DRAFT_MARKER_TITLE) ################################################################################ @@ -211,10 +210,10 @@ SetupApiDocsGeneration = $(NamedParamsMacroTemplate) define SetupApiDocsGenerationBody - # Figure out all modules, both specified and transitive, that will be processed - # by javadoc. - $1_TRANSITIVE_MODULES := $$(call FindTransitiveDepsForModules, $$($1_MODULES)) - $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_TRANSITIVE_MODULES)) + # Figure out all modules, both specified and transitive indirect exports, that + # will be processed by javadoc. + $1_INDIRECT_EXPORTS := $$(call FindTransitiveIndirectDepsForModules, $$($1_MODULES)) + $1_ALL_MODULES := $$(sort $$($1_MODULES) $$($1_INDIRECT_EXPORTS)) ifeq ($$(ENABLE_FULL_DOCS), true) # Tell the ModuleGraph taglet to generate html links to soon-to-be-created @@ -334,7 +333,8 @@ ################################################################################ # Setup generation of the Java SE API documentation (javadoc + modulegraph) -# The Java SE module scope is just java.se.ee and it's transitive modules. +# The Java SE module scope is just java.se.ee and it's transitive indirect +# exports. JAVASE_JAVADOC_MODULES := java.se.ee JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html @@ -356,15 +356,27 @@ ################################################################################ -JDK_DOCS_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html +JDK_INDEX_HTML := $(DOCS_OUTPUTDIR)/index.html +JDK_INDEX_TOOLS_DIR := $(TOOLS_CLASSES_DIR)/build/tools/docs -$(JDK_DOCS_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) +$(JDK_INDEX_HTML): $(BUILD_JIGSAW_TOOLS) \ + $(JDK_INDEX_TOOLS_DIR)/docs-bundle-page.html \ + $(JDK_INDEX_TOOLS_DIR)/docs-module-groups.properties $(call LogInfo, Generating docs bundle index page) $(MKDIR) -p $(@D) - $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_DOCS_INDEX_HTML_TITLE)' \ + $(TOOL_GEN_DOCS_BUNDLE_PAGE) --title '$(JDK_INDEX_TITLE)' \ --output $@ -JDK_DOCS_INDEX_HTML_TARGETS := $(JDK_DOCS_INDEX_HTML) +JDK_INDEX_TARGETS := $(JDK_INDEX_HTML) + +# Copy the global resources +GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/ +$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \ + SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \ + FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \ + DEST := $(DOCS_OUTPUTDIR), \ +)) +JDK_INDEX_TARGETS += $(COPY_GLOBAL_RESOURCES) ################################################################################ # Copy JDK specs files @@ -389,20 +401,11 @@ ) \ ) -# Copy the global resources -GLOBAL_SPECS_RESOURCES_DIR := $(JDK_TOPDIR)/make/data/docs-resources/specs -$(eval $(call SetupCopyFiles, COPY_GLOBAL_RESOURCES, \ - SRC := $(GLOBAL_SPECS_RESOURCES_DIR), \ - FILES := $(call CacheFind, $(GLOBAL_SPECS_RESOURCES_DIR)), \ - DEST := $(DOCS_OUTPUTDIR)/specs/, \ -)) -JDK_SPECS_TARGETS += $(COPY_GLOBAL_RESOURCES) - ifeq ($(ENABLE_FULL_DOCS), true) # For all markdown files in $module/share/specs directories, convert them to # html. - GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/specs/resources/jdk-default.css + GLOBAL_SPECS_DEFAULT_CSS_FILE := $(DOCS_OUTPUTDIR)/resources/jdk-default.css $(foreach m, $(ALL_MODULES), \ $(eval SPECS_$m := $(call FindModuleSpecsDirs, $m)) \ @@ -464,7 +467,7 @@ docs-jdk-specs: $(JDK_SPECS_TARGETS) -docs-jdk-index: $(JDK_DOCS_INDEX_HTML_TARGETS) +docs-jdk-index: $(JDK_INDEX_TARGETS) docs-zip: $(ZIP_TARGETS) diff -r 4644ed4e3292 -r bafbb2256ce9 make/Help.gmk --- a/make/Help.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/Help.gmk Wed Jul 05 23:32:23 2017 +0200 @@ -56,6 +56,8 @@ $(info $(_) make test # Run tests, default is all tests (see TEST below)) $(info $(_) make run-test- # Run test, e.g. run-test-tier1) $(info $(_) make run-test TEST= # Run test(s) given by TEST specification) + $(info $(_) make exploded-run-test TEST= # 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) diff -r 4644ed4e3292 -r bafbb2256ce9 make/Main.gmk --- a/make/Main.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/Main.gmk Wed Jul 05 23:32:23 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 @@ -798,7 +807,8 @@ docs-javase-api-modulegraph: exploded-image buildtools-modules # The gensrc steps for hotspot and jdk.jdi create html spec files. - docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc + docs-jdk-specs: hotspot-$(JVM_VARIANT_MAIN)-gensrc jdk.jdi-gensrc \ + docs-jdk-index docs-jdk-index: exploded-image buildtools-modules @@ -807,9 +817,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)) diff -r 4644ed4e3292 -r bafbb2256ce9 make/common/Modules.gmk --- a/make/common/Modules.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/common/Modules.gmk Wed Jul 05 23:32:23 2017 +0200 @@ -151,6 +151,7 @@ jdk.crypto.ec \ jdk.dynalink \ jdk.editpad \ + jdk.hotspot.agent \ jdk.httpserver \ jdk.incubator.httpclient \ jdk.jartool \ @@ -298,7 +299,8 @@ $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /*/$(sub), $(TOP_SRC_DIRS)))) ################################################################################ -# Extract module dependencies from module-info.java files. +# Extract module dependencies from module-info.java files, both normal +# dependencies ("requires"), and indirect exports ("requires transitive"). MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk @@ -320,17 +322,31 @@ gsub(/^ +\*.*/, ""); \ gsub(/ /, ""); \ printf(" %s", $$0) } \ + END { printf("\n") }' $m && \ + $(PRINTF) "TRANSITIVE_MODULES_$(call GetModuleNameFromModuleInfo, $m) :=" && \ + $(NAWK) -v MODULE=$(call GetModuleNameFromModuleInfo, $m) '\ + BEGIN { if (MODULE != "java.base") printf(" java.base"); } \ + /^ *requires *transitive/ { \ + sub(/;/, ""); \ + sub(/requires/, ""); \ + sub(/transitive/, ""); \ + sub(/\/\/.*/, ""); \ + sub(/\/\*.*\*\//, ""); \ + gsub(/^ +\*.*/, ""); \ + gsub(/ /, ""); \ + printf(" %s", $$0) } \ END { printf("\n") }' $m \ ) >> $@ $(NEWLINE)) -include $(MODULE_DEPS_MAKEFILE) -# Param 1: Module to find deps for +# Find dependencies ("requires") for a given module. +# Param 1: Module to find dependencies for. FindDepsForModule = \ $(DEPS_$(strip $1)) -# Finds transitive dependencies in 3 levels. -# Param 1: Module to find transitive deps for +# Find dependencies ("requires") transitively in 3 levels for a given module. +# Param 1: Module to find dependencies for. FindTransitiveDepsForModule = \ $(sort $(call FindDepsForModule, $1) \ $(foreach m, $(call FindDepsForModule, $1), \ @@ -338,11 +354,30 @@ $(foreach n, $(call FindDepsForModule, $m), \ $(call FindDepsForModule, $n)))) -# Finds transitive dependencies in 3 levels for a set of modules. -# Param 1: List of modules to find transitive deps for +# Find dependencies ("requires") transitively in 3 levels for a set of modules. +# Param 1: List of modules to find dependencies for. FindTransitiveDepsForModules = \ $(sort $(foreach m, $1, $(call FindTransitiveDepsForModule, $m))) +# Find indirect exported modules ("requires transitive") for a given module . +# Param 1: Module to find indirect exported modules for. +FindIndirectExportsForModule = \ + $(TRANSITIVE_MODULES_$(strip $1)) + +# Finds indirect exported modules transitively in 3 levels for a given module. +# Param 1: Module to find indirect exported modules for. +FindTransitiveIndirectDepsForModule = \ + $(sort $(call FindIndirectExportsForModule, $1) \ + $(foreach m, $(call FindIndirectExportsForModule, $1), \ + $(call FindIndirectExportsForModule, $m) \ + $(foreach n, $(call FindIndirectExportsForModule, $m), \ + $(call FindIndirectExportsForModule, $n)))) + +# Finds indirect exported modules transitively in 3 levels for a set of modules. +# Param 1: List of modules to find indirect exported modules for. +FindTransitiveIndirectDepsForModules = \ + $(sort $(foreach m, $1, $(call FindTransitiveIndirectDepsForModule, $m))) + # Upgradeable modules are those that are either defined as upgradeable or that # require an upradeable module. FindAllUpgradeableModules = \ diff -r 4644ed4e3292 -r bafbb2256ce9 make/common/ProcessMarkdown.gmk --- a/make/common/ProcessMarkdown.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/common/ProcessMarkdown.gmk Wed Jul 05 23:32:23 2017 +0200 @@ -36,7 +36,7 @@ ifneq ($$(findstring http:/, $$($1_CSS)), ) $1_$2_CSS_OPTION := --css '$$($1_CSS)' else - $1_$2_CSS := $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)) + $1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR))) $1_$2_CSS_OPTION := --css '$$($1_$2_CSS)' endif endif @@ -51,7 +51,7 @@ $$(call LogInfo, Converting $2 to html) $$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown) $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \ - $$(PANDOC) $$($1_OPTIONS) -f markdown -t html --standalone \ + $$(PANDOC) $$($1_OPTIONS) -f markdown -t html5 --standalone \ $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@') ifneq ($$(findstring $$(LOG_LEVEL), debug trace),) TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \ diff -r 4644ed4e3292 -r bafbb2256ce9 make/common/SetupJavaCompilers.gmk --- a/make/common/SetupJavaCompilers.gmk Wed May 31 17:45:57 2017 +0000 +++ b/make/common/SetupJavaCompilers.gmk Wed Jul 05 23:32:23 2017 +0200 @@ -69,7 +69,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \ JVM := $(JAVA_JAVAC), \ JAVAC := $(NEW_JAVAC), \ - FLAGS := -source 10 -target 10 \ + FLAGS := -source 10 -target 10 --doclint-format html5 \ -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \ SERVER_DIR := $(SJAVAC_SERVER_DIR), \ SERVER_JVM := $(SJAVAC_SERVER_JAVA))) diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/InfiniteLoop.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/jdk/test/lib/InfiniteLoop.java Wed Jul 05 23:32:23 2017 +0200 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2014, 2016, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib; + +import java.util.Objects; + +/** + * Class which runs another Runnable in infinite loop with certain pauses + * between cycles. + */ +public class InfiniteLoop implements Runnable { + private final Runnable target; + private final long mills; + + + /** + * @param target a target to run in a loop + * @param mills the length of pause time in milliseconds + * @throws NullPointerException if target is null + * @throws IllegalArgumentException if the value of millis is negative + */ + public InfiniteLoop(Runnable target, long mills) { + Objects.requireNonNull(target); + if (mills < 0) { + throw new IllegalArgumentException("mills < 0"); + } + this.target = target; + this.mills = mills; + } + + @Override + public void run() { + try { + while (true) { + target.run(); + if (mills > 0) { + Thread.sleep(mills); + } + } + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new Error(e); + } + } +} diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/RandomFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/jdk/test/lib/RandomFactory.java Wed Jul 05 23:32:23 2017 +0200 @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2015, 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib; + +import java.util.Random; +import java.util.SplittableRandom; + +/** + * Factory class which generates and prints to STDOUT a long-valued seed + * for use in initializing a PRNG. An instance of {@code Random} or + * {@code SplittableRandom} may likewise be obtained. + */ +public class RandomFactory { + /** + * Attempt to obtain the seed from the value of the "seed" property. + * @return The seed or {@code null} if the "seed" property was not set or + * could not be parsed. + */ + private static Long getSystemSeed() { + Long seed = null; + try { + // note that Long.valueOf(null) also throws a + // NumberFormatException so if the property is undefined this + // will still work correctly + seed = Long.valueOf(System.getProperty("seed")); + } catch (NumberFormatException e) { + // do nothing: seed is still null + } + + return seed; + } + + /** + * Obtain a seed from an independent PRNG. + * + * @return A random seed. + */ + private static long getRandomSeed() { + return new Random().nextLong(); + } + + /** + * Obtain and print to STDOUT a seed appropriate for initializing a PRNG. + * If the system property "seed" is set and has value which may be correctly + * parsed it is used, otherwise a seed is generated using an independent + * PRNG. + * + * @return The seed. + */ + public static long getSeed() { + Long seed = getSystemSeed(); + if (seed == null) { + seed = getRandomSeed(); + } + System.out.println("Seed from RandomFactory = "+seed+"L"); + return seed; + } + + /** + * Obtain and print to STDOUT a seed and use it to initialize a new + * {@code Random} instance which is returned. If the system + * property "seed" is set and has value which may be correctly parsed it + * is used, otherwise a seed is generated using an independent PRNG. + * + * @return The {@code Random} instance. + */ + public static Random getRandom() { + return new Random(getSeed()); + } + + /** + * Obtain and print to STDOUT a seed and use it to initialize a new + * {@code SplittableRandom} instance which is returned. If the system + * property "seed" is set and has value which may be correctly parsed it + * is used, otherwise a seed is generated using an independent PRNG. + * + * @return The {@code SplittableRandom} instance. + */ + public static SplittableRandom getSplittableRandom() { + return new SplittableRandom(getSeed()); + } +} diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/TimeLimitedRunner.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/jdk/test/lib/TimeLimitedRunner.java Wed Jul 05 23:32:23 2017 +0200 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014, 2016, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib; + +import java.util.Objects; +import java.util.concurrent.Callable; + +/** + * Auxiliary class to run target w/ given timeout. + */ +public class TimeLimitedRunner implements Callable { + private final long stoptime; + private final long timeout; + private final double factor; + private final Callable target; + + /** + * @param timeout a timeout. zero means no time limitation + * @param factor a multiplier used to estimate next iteration time + * @param target a target to run + * @throws NullPointerException if target is null + * @throws IllegalArgumentException if timeout is negative or + factor isn't positive + */ + public TimeLimitedRunner(long timeout, double factor, + Callable target) { + Objects.requireNonNull(target, "target must not be null"); + if (timeout < 0) { + throw new IllegalArgumentException("timeout[" + timeout + "] < 0"); + } + if (factor <= 0d) { + throw new IllegalArgumentException("factor[" + factor + "] <= 0"); + } + this.stoptime = System.currentTimeMillis() + timeout; + this.timeout = timeout; + this.factor = factor; + this.target = target; + } + + /** + * Runs @{linkplan target} while it returns true and timeout isn't exceeded + */ + @Override + public Void call() throws Exception { + long maxDuration = 0L; + long iterStart = System.currentTimeMillis(); + if (timeout != 0 && iterStart > stoptime) { + return null; + } + while (target.call()) { + if (timeout != 0) { + long iterDuration = System.currentTimeMillis() - iterStart; + maxDuration = Math.max(maxDuration, iterDuration); + iterStart = System.currentTimeMillis(); + if (iterStart + (maxDuration * factor) > stoptime) { + System.out.println("Not enough time to continue execution. " + + "Interrupted."); + break; + } + } + } + return null; + } + +} diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/util/FileUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/jdk/test/lib/util/FileUtils.java Wed Jul 05 23:32:23 2017 +0200 @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.util; + +import jdk.test.lib.Platform; + +import java.io.IOException; +import java.nio.file.DirectoryNotEmptyException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + + +/** + * Common library for various test file utility functions. + */ +public final class FileUtils { + private static final boolean IS_WINDOWS = Platform.isWindows(); + private static final int RETRY_DELETE_MILLIS = IS_WINDOWS ? 500 : 0; + private static final int MAX_RETRY_DELETE_TIMES = IS_WINDOWS ? 15 : 0; + + /** + * Deletes a file, retrying if necessary. + * + * @param path the file to delete + * + * @throws NoSuchFileException + * if the file does not exist (optional specific exception) + * @throws DirectoryNotEmptyException + * if the file is a directory and could not otherwise be deleted + * because the directory is not empty (optional specific exception) + * @throws IOException + * if an I/O error occurs + */ + public static void deleteFileWithRetry(Path path) throws IOException { + try { + deleteFileWithRetry0(path); + } catch (InterruptedException x) { + throw new IOException("Interrupted while deleting.", x); + } + } + + /** + * Deletes a file, retrying if necessary. + * No exception thrown if file doesn't exist. + * + * @param path the file to delete + * + * @throws NoSuchFileException + * if the file does not exist (optional specific exception) + * @throws DirectoryNotEmptyException + * if the file is a directory and could not otherwise be deleted + * because the directory is not empty (optional specific exception) + * @throws IOException + * if an I/O error occurs + */ + public static void deleteFileIfExistsWithRetry(Path path) throws IOException { + try { + if (Files.exists(path)) { + deleteFileWithRetry0(path); + } + } catch (InterruptedException x) { + throw new IOException("Interrupted while deleting.", x); + } + } + + private static void deleteFileWithRetry0(Path path) + throws IOException, InterruptedException { + int times = 0; + IOException ioe = null; + while (true) { + try { + Files.delete(path); + while (Files.exists(path)) { + times++; + if (times > MAX_RETRY_DELETE_TIMES) { + throw new IOException("File still exists after " + times + " waits."); + } + Thread.sleep(RETRY_DELETE_MILLIS); + } + break; + } catch (NoSuchFileException | DirectoryNotEmptyException x) { + throw x; + } catch (IOException x) { + // Backoff/retry in case another process is accessing the file + times++; + if (ioe == null) { + ioe = x; + } else { + ioe.addSuppressed(x); + } + + if (times > MAX_RETRY_DELETE_TIMES) { + throw ioe; + } + Thread.sleep(RETRY_DELETE_MILLIS); + } + } + } + + /** + * Deletes a directory and its subdirectories, retrying if necessary. + * + * @param dir the directory to delete + * + * @throws IOException + * If an I/O error occurs. Any such exceptions are caught + * internally. If only one is caught, then it is re-thrown. + * If more than one exception is caught, then the second and + * following exceptions are added as suppressed exceptions of the + * first one caught, which is then re-thrown. + */ + public static void deleteFileTreeWithRetry(Path dir) throws IOException { + IOException ioe = null; + final List excs = deleteFileTreeUnchecked(dir); + if (!excs.isEmpty()) { + ioe = excs.remove(0); + for (IOException x : excs) { + ioe.addSuppressed(x); + } + } + if (ioe != null) { + throw ioe; + } + } + + public static List deleteFileTreeUnchecked(Path dir) { + final List excs = new ArrayList<>(); + try { + java.nio.file.Files.walkFileTree(dir, new SimpleFileVisitor<>() { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + try { + deleteFileWithRetry0(file); + } catch (IOException x) { + excs.add(x); + } catch (InterruptedException x) { + excs.add(new IOException("Interrupted while deleting.", x)); + return FileVisitResult.TERMINATE; + } + return FileVisitResult.CONTINUE; + } + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { + try { + deleteFileWithRetry0(dir); + } catch (IOException x) { + excs.add(x); + } catch (InterruptedException x) { + excs.add(new IOException("Interrupted while deleting.", x)); + return FileVisitResult.TERMINATE; + } + return FileVisitResult.CONTINUE; + } + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) { + excs.add(exc); + return FileVisitResult.CONTINUE; + } + }); + } catch (IOException x) { + excs.add(x); + } + return excs; + } + + /** + * Checks whether all file systems are accessible. This is performed + * by checking free disk space on all mounted file systems via a + * separate, spawned process. File systems are considered to be + * accessible if this process completes successfully before a given + * fixed duration has elapsed. + * + * @implNote On Unix this executes the {@code df} command in a separate + * process and on Windows always returns {@code true}. + */ + public static boolean areFileSystemsAccessible() throws IOException { + boolean areFileSystemsAccessible = true; + if (!IS_WINDOWS) { + // try to check whether 'df' hangs + System.out.println("\n--- df output ---"); + System.out.flush(); + Process proc = new ProcessBuilder("df").inheritIO().start(); + try { + proc.waitFor(90, TimeUnit.SECONDS); + } catch (InterruptedException ignored) { + } + try { + int exitValue = proc.exitValue(); + if (exitValue != 0) { + System.err.printf("df process exited with %d != 0%n", + exitValue); + areFileSystemsAccessible = false; + } + } catch (IllegalThreadStateException ignored) { + System.err.println("df command apparently hung"); + areFileSystemsAccessible = false; + } + } + return areFileSystemsAccessible; + } +} diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/util/JarUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/lib/jdk/test/lib/util/JarUtils.java Wed Jul 05 23:32:23 2017 +0200 @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2015, 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.util; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; + +/** + * Common library for various test jar file utility functions. + */ +public final class JarUtils { + + /** + * Create jar file with specified files. If a specified file does not exist, + * a new jar entry will be created with the file name itself as the content. + */ + public static void createJar(String dest, String... files) + throws IOException { + try (JarOutputStream jos = new JarOutputStream( + new FileOutputStream(dest), new Manifest())) { + for (String file : files) { + System.out.println(String.format("Adding %s to %s", + file, dest)); + + // add an archive entry, and write a file + jos.putNextEntry(new JarEntry(file)); + try (FileInputStream fis = new FileInputStream(file)) { + fis.transferTo(jos); + } catch (FileNotFoundException e) { + jos.write(file.getBytes()); + } + } + } + System.out.println(); + } + + /** + * Add or remove specified files to existing jar file. If a specified file + * to be updated or added does not exist, the jar entry will be created + * with the file name itself as the content. + * + * @param src the original jar file name + * @param dest the new jar file name + * @param files the files to update. The list is broken into 2 groups + * by a "-" string. The files before in the 1st group will + * be either updated or added. The files in the 2nd group + * will be removed. If no "-" exists, all files belong to + * the 1st group. + */ + public static void updateJar(String src, String dest, String... files) + throws IOException { + try (JarOutputStream jos = new JarOutputStream( + new FileOutputStream(dest))) { + + // copy each old entry into destination unless the entry name + // is in the updated list + List updatedFiles = new ArrayList<>(); + try (JarFile srcJarFile = new JarFile(src)) { + Enumeration entries = srcJarFile.entries(); + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + String name = entry.getName(); + boolean found = false; + boolean update = true; + for (String file : files) { + if (file.equals("-")) { + update = false; + } else if (name.equals(file)) { + updatedFiles.add(file); + found = true; + break; + } + } + + if (found) { + if (update) { + System.out.println(String.format("Updating %s with %s", + dest, name)); + jos.putNextEntry(new JarEntry(name)); + try (FileInputStream fis = new FileInputStream(name)) { + fis.transferTo(jos); + } catch (FileNotFoundException e) { + jos.write(name.getBytes()); + } + } else { + System.out.println(String.format("Removing %s from %s", + name, dest)); + } + } else { + System.out.println(String.format("Copying %s to %s", + name, dest)); + jos.putNextEntry(entry); + srcJarFile.getInputStream(entry).transferTo(jos); + } + } + } + + // append new files + for (String file : files) { + if (file.equals("-")) { + break; + } + if (!updatedFiles.contains(file)) { + System.out.println(String.format("Adding %s with %s", + dest, file)); + jos.putNextEntry(new JarEntry(file)); + try (FileInputStream fis = new FileInputStream(file)) { + fis.transferTo(jos); + } catch (FileNotFoundException e) { + jos.write(file.getBytes()); + } + } + } + } + System.out.println(); + } + +} diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/wrappers/InfiniteLoop.java --- a/test/lib/jdk/test/lib/wrappers/InfiniteLoop.java Wed May 31 17:45:57 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib.wrappers; - -import java.util.Objects; - -/** - * Class which runs another Runnable in infinite loop with certain pauses - * between cycles. - */ -public class InfiniteLoop implements Runnable { - private final Runnable target; - private final long mills; - - - /** - * @param target a target to run in a loop - * @param mills the length of pause time in milliseconds - * @throws NullPointerException if target is null - * @throws IllegalArgumentException if the value of millis is negative - */ - public InfiniteLoop(Runnable target, long mills) { - Objects.requireNonNull(target); - if (mills < 0) { - throw new IllegalArgumentException("mills < 0"); - } - this.target = target; - this.mills = mills; - } - - @Override - public void run() { - try { - while (true) { - target.run(); - if (mills > 0) { - Thread.sleep(mills); - } - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - throw new Error(e); - } - } -} diff -r 4644ed4e3292 -r bafbb2256ce9 test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java --- a/test/lib/jdk/test/lib/wrappers/TimeLimitedRunner.java Wed May 31 17:45:57 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2014, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib.wrappers; - -import java.util.Objects; -import java.util.concurrent.Callable; - -/** - * Auxiliary class to run target w/ given timeout. - */ -public class TimeLimitedRunner implements Callable { - private final long stoptime; - private final long timeout; - private final double factor; - private final Callable target; - - /** - * @param timeout a timeout. zero means no time limitation - * @param factor a multiplier used to estimate next iteration time - * @param target a target to run - * @throws NullPointerException if target is null - * @throws IllegalArgumentException if timeout is negative or - factor isn't positive - */ - public TimeLimitedRunner(long timeout, double factor, - Callable target) { - Objects.requireNonNull(target, "target must not be null"); - if (timeout < 0) { - throw new IllegalArgumentException("timeout[" + timeout + "] < 0"); - } - if (factor <= 0d) { - throw new IllegalArgumentException("factor[" + factor + "] <= 0"); - } - this.stoptime = System.currentTimeMillis() + timeout; - this.timeout = timeout; - this.factor = factor; - this.target = target; - } - - /** - * Runs @{linkplan target} while it returns true and timeout isn't exceeded - */ - @Override - public Void call() throws Exception { - long maxDuration = 0L; - long iterStart = System.currentTimeMillis(); - if (timeout != 0 && iterStart > stoptime) { - return null; - } - while (target.call()) { - if (timeout != 0) { - long iterDuration = System.currentTimeMillis() - iterStart; - maxDuration = Math.max(maxDuration, iterDuration); - iterStart = System.currentTimeMillis(); - if (iterStart + (maxDuration * factor) > stoptime) { - System.out.println("Not enough time to continue execution. " - + "Interrupted."); - break; - } - } - } - return null; - } - -}