--- a/.hgtags-top-repo Thu Jan 21 10:16:09 2016 -0800
+++ b/.hgtags-top-repo Wed Jul 05 21:14:30 2017 +0200
@@ -344,3 +344,4 @@
7c0577bea4c65d69c5bef67023a89d2efa4fb2f7 jdk-9+99
c1f30ac14db0eaff398429c04cd9fab92e1b4b2a jdk-9+100
c4d72a1620835b5d657b7b6792c2879367d0154f jdk-9+101
+6406ecf5d39482623225bb1b3098c2cac6f7d450 jdk-9+102
--- a/common/autoconf/build-performance.m4 Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/build-performance.m4 Wed Jul 05 21:14:30 2017 +0200
@@ -37,9 +37,9 @@
# Looks like a Solaris system
NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
FOUND_CORES=yes
- elif test -x /usr/sbin/system_profiler; then
+ elif test -x /usr/sbin/sysctl; then
# Looks like a MacOSX system
- NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print [$]5}'`
+ NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
FOUND_CORES=yes
elif test "x$OPENJDK_BUILD_OS" = xaix ; then
NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print [$]4 }'`
@@ -74,10 +74,10 @@
# Looks like a Solaris or AIX system
MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
FOUND_MEM=yes
- elif test -x /usr/sbin/system_profiler; then
+ elif test -x /usr/sbin/sysctl; then
# Looks like a MacOSX system
- MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print [$]2}'`
- MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
+ MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
+ MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
FOUND_MEM=yes
elif test "x$OPENJDK_BUILD_OS" = xwindows; then
# Windows, but without cygwin
--- a/common/autoconf/flags.m4 Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/flags.m4 Wed Jul 05 21:14:30 2017 +0200
@@ -403,7 +403,7 @@
CXXFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
CFLAGS_DEBUG_SYMBOLS="-g -xs"
- # FIXME: likely a bug, this disables debug symbols rather than enables them
+ # -g0 enables debug symbols without disabling inlining.
CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
CFLAGS_DEBUG_SYMBOLS="-g"
@@ -501,7 +501,7 @@
C_O_FLAG_HI="-O3 -qstrict"
C_O_FLAG_NORM="-O2"
C_O_FLAG_DEBUG="-qnoopt"
- C_O_FLAG_NONE="-qnoop"
+ C_O_FLAG_NONE="-qnoopt"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
C_O_FLAG_HIGHEST="-O2"
C_O_FLAG_HI="-O1"
--- a/common/autoconf/generated-configure.sh Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/generated-configure.sh Wed Jul 05 21:14:30 2017 +0200
@@ -688,11 +688,11 @@
FIXPATH_DETACH_FLAG
FIXPATH
GCOV_ENABLED
-ZIP_DEBUGINFO_FILES
-ENABLE_DEBUG_SYMBOLS
STRIP_POLICY
DEBUG_BINARIES
-NATIVE_DEBUG_SYMBOLS
+ZIP_EXTERNAL_DEBUG_SYMBOLS
+COPY_DEBUG_SYMBOLS
+COMPILE_WITH_DEBUG_SYMBOLS
CFLAGS_WARNINGS_ARE_ERRORS
DISABLE_WARNING_PREFIX
HOTSPOT_SET_WARNINGS_AS_ERRORS
@@ -4119,6 +4119,16 @@
+ # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+ # will basically do slowdebug builds when DEBUG_BINARIES is set for
+ # fastdebug builds
+ DEBUG_BINARIES=false
+ # Fastdebug builds with this setting will essentially be slowdebug
+ # in hotspot.
+ # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+ # will basically do slowdebug builds when DEBUG_BINARIES is set for
+ # fastdebug builds
+ DEBUG_BINARIES=false
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -4839,7 +4849,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1452780299
+DATE_WHEN_GENERATED=1453385294
###############################################################################
#
@@ -14818,7 +14828,7 @@
VAR_CPU_ENDIAN=big
;;
powerpc64le)
- VAR_CPU=ppc64
+ VAR_CPU=ppc64le
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
@@ -14957,7 +14967,7 @@
VAR_CPU_ENDIAN=big
;;
powerpc64le)
- VAR_CPU=ppc64
+ VAR_CPU=ppc64le
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
@@ -47031,7 +47041,7 @@
CXXFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
CFLAGS_DEBUG_SYMBOLS="-g -xs"
- # FIXME: likely a bug, this disables debug symbols rather than enables them
+ # -g0 enables debug symbols without disabling inlining.
CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
CFLAGS_DEBUG_SYMBOLS="-g"
@@ -47249,7 +47259,7 @@
C_O_FLAG_HI="-O3 -qstrict"
C_O_FLAG_NORM="-O2"
C_O_FLAG_DEBUG="-qnoopt"
- C_O_FLAG_NONE="-qnoop"
+ C_O_FLAG_NONE="-qnoopt"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
C_O_FLAG_HIGHEST="-O2"
C_O_FLAG_HI="-O1"
@@ -48271,21 +48281,31 @@
fi
fi
- ENABLE_DEBUG_SYMBOLS=true
- ZIP_DEBUGINFO_FILES=true
- DEBUG_BINARIES=true
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=true
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=true
+
+ # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+ DEBUG_BINARIES=false
STRIP_POLICY=min_strip
+
elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
- ENABLE_DEBUG_SYMBOLS=false
- ZIP_DEBUGINFO_FILES=false
+ COMPILE_WITH_DEBUG_SYMBOLS=false
+ COPY_DEBUG_SYMBOLS=false
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
DEBUG_BINARIES=false
STRIP_POLICY=no_strip
elif test "x$NATIVE_DEBUG_SYMBOLS" = xinternal; then
- ENABLE_DEBUG_SYMBOLS=false # -g option only
- ZIP_DEBUGINFO_FILES=false
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=false
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+ # Hotspot legacy support, will turn on -g when COPY_DEBUG_SYMBOLS=false
DEBUG_BINARIES=true
STRIP_POLICY=no_strip
STRIP=""
+
elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -48296,9 +48316,12 @@
fi
fi
- ENABLE_DEBUG_SYMBOLS=true
- ZIP_DEBUGINFO_FILES=false
- DEBUG_BINARIES=true
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=true
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+ # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+ DEBUG_BINARIES=false
STRIP_POLICY=min_strip
else
as_fn_error $? "Allowed native debug symbols are: none, internal, external, zipped" "$LINENO" 5
@@ -48348,6 +48371,8 @@
+ # Legacy values
+
@@ -59224,9 +59249,9 @@
# Looks like a Solaris system
NUM_CORES=`LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line`
FOUND_CORES=yes
- elif test -x /usr/sbin/system_profiler; then
+ elif test -x /usr/sbin/sysctl; then
# Looks like a MacOSX system
- NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print $5}'`
+ NUM_CORES=`/usr/sbin/sysctl -n hw.ncpu`
FOUND_CORES=yes
elif test "x$OPENJDK_BUILD_OS" = xaix ; then
NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print $4 }'`
@@ -59278,10 +59303,10 @@
# Looks like a Solaris or AIX system
MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [Ss]ize" | awk '{ print $3 }'`
FOUND_MEM=yes
- elif test -x /usr/sbin/system_profiler; then
+ elif test -x /usr/sbin/sysctl; then
# Looks like a MacOSX system
- MEMORY_SIZE=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print $2}'`
- MEMORY_SIZE=`expr $MEMORY_SIZE \* 1024`
+ MEMORY_SIZE=`/usr/sbin/sysctl -n hw.memsize`
+ MEMORY_SIZE=`expr $MEMORY_SIZE / 1024 / 1024`
FOUND_MEM=yes
elif test "x$OPENJDK_BUILD_OS" = xwindows; then
# Windows, but without cygwin
--- a/common/autoconf/hotspot-spec.gmk.in Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/hotspot-spec.gmk.in Wed Jul 05 21:14:30 2017 +0200
@@ -118,7 +118,7 @@
# Hotspot expects the variable FULL_DEBUG_SYMBOLS=1/0 to control debug symbols
# creation.
-ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ifeq ($(COPY_DEBUG_SYMBOLS), true)
FULL_DEBUG_SYMBOLS=1
# Ensure hotspot uses the objcopy that configure located
ALT_OBJCOPY:=$(OBJCOPY)
@@ -127,12 +127,15 @@
endif
# Hotspot expects the variable ZIP_DEBUGINFO_FILES=1/0 and not true/false.
-ifeq ($(ZIP_DEBUGINFO_FILES)$(ENABLE_DEBUG_SYMBOLS), truetrue)
+ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
ZIP_DEBUGINFO_FILES:=1
else
ZIP_DEBUGINFO_FILES:=0
endif
+DEBUG_BINARIES := @DEBUG_BINARIES@
+STRIP_POLICY := @STRIP_POLICY@
+
ifeq ($(OPENJDK_TARGET_OS), windows)
# On Windows, the Visual Studio toolchain needs the LIB and INCLUDE
# environment variables (in Windows path style).
--- a/common/autoconf/hotspot.m4 Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/hotspot.m4 Wed Jul 05 21:14:30 2017 +0200
@@ -266,3 +266,14 @@
HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
AC_SUBST(HOTSPOT_MAKE_ARGS)
])
+
+ # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+ # will basically do slowdebug builds when DEBUG_BINARIES is set for
+ # fastdebug builds
+ DEBUG_BINARIES=false
+ # Fastdebug builds with this setting will essentially be slowdebug
+ # in hotspot.
+ # -g is already added by ENABLE_DEBUG_SYMBOLS and the hotspot makefiles
+ # will basically do slowdebug builds when DEBUG_BINARIES is set for
+ # fastdebug builds
+ DEBUG_BINARIES=false
\ No newline at end of file
--- a/common/autoconf/jdk-options.m4 Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/jdk-options.m4 Wed Jul 05 21:14:30 2017 +0200
@@ -251,21 +251,31 @@
fi
fi
- ENABLE_DEBUG_SYMBOLS=true
- ZIP_DEBUGINFO_FILES=true
- DEBUG_BINARIES=true
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=true
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=true
+
+ # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+ DEBUG_BINARIES=false
STRIP_POLICY=min_strip
+
elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
- ENABLE_DEBUG_SYMBOLS=false
- ZIP_DEBUGINFO_FILES=false
+ COMPILE_WITH_DEBUG_SYMBOLS=false
+ COPY_DEBUG_SYMBOLS=false
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
DEBUG_BINARIES=false
STRIP_POLICY=no_strip
elif test "x$NATIVE_DEBUG_SYMBOLS" = xinternal; then
- ENABLE_DEBUG_SYMBOLS=false # -g option only
- ZIP_DEBUGINFO_FILES=false
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=false
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+ # Hotspot legacy support, will turn on -g when COPY_DEBUG_SYMBOLS=false
DEBUG_BINARIES=true
STRIP_POLICY=no_strip
STRIP=""
+
elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -276,9 +286,12 @@
fi
fi
- ENABLE_DEBUG_SYMBOLS=true
- ZIP_DEBUGINFO_FILES=false
- DEBUG_BINARIES=true
+ COMPILE_WITH_DEBUG_SYMBOLS=true
+ COPY_DEBUG_SYMBOLS=true
+ ZIP_EXTERNAL_DEBUG_SYMBOLS=false
+
+ # Hotspot legacy support, not relevant with COPY_DEBUG_SYMBOLS=true
+ DEBUG_BINARIES=false
STRIP_POLICY=min_strip
else
AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
@@ -294,11 +307,13 @@
BASIC_DEPRECATED_ARG_ENABLE(zip-debug-info, zip_debug_info,
[Please use --with-native-debug-symbols=zipped .])
- AC_SUBST(NATIVE_DEBUG_SYMBOLS)
+ AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS)
+ AC_SUBST(COPY_DEBUG_SYMBOLS)
+ AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS)
+
+ # Legacy values
AC_SUBST(DEBUG_BINARIES)
AC_SUBST(STRIP_POLICY)
- AC_SUBST(ENABLE_DEBUG_SYMBOLS)
- AC_SUBST(ZIP_DEBUGINFO_FILES)
])
################################################################################
--- a/common/autoconf/platform.m4 Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/platform.m4 Wed Jul 05 21:14:30 2017 +0200
@@ -67,7 +67,7 @@
VAR_CPU_ENDIAN=big
;;
powerpc64le)
- VAR_CPU=ppc64
+ VAR_CPU=ppc64le
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
--- a/common/autoconf/spec.gmk.in Thu Jan 21 10:16:09 2016 -0800
+++ b/common/autoconf/spec.gmk.in Wed Jul 05 21:14:30 2017 +0200
@@ -424,13 +424,12 @@
#
# Options for generating debug symbols
-ENABLE_DEBUG_SYMBOLS:=@ENABLE_DEBUG_SYMBOLS@
+COMPILE_WITH_DEBUG_SYMBOLS := @COMPILE_WITH_DEBUG_SYMBOLS@
+COPY_DEBUG_SYMBOLS := @COPY_DEBUG_SYMBOLS@
+ZIP_EXTERNAL_DEBUG_SYMBOLS := @ZIP_EXTERNAL_DEBUG_SYMBOLS@
+
CFLAGS_DEBUG_SYMBOLS:=@CFLAGS_DEBUG_SYMBOLS@
CXXFLAGS_DEBUG_SYMBOLS:=@CXXFLAGS_DEBUG_SYMBOLS@
-ZIP_DEBUGINFO_FILES:=@ZIP_DEBUGINFO_FILES@
-NATIVE_DEBUG_SYMBOLS:=@NATIVE_DEBUG_SYMBOLS@
-DEBUG_BINARIES:=@DEBUG_BINARIES@
-STRIP_POLICY:=@STRIP_POLICY@
#
# Compress (or not) jars
--- a/common/bin/unshuffle_list.txt Thu Jan 21 10:16:09 2016 -0800
+++ b/common/bin/unshuffle_list.txt Wed Jul 05 21:14:30 2017 +0200
@@ -378,6 +378,7 @@
jdk/src/java.base/unix/conf/i586/jvm.cfg : jdk/src/solaris/bin/i586/jvm.cfg
jdk/src/java.base/unix/conf/ia64/jvm.cfg : jdk/src/solaris/bin/ia64/jvm.cfg
jdk/src/java.base/unix/conf/ppc64/jvm.cfg : jdk/src/solaris/bin/ppc64/jvm.cfg
+jdk/src/java.base/unix/conf/ppc64le/jvm.cfg : jdk/src/solaris/bin/ppc64le/jvm.cfg
jdk/src/java.base/unix/conf/ppc/jvm.cfg : jdk/src/solaris/bin/ppc/jvm.cfg
jdk/src/java.base/unix/conf/sdp/sdp.conf.template : jdk/src/solaris/lib/sdp/sdp.conf.template
jdk/src/java.base/unix/conf/sparc/jvm.cfg : jdk/src/solaris/bin/sparc/jvm.cfg
--- a/common/conf/jib-profiles.js Thu Jan 21 10:16:09 2016 -0800
+++ b/common/conf/jib-profiles.js Wed Jul 05 21:14:30 2017 +0200
@@ -257,7 +257,7 @@
target_os: "macosx",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit"),
- configure_args: concat(common.configure_args, "--with-sdk-name=macosx10.9"),
+ configure_args: common.configure_args,
make_args: common.make_args
},
--- a/make/BuildStatic.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/BuildStatic.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -41,7 +41,7 @@
$(SUPPORT_OUTPUTDIR)/modules_libs/$(module)/$(module).symbols)
$(GLOBAL_SYMBOLS_FILE): $(MODULES_SYMBOLS_FILES)
- $(ECHO) $(LOG_INFO) "Generating global exported.symbols file"
+ $(call LogInfo, Generating global exported.symbols file)
$(MKDIR) -p $(@D)
$(CAT) $^ > $@
--- a/make/CompileJavaModules.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/CompileJavaModules.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -367,10 +367,6 @@
################################################################################
-jdk.hotspot.agent_SRC += \
- $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent \
- $(HOTSPOT_TOPDIR)/agent/src/share/classes \
- #
jdk.hotspot.agent_ADD_JAVAC_FLAGS := $(DISABLE_WARNINGS),-overrides
jdk.hotspot.agent_COPY := .png sa.js .properties
@@ -381,9 +377,9 @@
# These can't be handled by COPY to SetupJavaCompilation since they chop off
# one directory level.
$(eval $(call SetupCopyFiles, COPY_SA_IMAGES, \
- SRC := $(HOTSPOT_TOPDIR)/agent/src/share/classes/images, \
+ SRC := $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/images, \
DEST := $(JDK_OUTPUTDIR)/modules/$(MODULE), \
- FILES := $(wildcard $(HOTSPOT_TOPDIR)/agent/src/share/classes/images/*/*/*.gif), \
+ FILES := $(wildcard $(HOTSPOT_TOPDIR)/src/jdk.hotspot.agent/share/classes/images/*/*/*.gif), \
))
jdk.hotspot.agent: $(COPY_SA_IMAGES)
endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/make/GenerateModuleDeps.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2014, 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+# This file is included from Main.gmk only.
+
+include $(SRC_ROOT)/make/common/JavaCompilation.gmk
+include $(SRC_ROOT)/make/common/SetupJavaCompilers.gmk
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation, BUILD_GENMODULESLIST, \
+ SETUP := BOOT_JAVAC, \
+ SRC := $(JDK_TOPDIR)/make/src/classes, \
+ INCLUDES := build/tools/module, \
+ EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
+ BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
+ DISABLE_SJAVAC := true, \
+))
+
+TOOL_GENMODULESLIST = $(JAVA_SMALL) \
+ -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
+ build.tools.module.GenModulesList
+
+MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
+# The module deps makefile is used from make/common/Modules.gmk
+MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
+
+$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml $(BUILD_GENMODULESLIST)
+ $(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
+
+$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
+ $(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
+
+TARGETS += $(MODULE_DEPS_MAKEFILE)
+
+################################################################################
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , GenerateModuleDeps.gmk))
+
+# Trigger generation of this file and restart make if it changed.
+-include $(MODULE_DEPS_MAKEFILE)
--- a/make/HotspotWrapper.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/HotspotWrapper.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -35,14 +35,18 @@
default: all
-# Get all files except .hg in the hotspot directory.
-HOTSPOT_FILES := $(shell $(FIND) -L $(HOTSPOT_TOPDIR) -name ".hg" -prune -o -print)
+# Get all files in src, make or agent subdirs in hotspot directory and
+# filter out .hg. This skips the test directory.
+HOTSPOT_FILES := $(shell $(FIND) -L \
+ $(HOTSPOT_TOPDIR)/src $(HOTSPOT_TOPDIR)/make \
+ -name ".hg" -prune -o -print)
# The old build creates hotspot output dir before calling hotspot and
# not doing it breaks builds on msys.
$(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
- @($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
+ @($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \
+ LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
$(TOUCH) $@
hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp
--- a/make/Images.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/Images.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -248,38 +248,38 @@
endif
$(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
$(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
$(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
$(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
ifeq ($(OPENJDK_TARGET_OS), solaris)
$(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
$(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
- $(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
endif
ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
$(JRE_IMAGE_DIR)/man/ja:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
$(JDK_IMAGE_DIR)/man/ja:
- $(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
endif
@@ -333,7 +333,7 @@
# Processing license files from source area to image area
# These are modified to have the platform specific EOL chars.
define process-doc-file
- $(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
LC_ALL=C $(SED) 's/$$//g' $< > $@
@@ -378,7 +378,7 @@
# Param 1 - The file containing the MODULES list
define prepare-info-file
- $(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
endef
@@ -426,38 +426,30 @@
# src.zip
$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
- $(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(install-file)
JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
################################################################################
# /demo dir
+ifneq ($(findstring images, $(MAKECMDGOALS)), )
+ $(eval $(call SetupCopyFiles, JDK_COPY_DEMOS, \
+ SRC := $(SUPPORT_OUTPUTDIR)/demos/image, \
+ DEST := $(JDK_IMAGE_DIR)/demo, \
+ FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
+ $(call DoubleDollar, $(call DoubleDollar, \
+ $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
+ -type f -a ! \( -name "_the*" -o -name "javac_state" \) )))), \
+ ))
-# The db demo contains an empty dir that needs to be copied. The other
-# directories will always trigger the rule for recompile since
-# _the.list_of_packages files are touched.
-ifneq ($(findstring images, $(MAKECMDGOALS)), )
- $(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demos/image/%
- if [ ! -d "$@" ]; then \
- $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
- $(MKDIR) -p $(@D); \
- if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
- fi
-
- # Find all files including directories
- JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demos/image), \
- $(patsubst $(SUPPORT_OUTPUTDIR)/demos/image/%, $(JDK_IMAGE_DIR)/demo/%, \
- $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demos/image \
- ! \( -name "_the*" -o -name "javac_state" \) )))
-
- JDK_TARGETS += $(JDK_DEMO_TARGETS)
+ JDK_TARGETS += $(JDK_COPY_DEMOS)
endif
################################################################################
# /sample dir
-$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
+$(eval $(call SetupCopyFiles, COPY_SAMPLES, \
SRC := $(SUPPORT_OUTPUTDIR)/sample/image, \
DEST := $(JDK_IMAGE_DIR)/sample, \
FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample/image), \
--- a/make/Init.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/Init.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -226,8 +226,8 @@
$(eval $(call ParseCompareBuild))
ifeq ($(LOG_NOFILE), true)
- # Disable log wrapper if LOG=[level,]nofile was given
- override BUILD_LOG_WRAPPER :=
+ # Disable build log if LOG=[level,]nofile was given
+ override BUILD_LOG_PIPE :=
endif
ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
@@ -277,10 +277,10 @@
ifneq ($(SEQUENTIAL_TARGETS)$(PARALLEL_TARGETS), )
$(call RotateLogFiles)
$(call PrepareFailureLogs)
- $(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(TARGET_DESCRIPTION)\n"
+ $(PRINTF) "Building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
ifneq ($(SEQUENTIAL_TARGETS), )
# Don't touch build output dir since we might be cleaning. That
- # means no log wrapper.
+ # means no log pipe.
( cd $(TOPDIR) && \
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
$(SEQUENTIAL_TARGETS) )
@@ -289,11 +289,12 @@
$(call StartGlobalTimer)
$(call PrepareSmartJavac)
( cd $(TOPDIR) && \
- $(BUILD_LOG_WRAPPER) $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
+ $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
-j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
- $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) || \
- ( exitcode=$$? && $(BUILD_LOG_WRAPPER) \
- $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" && \
+ $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
+ ( exitcode=$$? && \
+ $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
+ $(BUILD_LOG_PIPE) && \
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
HAS_SPEC=true on-failure ; \
exit $$exitcode ) )
@@ -301,7 +302,7 @@
$(call StopGlobalTimer)
$(call ReportBuildTimes)
endif
- $(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n"
+ $(PRINTF) "Finished building $(TARGET_DESCRIPTION)\n" $(BUILD_LOG_PIPE)
endif
on-failure:
--- a/make/InitSupport.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/InitSupport.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -155,7 +155,7 @@
else ifeq ($$(LOG_LEVEL), debug)
MAKE_LOG_FLAGS :=
else ifeq ($$(LOG_LEVEL), trace)
- MAKE_LOG_FLAGS := -d
+ MAKE_LOG_FLAGS :=
else
$$(info Error: LOG must be one of: warn, info, debug or trace.)
$$(error Cannot continue)
@@ -235,11 +235,15 @@
$$(foreach var, $$(all_confs), $$(info * $$(var)))
$$(error Cannot continue)
else
- ifeq ($$(words $$(matching_confs)), 1)
- $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
- else
- $$(info Building these configurations (matching CONF=$$(CONF)):)
- $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+ # Don't repeat this output on make restarts caused by including
+ # generated files.
+ ifeq ($$(MAKE_RESTARTS),)
+ ifeq ($$(words $$(matching_confs)), 1)
+ $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
+ else
+ $$(info Building these configurations (matching CONF=$$(CONF)):)
+ $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+ endif
endif
endif
@@ -284,7 +288,7 @@
$$(main_targets_file):
@( cd $$(topdir) && \
- $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
+ $$(MAKE) $$(MAKE_LOG_FLAGS) -r -R -f $$(topdir)/make/Main.gmk \
-I $$(topdir)/make/common SPEC=$(strip $2) NO_RECIPES=true \
LOG_LEVEL=$$(LOG_LEVEL) \
create-main-targets-include )
@@ -313,7 +317,7 @@
BUILD_LOG := $(OUTPUT_ROOT)/build.log
BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log
- BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
+ BUILD_LOG_PIPE := > >($(TEE) -a $(BUILD_LOG)) 2> >($(TEE) -a $(BUILD_LOG) >&2)
# Sanity check the spec file, so it matches this source code
define CheckSpecSanity
@@ -455,7 +459,7 @@
endef
define RotateLogFiles
- $(RM) $(BUILD_LOG).old 2> /dev/null
+ $(RM) $(BUILD_LOG).old 2> /dev/null && \
$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
$(if $(findstring trace, $(LOG_LEVEL)), \
$(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
@@ -464,7 +468,7 @@
endef
define PrepareFailureLogs
- $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null
+ $(RM) -r $(MAKESUPPORT_OUTPUTDIR)/failure-logs 2> /dev/null && \
$(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR)/failure-logs
endef
@@ -483,8 +487,8 @@
endef
define StartGlobalTimer
- $(RM) -r $(BUILDTIMESDIR) 2> /dev/null
- $(MKDIR) -p $(BUILDTIMESDIR)
+ $(RM) -r $(BUILDTIMESDIR) 2> /dev/null && \
+ $(MKDIR) -p $(BUILDTIMESDIR) && \
$(call RecordStartTime,TOTAL)
endef
@@ -495,13 +499,14 @@
# Find all build_time_* files and print their contents in a list sorted
# on the name of the sub repository.
define ReportBuildTimes
- $(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \
+ $(PRINTF) $(LOG_INFO) -- \
"----- Build times -------\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
"`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
$(XARGS) $(CAT) | $(SORT) -k 2`" \
- "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
+ "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" \
+ $(BUILD_LOG_PIPE)
endef
endif # HAS_SPEC
--- a/make/MacBundles.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/MacBundles.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -57,23 +57,23 @@
# Copy empty directories (jre/lib/applet).
$(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
- $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
$(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
- $(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+ $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
$(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
- $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+ $(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
$(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib:
- $(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@) $(LOG_INFO)
+ $(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@))
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../Home/lib/jli/libjli.dylib $@
--- a/make/Main.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/Main.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -42,6 +42,8 @@
# Load the vital tools for all the makefiles.
include $(SRC_ROOT)/make/common/MakeBase.gmk
+# Explicitly generate module deps makefile data
+include $(SRC_ROOT)/make/GenerateModuleDeps.gmk
include $(SRC_ROOT)/make/common/Modules.gmk
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
@@ -78,7 +80,7 @@
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
buildtools-jdk:
- +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
+ +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
ALL_TARGETS += buildtools-langtools interim-langtools \
interim-rmic interim-cldrconverter buildtools-jdk
@@ -218,7 +220,7 @@
# used to track the exact sources used to build that image.
source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
$(SUPPORT_OUTPUTDIR)/source_tips: FRC
- @$(MKDIR) -p $(@D)
+ $(call MakeDir, $(@D))
@$(RM) $@
@$(call GetSourceTips)
@@ -427,6 +429,10 @@
# in javadoc.
java.desktop-gensrc-jdk: java.base-gensrc
+ # The annotation processing for jdk.vm.ci needs java.base classes from the
+ # current JDK.
+ jdk.vm.ci-gensrc-hotspot: java.base-java
+
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
@@ -656,7 +662,7 @@
@$(ECHO) $(sort $(ALL_MODULES))
create-main-targets-include:
- @$(ECHO) $(LOG_INFO) Generating main target list
+ $(call LogInfo, Generating main target list)
@$(ECHO) ALL_MAIN_TARGETS := $(sort $(ALL_TARGETS)) > \
$(MAKESUPPORT_OUTPUTDIR)/main-targets.gmk
--- a/make/MainSupport.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/MainSupport.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -141,7 +141,6 @@
else
$2-$$($1_TARGET_SUFFIX):
endif
- $(ECHO) $(LOG_INFO) "Building $$@"
ifeq ($$($1_USE_WRAPPER), true)
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
-f ModuleWrapper.gmk \
--- a/make/StripBinaries.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/StripBinaries.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -40,8 +40,8 @@
ifneq ($(STRIP), )
define StripRecipe
- $(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
- $(MKDIR) -p $(@D)
+ $(call LogInfo, Stripping $(patsubst $(OUTPUT_ROOT)/%,%,$<))
+ $(call MakeDir, $(@D))
$(CP) $< $@.tmp
$(CHMOD) u+w $@.tmp
$(STRIP) $(STRIPFLAGS) $@.tmp
--- a/make/common/IdlCompilation.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/IdlCompilation.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -56,10 +56,9 @@
$4_OLDIMPLBASE_MSG:=with -oldImplBase
endif
$5 : $4
- $(MKDIR) -p $3/$$($4_TMPDIR)
+ $$(call LogInfo, Compiling IDL $(patsubst $2/%,%,$4))
+ $$(call MakeDir, $$(@D))
$(RM) -rf $3/$$($4_TMPDIR)
- $(MKDIR) -p $(dir $5)
- $(ECHO) $(LOG_INFO) Compiling IDL $(patsubst $2/%,%,$4)
$8 -td $3/$$($4_TMPDIR) \
-i $2/org/omg/CORBA \
-i $2/org/omg/PortableInterceptor \
--- a/make/common/JavaCompilation.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/JavaCompilation.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -246,13 +246,6 @@
$1_SAFE_NAME := $$(strip $$(subst /,_, $1))
- # Create the corresponding smart javac wrapper command line.
- $1_SJAVAC_ARGS:=$$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
- $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
- $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES) $$($1_SJAVAC_EXCLUDE_FILES))) \
- $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
- -src $$(call PathList, $$($1_SRC))
-
# All files below META-INF are always copied.
$1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
# Find all files to be copied from source to bin.
@@ -315,11 +308,32 @@
ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
# Using sjavac to compile.
+ # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
+ # match the absolute path, only the part inside each src dir. Instead -i and
+ # -x flags apply only to the next -src arg on the command line.
+ $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
+ $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
+ $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
+ $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
+ $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
+ $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
+ $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
+ $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
+ -src $$(s))
+
+ ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
+ $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
+ $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
+ else
+ $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
+ endif
+
+
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS)
endif
- $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS) $$($1_FLAGS) \
+ $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
$$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
$$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, $$($1_BIN)/_the.$1.vardeps)
@@ -327,6 +341,9 @@
$$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
$(MKDIR) -p $$(@D) $$(dir $$($1_SJAVAC_PORTFILE))
$$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
+ ifneq ($$($1_SJAVAC_ARGS_FILE), )
+ $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
+ endif
$(ECHO) Compiling $1
$(call LogFailures, $$($1_BIN)/_the.$$($1_SAFE_NAME)_batch.log, $$($1_SAFE_NAME), \
$$($1_JVM) $$($1_SJAVAC) \
--- a/make/common/MakeBase.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/MakeBase.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -86,8 +86,7 @@
# Record starting time for build of a sub repository.
define RecordStartTime
- $(MKDIR) -p $(BUILDTIMESDIR)
- $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)
+ $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1) && \
$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
endef
@@ -233,6 +232,7 @@
endef
endif # HAS_FILE_FUNCTION
+################################################################################
# The source tips can come from the Mercurial repository, or in the files
# $(HGTIP_FILENAME) which contains the tip but is also positioned in the same
# directory as the original $(HGDIR) directory.
@@ -264,12 +264,14 @@
$(PRINTF) "\n" >> $@
endef
-# Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk
+# Create the HGTIP_FILENAME file. Called from closed/make/SourceBundles.gmk
define CreateHgTip
$(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME); \
$(ECHO) $1/$(HGTIP_FILENAME)
endef
+################################################################################
+
define SetupLogging
ifeq ($$(LOG_LEVEL), trace)
# Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
@@ -368,9 +370,9 @@
################################################################################
# Make directory without forking mkdir if not needed
+# 1: List of directories to create
MakeDir = \
- $(strip $(if $(subst $(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),,$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)),\
- $(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9)))
+ $(strip $(if $(wildcard $1), , $(shell $(MKDIR) -p $1)))
################################################################################
# Assign a variable only if it is empty
@@ -418,7 +420,8 @@
# Running mkdir and cp in the same shell speeds up copy intensive tasks in Cygwin
# significantly.
define install-file
- $(MKDIR) -p '$(@D)' && $(CP) -fP '$<' '$@'
+ $(call MakeDir, $(@D))
+ $(CP) -fP '$<' '$@'
endef
endif
@@ -518,9 +521,9 @@
# Param 1 - Dirs to find in
# Param 2 - (optional) specialization. Normally "-a \( ... \)" expression.
define CacheFind
- $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
+ $(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
$(shell $(FIND) $1 \( -type f -o -type l \) $2), \
- $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
+ $(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
endef
else
@@ -541,7 +544,7 @@
# 3 : Variable to add targets to
# 4 : Macro to call for copy operation
$2: $1
- $(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
+ $$(call LogInfo, Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@))
$$($$(strip $4))
$3 += $2
@@ -686,8 +689,10 @@
# Param 2 - A compact but representative name to describe this command
# Param 3 - Command to run
LogFailures = \
- ( ($(BASH) $(SRC_ROOT)/common/bin/logger.sh $1 $3 && $(RM) $1) || \
- (exitcode=$(DOLLAR)$(DOLLAR)? && $(MV) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && exit $(DOLLAR)$(DOLLAR)exitcode) )
+ ( $3 > >($(TEE) $1) 2> >($(TEE) $1 >&2) || \
+ (exitcode=$(DOLLAR)$(DOLLAR)? && \
+ $(CP) $1 $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(strip $2).log && \
+ exit $(DOLLAR)$(DOLLAR)exitcode) )
################################################################################
# Find lib dir for module
--- a/make/common/Modules.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/Modules.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -26,9 +26,6 @@
ifndef _MODULES_GMK
_MODULES_GMK := 1
-include JavaCompilation.gmk
-include SetupJavaCompilers.gmk
-
################################################################################
# Some platforms don't have the serviceability agent
ifeq ($(INCLUDE_SA), false)
@@ -49,51 +46,26 @@
#
# Find all modules with java sources by looking in the source dirs
-# jdk.hotspot.agent currently doesn't comply with source dir policy.
define FindJavaModules
$(filter-out $(MODULES_FILTER), $(sort $(notdir \
$(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
$(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
$(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS)) \
- $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))) \
- jdk.hotspot.agent)
+ $(patsubst %,%/*/$(OPENJDK_TARGET_OS_TYPE)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
endef
# Find all modules with source for the target platform.
-# jdk.hotspot.agent currently doesn't comply with source dir policy.
define FindAllModules
$(sort $(filter-out $(MODULES_FILTER) closed demo sample, \
$(notdir $(patsubst %/,%, $(dir \
$(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
$(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
- $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS)))))) \
- jdk.hotspot.agent))
+ $(patsubst %, %/*/$(OPENJDK_TARGET_OS_TYPE), $(ALL_TOP_SRC_DIRS))))))))
endef
################################################################################
-
-$(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
- SETUP := BOOT_JAVAC, \
- SRC := $(JDK_TOPDIR)/make/src/classes, \
- INCLUDES := build/tools/module, \
- EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
- BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
- DISABLE_SJAVAC := true))
-
-TOOL_GENMODULESLIST = $(JAVA_SMALL) \
- -cp "$(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist" \
- build.tools.module.GenModulesList
-
-MODULES_LIST_FILE := $(MAKESUPPORT_OUTPUTDIR)/modules.list
+# The module deps makefile is generated in make/GenerateModuleDeps.gmk
MODULE_DEPS_MAKEFILE := $(MAKESUPPORT_OUTPUTDIR)/module-deps.gmk
-
-$(MODULES_LIST_FILE): $(SRC_ROOT)/modules.xml \
- $(BUILD_GENMODULESLIST)
- $(TOOL_GENMODULESLIST) -o $@ $(filter %.xml, $^)
-
-$(MODULE_DEPS_MAKEFILE): $(MODULES_LIST_FILE)
- $(CAT) $^ | $(SED) -e 's/^\([^:]*\):/DEPS_\1 :=/g' > $@
-
-include $(MODULE_DEPS_MAKEFILE)
# Param 1: Module to find deps for
--- a/make/common/NativeCompilation.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/NativeCompilation.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -261,18 +261,17 @@
# The Visual Studio compiler lacks a feature for generating make dependencies, but by
# setting -showIncludes, all included files are printed. These are filtered out and
# parsed into make dependences.
- # Keep as much as possible on one execution line for best performance on Windows
- $(RM) $$($1_$2_DEP).exitvalue ; \
- ($(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
+ # Keep as much as possible on one execution line for best performance on Windows.
+ # No need to save exit code from compilation since pipefail is always active on
+ # Windows.
+ $(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
$$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
- $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) || echo $$$$? > $$($1_$2_DEP).exitvalue ) \
- | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v -e "^Note: including file:" \
+ $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) \
+ | $(GREP) -v -e "^Note: including file:" \
-e "^$(notdir $2)$$$$" || test "$$$$?" = "1" ; \
- ( test -s $$($1_$2_DEP).exitvalue \
- && exit `$(CAT) $$($1_$2_DEP).exitvalue` || true ) ; \
- ($(ECHO) $$@: \\ ; \
- $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) \
- | $(SORT) -u > $$($1_$2_DEP) ; \
+ $(ECHO) $$@: \\ > $$($1_$2_DEP) ; \
+ $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_OBJ).log \
+ | $(SORT) -u >> $$($1_$2_DEP) ; \
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
endif
endif
@@ -306,7 +305,6 @@
# RC_FLAGS flags for RC.
# MAPFILE mapfile
# REORDER reorder file
-# DEBUG_SYMBOLS add debug symbols (if configured on)
# CC the compiler to use, default is $(CC)
# LD the linker to use, default is $(LD)
# OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
@@ -539,25 +537,9 @@
$1_EXTRA_CXXFLAGS:=$$($1_EXTRA_CFLAGS)
endif
- ifeq ($(DEBUG_BINARIES), true)
- $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
- $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
- endif
- ifeq ($$($1_DEBUG_SYMBOLS), true)
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
- ifdef OPENJDK
- # Always add debug symbols
- $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
- $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
- else
- # Programs don't get the debug symbols added in the old build. It's not clear if
- # this is intentional.
- ifeq ($$($1_PROGRAM),)
- $1_EXTRA_CFLAGS+=$(CFLAGS_DEBUG_SYMBOLS)
- $1_EXTRA_CXXFLAGS+=$(CXXFLAGS_DEBUG_SYMBOLS)
- endif
- endif
- endif
+ ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
+ $1_EXTRA_CFLAGS += $(CFLAGS_DEBUG_SYMBOLS)
+ $1_EXTRA_CXXFLAGS += $(CXXFLAGS_DEBUG_SYMBOLS)
endif
ifneq (,$$($1_REORDER))
@@ -658,14 +640,14 @@
$$($1_RES).vardeps)
$$($1_RES): $$($1_VERSIONINFO_RESOURCE) $$($1_RES_VARDEPS_FILE)
- $(ECHO) $(LOG_INFO) "Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET)))"
+ $$(call LogInfo, Compiling resource $$(notdir $$($1_VERSIONINFO_RESOURCE)) (for $$(notdir $$($1_TARGET))))
$$($1_RC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) $(CC_OUT_OPTION)$$@ \
$$($1_VERSIONINFO_RESOURCE)
# Windows RC compiler does not support -showIncludes, so we mis-use CL for this.
$$($1_CC) $$($1_RC_FLAGS) $$($1_SYSROOT_CFLAGS) -showIncludes -nologo -TC \
- $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || exit 0
- ($(ECHO) $$($1_RES): \\ \
- && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw) > $$($1_RES_DEP)
+ $(CC_OUT_OPTION)$$($1_RES_DEP).obj $$($1_VERSIONINFO_RESOURCE) > $$($1_RES_DEP).raw 2>&1 || true ; \
+ $(ECHO) $$($1_RES): \\ > $$($1_RES_DEP) ; \
+ $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_RES_DEP).raw >> $$($1_RES_DEP) ; \
$(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_RES_DEP) > $$($1_RES_DEP_TARGETS)
endif
endif
@@ -696,67 +678,67 @@
# Need to make sure TARGET is first on list
$1 := $$($1_TARGET)
- ifeq ($$($1_STATIC_LIBRARY),)
- ifeq ($$($1_DEBUG_SYMBOLS), true)
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
- ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
- # The dependency on TARGET is needed on windows for debuginfo files
- # to be rebuilt properly.
- $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
+
+ ifeq ($(COPY_DEBUG_SYMBOLS), true)
+ # Only copy debug symbols for dynamic libraries and programs.
+ ifeq ($$($1_STATIC_LIBRARY), )
+ ifneq ($$($1_OUTPUT_DIR), $$($1_OBJECT_DIR))
+ # The dependency on TARGET is needed on windows for debuginfo files
+ # to be rebuilt properly.
+ $$($1_OUTPUT_DIR)/% : $$($1_OBJECT_DIR)/% $$($1_TARGET)
$(CP) $$< $$@
- endif
+ endif
- # Generate debuginfo files.
- ifeq ($(OPENJDK_TARGET_OS), windows)
- $1_EXTRA_LDFLAGS += "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
- "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
- $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
- # No separate command is needed for debuginfo on windows, instead
- # touch target to make sure it has a later time stamp than the debug
- # symbol files to avoid unnecessary relinking on rebuild.
- $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
+ # Generate debuginfo files.
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ $1_EXTRA_LDFLAGS += "-pdb:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb" \
+ "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
+ $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
+ $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
+ # No separate command is needed for debuginfo on windows, instead
+ # touch target to make sure it has a later time stamp than the debug
+ # symbol files to avoid unnecessary relinking on rebuild.
+ $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
- else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
- # Setup the command line creating debuginfo files, to be run after linking.
- # It cannot be run separately since it updates the original target file
- $1_CREATE_DEBUGINFO_CMDS := \
- $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
- $(CD) $$($1_OUTPUT_DIR) && \
- $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
+ else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
+ $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+ # Setup the command line creating debuginfo files, to be run after linking.
+ # It cannot be run separately since it updates the original target file
+ $1_CREATE_DEBUGINFO_CMDS := \
+ $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+ $(CD) $$($1_OUTPUT_DIR) && \
+ $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
- else ifeq ($(OPENJDK_TARGET_OS), macosx)
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
- # On Macosx, the debuginfo generation doesn't touch the linked binary, but
- # to avoid always relinking, touch it anyway to force a later timestamp than
- # the dSYM files.
- $1_CREATE_DEBUGINFO_CMDS := \
- $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
- $(TOUCH) $$($1_TARGET)
- endif # OPENJDK_TARGET_OS
+ else ifeq ($(OPENJDK_TARGET_OS), macosx)
+ $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_BASENAME).dSYM
+ # On Macosx, the debuginfo generation doesn't touch the linked binary, but
+ # to avoid always relinking, touch it anyway to force a later timestamp than
+ # the dSYM files.
+ $1_CREATE_DEBUGINFO_CMDS := \
+ $(DSYMUTIL) --out $$($1_DEBUGINFO_FILES) $$($1_TARGET) $$(NEWLINE) \
+ $(TOUCH) $$($1_TARGET)
+ endif # OPENJDK_TARGET_OS
- # This dependency dance ensures that debug info files get rebuilt
- # properly if deleted.
- $$($1_TARGET): $$($1_DEBUGINFO_FILES)
- $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
+ # This dependency dance ensures that debug info files get rebuilt
+ # properly if deleted.
+ $$($1_TARGET): $$($1_DEBUGINFO_FILES)
+ $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS)
- ifeq ($(ZIP_DEBUGINFO_FILES), true)
- $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
- $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
+ ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true)
+ $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
+ $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
- # The dependency on TARGET is needed for debuginfo files
- # to be rebuilt properly.
- $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
+ # The dependency on TARGET is needed for debuginfo files
+ # to be rebuilt properly.
+ $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
$(CD) $$($1_OBJECT_DIR) \
- && $(ZIP) -q $$@ $$(notdir $$($1_DEBUGINFO_FILES))
+ && $(ZIP) -q -r $$@ $$(notdir $$($1_DEBUGINFO_FILES))
- else
- $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
- endif
- endif # $(ENABLE_DEBUG_SYMBOLS)
- endif # $1_DEBUG_SYMBOLS
- endif # !STATIC_LIBRARY
+ else
+ $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_FILES))
+ endif
+ endif # !STATIC_LIBRARY
+ endif # COPY_DEBUG_SYMBOLS
ifeq ($$($1_STRIP_SYMBOLS), true)
ifneq ($$($1_STRIP), )
@@ -801,7 +783,7 @@
endif
# Keep as much as possible on one execution line for best performance
# on Windows
- $(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" ; \
+ $$(call LogInfo, Linking $$($1_BASENAME))
$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
$(LD_OUT_OPTION)$$@ \
@@ -820,7 +802,7 @@
# Generating a static library, ie object file archive.
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE)
- $(ECHO) $(LOG_INFO) "Archiving $$($1_STATIC_LIBRARY)"
+ $$(call LogInfo, Archiving $$($1_STATIC_LIBRARY))
$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
$$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
$$($1_RES))
@@ -842,7 +824,7 @@
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
$$($1_VARDEPS_FILE)
- $(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" ; \
+ $$(call LogInfo, Linking executable $$($1_BASENAME))
$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
$(EXE_OUT_OPTION)$$($1_TARGET) \
--- a/make/common/RMICompilation.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/RMICompilation.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -68,15 +68,15 @@
$$($1_TARGETS): $$($1_DEP_FILE) $$($1_CLASS_FILES)
$$($1_DEP_FILE): $$($1_CLASS_FILES)
- $(MKDIR) -p $$($1_STUB_CLASSES_DIR)
- $(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES) && \
+ $$(call LogInfo, Running rmic $$($1_ARGS) for $$($1_DOLLAR_SAFE_CLASSES))
+ $$(call MakeDir, $$($1_STUB_CLASSES_DIR))
$(RMIC) $$($1_ARGS) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
if [ "x$$($1_ARGS2)" != "x" ]; then \
$(ECHO) $(LOG_INFO) Running rmic $$($1_ARGS2) for $$($1_DOLLAR_SAFE_CLASSES) && \
$(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
- fi;
+ fi; \
$(TOUCH) $$@
--- a/make/common/TestFilesCompilation.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/TestFilesCompilation.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -87,7 +87,7 @@
CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$($1_PREFIX)$$(name)), \
LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$($1_PREFIX)$$(name)), \
OPTIMIZATION := LOW, \
- DEBUG_SYMBOLS := true)) \
+ )) \
$$(eval $1 += $$(BUILD_TEST_$$(name)) ) \
)
--- a/make/common/TextFileProcessing.gmk Thu Jan 21 10:16:09 2016 -0800
+++ b/make/common/TextFileProcessing.gmk Wed Jul 05 21:14:30 2017 +0200
@@ -35,12 +35,12 @@
# param 4 = the target file name (possibly with a partial path)
define SetupSingleTextFileForProcessing
$(strip $3)/$(strip $4): $2 $$($1_VARDEPS_FILE)
- $(ECHO) $(LOG_INFO) "Processing $(strip $4)"
- $(MKDIR) -p '$$(@D)'
- $(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp'
- $$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp'
- $$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp'
- $(RM) '$$@.includes.tmp'
+ $$(call LogInfo, Processing $(strip $4))
+ $$(call MakeDir, $$(@D))
+ $(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp' ; \
+ $$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp' ; \
+ $$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp' ; \
+ $(RM) '$$@.includes.tmp' ; \
$(MV) '$$@.replacements.tmp' '$$@'
$1 += $(strip $3)/$(strip $4)
--- a/make/jprt.properties Thu Jan 21 10:16:09 2016 -0800
+++ b/make/jprt.properties Wed Jul 05 21:14:30 2017 +0200
@@ -34,13 +34,8 @@
# The current release name
jprt.tools.default.release=jdk9
-# Check if this is the equivalent of a hotspot push job
-# Interpret -testset hotspot to mean exactly that
-my.is.hotspot.job.hotspot=true
-my.is.hotspot.job=${my.is.hotspot.job.${jprt.test.set}}
-
-# Disable syncing the source after builds and tests are done
-jprt.sync.push=${my.is.hotspot.job ? false : true}
+# Allow concurrent changes to be merged in prior to pushing
+jprt.sync.push=true
# Directories to be excluded from the source bundles
jprt.bundle.exclude.src.dirs=build dist webrev
@@ -48,6 +43,9 @@
# Use configure when building
jprt.build.use.configure=true
+# Disable the need for preinstalled Xcode
+jprt.macosx.jdk9.target.attribute.compilerXcode511.appliesTo.builds=none
+
# Set up the run flavors (jvm variants)
jprt.run.flavors=c1,c2,default,${my.additional.run.flavors}
@@ -104,7 +102,7 @@
--with-output-sync=recurse \
--with-boot-jdk=$ALT_BOOTDIR \
--with-jobs=$ALT_PARALLEL_COMPILE_JOBS \
- --with-version-opt=$JPRT_JOB_ID \
+ --with-version-opt=$JPRT_JOB_ID \
MAKE=$JPRT_MAKE \
${my.additional.build.configure.args.${jprt.test.set}} \
${my.custom.build.configure.args}
@@ -162,21 +160,21 @@
my.build.targets.default= \
solaris_sparcv9_5.11-{product|fastdebug}, \
solaris_x64_5.11-{product|fastdebug}, \
- linux_i586_2.6-{product|fastdebug}, \
- linux_x64_2.6-{product|fastdebug}, \
+ linux_i586_3.8-{product|fastdebug}, \
+ linux_x64_3.8-{product|fastdebug}, \
macosx_x64_10.9-{product|fastdebug}, \
- windows_i586_6.2-{product|fastdebug}, \
- windows_x64_6.2-{product|fastdebug}
+ windows_i586_6.3-{product|fastdebug}, \
+ windows_x64_6.3-{product|fastdebug}
# Test target list (no fastdebug & limited c2 testing)
my.test.target.set= \
solaris_sparcv9_5.11-product-c2-TESTNAME, \
solaris_x64_5.11-product-c2-TESTNAME, \
- linux_i586_2.6-product-{c1|c2}-TESTNAME, \
- linux_x64_2.6-product-c2-TESTNAME, \
+ linux_i586_3.8-product-{c1|c2}-TESTNAME, \
+ linux_x64_3.8-product-c2-TESTNAME, \
macosx_x64_10.9-product-c2-TESTNAME, \
- windows_i586_6.2-product-c1-TESTNAME, \
- windows_x64_6.2-product-c2-TESTNAME
+ windows_i586_6.3-product-c1-TESTNAME, \
+ windows_x64_6.3-product-c2-TESTNAME
# Default vm test targets (testset=default)
my.test.targets.default= \
@@ -260,8 +258,8 @@
my.test.target.set.jck= \
solaris_sparcv9_5.11-product-c2-JCK7TESTRULE, \
solaris_x64_5.11-product-c2-JCK7TESTRULE, \
- linux_i586_2.6-product-c1-JCK7TESTRULE, \
- linux_x64_2.6-product-c2-JCK7TESTRULE
+ linux_i586_3.8-product-c1-JCK7TESTRULE, \
+ linux_x64_3.8-product-c2-JCK7TESTRULE
# JCK testset targets
my.make.rule.test.targets.jck= \
@@ -284,13 +282,13 @@
my.build.targets.hotspot= \
solaris_sparcv9_5.11-{product|fastdebug}, \
solaris_x64_5.11-{product|fastdebug}, \
- linux_i586_2.6-{product|fastdebug}, \
- linux_x64_2.6-{product|fastdebug}, \
+ linux_i586_3.8-{product|fastdebug}, \
+ linux_x64_3.8-{product|fastdebug}, \
macosx_x64_10.9-{product|fastdebug}, \
- windows_i586_6.2-{product|fastdebug}, \
- windows_x64_6.2-{product|fastdebug}, \
+ windows_i586_6.3-{product|fastdebug}, \
+ windows_x64_6.3-{product|fastdebug}, \
solaris_x64_5.11-{debugOpen}, \
- linux_x64_2.6-{productOpen}, \
+ linux_x64_3.8-{productOpen}, \
${my.additional.build.targets.hotspot}
# Tests to run on the various platforms for hotspot push jobs
@@ -317,27 +315,27 @@
solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_G1
my.test.targets.hotspot.linux.i586= \
- linux_i586_2.6-{product|fastdebug}-{c1|c2}-jvm98, \
- linux_i586_2.6-{product|fastdebug}-c2-jvm98_nontiered, \
- linux_i586_2.6-{product|fastdebug}-{c1|c2}-scimark, \
- linux_i586_2.6-product-c1-runThese8_Xcomp_lang, \
- linux_i586_2.6-product-c1-runThese8_Xcomp_vm, \
- linux_i586_2.6-fastdebug-c1-runThese8_Xshare, \
- linux_i586_2.6-fastdebug-c2-runThese8_Xcomp_lang, \
- linux_i586_2.6-fastdebug-c2-runThese8_Xcomp_vm, \
- linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC, \
- linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC, \
- linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_CMS, \
- linux_i586_2.6-{product|fastdebug}-{c1|c2}-GCBasher_G1
+ linux_i586_3.8-{product|fastdebug}-{c1|c2}-jvm98, \
+ linux_i586_3.8-{product|fastdebug}-c2-jvm98_nontiered, \
+ linux_i586_3.8-{product|fastdebug}-{c1|c2}-scimark, \
+ linux_i586_3.8-product-c1-runThese8_Xcomp_lang, \
+ linux_i586_3.8-product-c1-runThese8_Xcomp_vm, \
+ linux_i586_3.8-fastdebug-c1-runThese8_Xshare, \
+ linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_lang, \
+ linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm, \
+ linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC, \
+ linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC, \
+ linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_CMS, \
+ linux_i586_3.8-{product|fastdebug}-{c1|c2}-GCBasher_G1
my.test.targets.hotspot.linux.x64= \
- linux_x64_2.6-{product|fastdebug}-c2-jvm98, \
- linux_x64_2.6-{product|fastdebug}-c2-jvm98_nontiered, \
- linux_x64_2.6-{product|fastdebug}-c2-scimark, \
- linux_x64_2.6-{product|fastdebug}-c2-GCBasher_SerialGC, \
- linux_x64_2.6-{product|fastdebug}-c2-GCBasher_ParallelGC, \
- linux_x64_2.6-{product|fastdebug}-c2-GCBasher_CMS, \
- linux_x64_2.6-{product|fastdebug}-c2-GCBasher_G1
+ linux_x64_3.8-{product|fastdebug}-c2-jvm98, \
+ linux_x64_3.8-{product|fastdebug}-c2-jvm98_nontiered, \
+ linux_x64_3.8-{product|fastdebug}-c2-scimark, \
+ linux_x64_3.8-{product|fastdebug}-c2-GCBasher_SerialGC, \
+ linux_x64_3.8-{product|fastdebug}-c2-GCBasher_ParallelGC, \
+ linux_x64_3.8-{product|fastdebug}-c2-GCBasher_CMS, \
+ linux_x64_3.8-{product|fastdebug}-c2-GCBasher_G1
my.test.targets.hotspot.macosx.x64= \
macosx_x64_10.9-{product|fastdebug}-c2-jvm98, \
@@ -349,34 +347,34 @@
macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_G1
my.test.targets.hotspot.windows.i586= \
- windows_i586_6.2-{product|fastdebug}-{c1|c2}-jvm98, \
- windows_i586_6.2-{product|fastdebug}-c2-jvm98_nontiered, \
- windows_i586_6.2-{product|fastdebug}-{c1|c2}-scimark, \
- windows_i586_6.2-product-{c1|c2}-runThese8, \
- windows_i586_6.2-product-{c1|c2}-runThese8_Xcomp_lang, \
- windows_i586_6.2-product-{c1|c2}-runThese8_Xcomp_vm, \
- windows_i586_6.2-fastdebug-c1-runThese8_Xshare, \
- windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC, \
- windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC, \
- windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_CMS, \
- windows_i586_6.2-{product|fastdebug}-{c1|c2}-GCBasher_G1
+ windows_i586_6.3-{product|fastdebug}-{c1|c2}-jvm98, \
+ windows_i586_6.3-{product|fastdebug}-c2-jvm98_nontiered, \
+ windows_i586_6.3-{product|fastdebug}-{c1|c2}-scimark, \
+ windows_i586_6.3-product-{c1|c2}-runThese8, \
+ windows_i586_6.3-product-{c1|c2}-runThese8_Xcomp_lang, \
+ windows_i586_6.3-product-{c1|c2}-runThese8_Xcomp_vm, \
+ windows_i586_6.3-fastdebug-c1-runThese8_Xshare, \
+ windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_SerialGC, \
+ windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_ParallelGC, \
+ windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_CMS, \
+ windows_i586_6.3-{product|fastdebug}-{c1|c2}-GCBasher_G1
my.test.targets.hotspot.windows.x64= \
- windows_x64_6.2-{product|fastdebug}-c2-jvm98, \
- windows_x64_6.2-{product|fastdebug}-c2-jvm98_nontiered, \
- windows_x64_6.2-{product|fastdebug}-c2-scimark, \
- windows_x64_6.2-product-c2-runThese8, \
- windows_x64_6.2-product-c2-runThese8_Xcomp_lang, \
- windows_x64_6.2-product-c2-runThese8_Xcomp_vm, \
- windows_x64_6.2-{product|fastdebug}-c2-GCBasher_SerialGC, \
- windows_x64_6.2-{product|fastdebug}-c2-GCBasher_ParallelGC, \
- windows_x64_6.2-{product|fastdebug}-c2-GCBasher_CMS, \
- windows_x64_6.2-{product|fastdebug}-c2-GCBasher_G1
+ windows_x64_6.3-{product|fastdebug}-c2-jvm98, \
+ windows_x64_6.3-{product|fastdebug}-c2-jvm98_nontiered, \
+ windows_x64_6.3-{product|fastdebug}-c2-scimark, \
+ windows_x64_6.3-product-c2-runThese8, \
+ windows_x64_6.3-product-c2-runThese8_Xcomp_lang, \
+ windows_x64_6.3-product-c2-runThese8_Xcomp_vm, \
+ windows_x64_6.3-{product|fastdebug}-c2-GCBasher_SerialGC, \
+ windows_x64_6.3-{product|fastdebug}-c2-GCBasher_ParallelGC, \
+ windows_x64_6.3-{product|fastdebug}-c2-GCBasher_CMS, \
+ windows_x64_6.3-{product|fastdebug}-c2-GCBasher_G1
# Some basic "smoke" tests for OpenJDK builds
my.test.targets.hotspot.open= \
solaris_x64_5.11-{productOpen|fastdebugOpen}-c2-jvm98, \
- linux_x64_2.6-{productOpen|fastdebugOpen}-c2-jvm98
+ linux_x64_3.8-{productOpen|fastdebugOpen}-c2-jvm98
# The complete list of test targets for jprt
my.test.targets.hotspot= \
@@ -399,24 +397,24 @@
# Make file based test targets
my.make.rule.test.targets.hotspot.basicvmtests= \
- linux_i586_2.6-*-default-hotspot_basicvmtest, \
- linux_x64_2.6-*-default-hotspot_basicvmtest, \
+ linux_i586_3.8-*-default-hotspot_basicvmtest, \
+ linux_x64_3.8-*-default-hotspot_basicvmtest, \
macosx_x64_10.9-*-default-hotspot_basicvmtest, \
solaris_sparcv9_5.11-*-default-hotspot_basicvmtest, \
solaris_x64_5.11-*-default-hotspot_basicvmtest, \
- windows_i586_6.2-*-default-hotspot_basicvmtest, \
- windows_x64_6.2-*-default-hotspot_basicvmtest
-
+ windows_i586_6.3-*-default-hotspot_basicvmtest, \
+ windows_x64_6.3-*-default-hotspot_basicvmtest
+
my.make.rule.test.targets.hotspot.reg.group= \
solaris_sparcv9_5.11-fastdebug-c2-GROUP, \
solaris_x64_5.11-fastdebug-c2-GROUP, \
- linux_i586_2.6-fastdebug-c2-GROUP, \
- linux_x64_2.6-fastdebug-c2-GROUP, \
+ linux_i586_3.8-fastdebug-c2-GROUP, \
+ linux_x64_3.8-fastdebug-c2-GROUP, \
macosx_x64_10.9-fastdebug-c2-GROUP, \
- windows_i586_6.2-fastdebug-c2-GROUP, \
- windows_x64_6.2-fastdebug-c2-GROUP, \
- linux_i586_2.6-fastdebug-c1-GROUP, \
- windows_i586_6.2-fastdebug-c1-GROUP
+ windows_i586_6.3-fastdebug-c2-GROUP, \
+ windows_x64_6.3-fastdebug-c2-GROUP, \
+ linux_i586_3.8-fastdebug-c1-GROUP, \
+ windows_i586_6.3-fastdebug-c1-GROUP
# Hotspot jtreg tests
my.make.rule.test.targets.hotspot.reg= \
--- a/modules.xml Thu Jan 21 10:16:09 2016 -0800
+++ b/modules.xml Wed Jul 05 21:14:30 2017 +0200
@@ -237,6 +237,7 @@
<to>jdk.charsets</to>
<to>jdk.management.resource</to>
<to>jdk.scripting.nashorn</to>
+ <to>jdk.vm.ci</to>
</export>
<export>
<name>jdk.internal.perf</name>
@@ -398,6 +399,7 @@
<to>java.xml.crypto</to>
<to>jdk.crypto.ec</to>
<to>jdk.crypto.pkcs11</to>
+ <to>jdk.crypto.ucrypto</to>
<to>jdk.naming.dns</to>
</export>
<export>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/Makefile Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,114 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+#
+# This is a temporary standalone makefile
+#
+
+BUILD_DIR := $(shell pwd)/build
+CLASSES_DIR := ${BUILD_DIR}/classes
+IMAGE_DIR := ${BUILD_DIR}/image
+RUN_DIR := $(shell pwd)/run
+
+SRC_DIR := src/share/classes/
+SOURCES := ${SRC_DIR}/jdk/test/failurehandler/*.java \
+ ${SRC_DIR}/jdk/test/failurehandler/action/*.java \
+ ${SRC_DIR}/jdk/test/failurehandler/jtreg/*.java \
+ ${SRC_DIR}/jdk/test/failurehandler/value/*.java
+
+CONF_DIR = src/share/conf
+
+JAVA_RELEASE = 7
+
+TARGET_JAR = ${IMAGE_DIR}/lib/jtregFailureHandler.jar
+
+OS_NAME := $(shell uname -o 2>&1)
+
+ifeq ("${OS_NAME}", "Cygwin")
+BUILD_DIR := $(shell cygpath -m "${BUILD_DIR}")
+CLASSES_DIR := $(shell cygpath -m "${CLASSES_DIR}")
+IMAGE_DIR := $(shell cygpath -m "${IMAGE_DIR}") RUN_DIR := $(shell cygpath -m "${RUN_DIR}")
+SRC_DIR := $(shell cygpath -m "${SRC_DIR}")
+JTREG_HOME := $(shell cygpath -m "${JTREG_HOME}")
+CC := "cl.exe"
+endif
+
+all: clean test
+
+native: require_env
+ifeq ("${OS_NAME}", "Cygwin")
+ "${CC}" src/windows/native/jdk/test/failurehandler/jtreg/*.c \
+ -I"$(shell cygpath -w ${JAVA_HOME}/include)" \
+ -I"$(shell cygpath -w ${JAVA_HOME}/include/win32)" \
+ /link /MACHINE:X64 /DLL /OUT:timeoutHandler.dll
+endif
+
+check_defined = $(foreach 1,$1,$(__check_defined))
+__check_defined = $(if $(value $1),, $(error $1 is not set))
+
+classes: require_env
+ mkdir -p ${IMAGE_DIR}/bin ${IMAGE_DIR}/lib ${CLASSES_DIR}
+ "${JAVA_HOME}"/bin/javac -target ${JAVA_RELEASE} -source ${JAVA_RELEASE} \
+ -sourcepath $(shell pwd) \
+ -classpath ${JTREG_HOME}/lib/jtreg.jar:${JAVA_HOME}/lib/tools.jar \
+ -d ${CLASSES_DIR} \
+ ${SOURCES}
+ "${JAVA_HOME}"/bin/jar cf ${TARGET_JAR} -C ${CLASSES_DIR} .
+ "${JAVA_HOME}"/bin/jar uf ${TARGET_JAR} -C ${CONF_DIR} .
+
+#
+# Use JTREG_TEST_OPTS for test VM options
+# Use JTREG_TESTS for jtreg tests parameter
+#
+test: require_env build
+ rm -rf ${RUN_DIR}
+ mkdir -p ${RUN_DIR}
+ "${JTREG_HOME}"/bin/jtreg \
+ -jdk:"${JAVA_HOME}" \
+ ${JTREG_TEST_OPTS} \
+ -timeout:0.1 -va -retain:all \
+ -noreport \
+ -agentvm \
+ -thd:"${TARGET_JAR}" \
+ -th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
+ -od:"${TARGET_JAR}" \
+ -o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
+ -w:${RUN_DIR}/JTwork -r:${RUN_DIR}/JTreport \
+ $(if ${JTREG_TESTS}, ${JTREG_TESTS}, test) \
+ && false || true
+
+debug: JTREG_TEST_OPTS += "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'"
+debug: test
+
+require_env:
+ $(call check_defined, JAVA_HOME)
+ $(call check_defined, JTREG_HOME)
+
+clean:
+ rm -rf "${BUILD_DIR}" "${RUN_DIR}"
+
+build: classes native
+
+.PHONY: all build classes native test require_env clean
+.DEFAULT: all
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/README Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,107 @@
+Copyright (c) 2015, 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.
+
+
+
+DESCRIPTION
+
+The purpose of this library is gathering diagnostic information on test
+failures and timeouts. The library runs platform specific tools, which are
+configured in the way described below. The collected data will be available
+in HTML format next to JTR files.
+
+The library uses JTHarness Observer and jtreg TimeoutHandler extensions points.
+
+DEPENDENCES
+
+The library requires jtreg 4b13+ and JDK 7+.
+
+BUILDING
+
+To build a library, one should simply run make with 'JTREG_HOME' and
+'JAVA_HOME' environment variables set. 'JAVA_HOME' should contain path to JDK,
+'JTREG_HOME' -- path to jtreg.
+
+'image/lib/jtregFailureHandler.jar' is created on successful build.
+
+CONFIGURATION
+
+Properties files are used to configure the library. They define which actions
+to be performed in case of individual test failure or timeout. Each platform
+family uses its own property file (named '<platform>.properties'). For platform
+independent actions, 'common.properties' is used.
+
+Actions to be performed on each failure are listed in 'environment' property.
+Extra actions for timeouts are listed in 'onTimeout'.
+
+Each action is defined via the following parameters:
+ - 'javaOnly' -- run the action only for java applications, false by default
+ - 'app' -- an application to run, mandatory parameter
+ - 'args' -- application command line arguments, none by default
+ - 'params' -- a structure which defines how an application should be run,
+ described below
+
+Actions listed in 'onTimeout' are "patterned" actions. Besides the parameters
+listed above, they also have 'pattern' parameter -- a string which will be
+replaced by PID in 'args' parameter before action execution.
+
+'params' structure has the following parameters:
+ - repeat -- how many times an action will be run, 1 by default
+ - pause -- delay in ms between iterations, 500 by default
+ - timeout -- time limitation for iteration in ms, 20 000 by default
+ - stopOnError -- if true, an action will be interrupted after the first error,
+ false by default
+
+From '<platform>.properties', the library reads the following parameters
+ - 'config.execSuffix' -- a suffix for all binary application file names
+ - 'config.getChildren' -- a "patterned" action used to get the list of all
+ children
+
+For simplicity we use parameter values inheritance. This means that we are
+looking for the most specified parameter value. If we do not find it, we are
+trying to find less specific value by reducing prefix.
+For example, if properties contains 'p1=A', 'a.p1=B', 'a.b.p1=C', then
+parameter 'p1' will be:
+ - 'C' for 'a.b.c'
+ - 'B' for 'a.c'
+ - 'A' for 'b.c'
+
+RUNNING
+
+To enable the library in jtreg, the following options should be set:
+ - '-timeoutHandlerDir' points to the built jar ('jtregFailureHandler.jar')
+ - '-observerDir' points to the built jar
+ - '-timeoutHandler' equals to jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler
+ - '-observer' equals to jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver
+
+In case of environment issues during an action execution, such as missing
+application, hung application, lack of disk space, etc, the corresponding
+warning appears and the library proceeds to next action.
+
+EXAMPLES
+
+$ ${JTREG_HOME}/bin/jtreg -jdk:${JAVA_HOME} \
+ -timeoutHandlerDir:./image/lib/jtregFailureHandler.jar \
+ -observerDir:./image/lib/jtregFailureHandler.jar \
+ -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler\
+ -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
+ ${WS}/hotspot/test/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/ElapsedTimePrinter.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+import java.io.PrintWriter;
+import java.util.concurrent.TimeUnit;
+
+public class ElapsedTimePrinter implements AutoCloseable {
+ private final String name;
+ private final PrintWriter out;
+ private final Stopwatch stopwatch;
+
+ public ElapsedTimePrinter(Stopwatch stopwatch, String name,
+ PrintWriter out) {
+ this.stopwatch = stopwatch;
+ this.name = name;
+ this.out = out;
+ stopwatch.start();
+ }
+
+ @Override
+ public void close() {
+ stopwatch.stop();
+ out.printf("%s took %d s%n", name,
+ TimeUnit.NANOSECONDS.toSeconds(stopwatch.getElapsedTimeNs()));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/EnvironmentInfoGatherer.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+public interface EnvironmentInfoGatherer {
+ void gatherEnvironmentInfo(HtmlSection section);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/GathererFactory.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+import jdk.test.failurehandler.action.ActionHelper;
+import jdk.test.failurehandler.value.InvalidValueException;
+
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.util.Properties;
+
+public final class GathererFactory {
+ private final Path workdir;
+ private final Path[] jdks;
+ private final PrintWriter log;
+ private final String osName;
+
+ public GathererFactory(String osName, Path workdir, PrintWriter log, Path... jdks) {
+ this.osName = osName;
+ this.workdir = workdir;
+ this.log = log;
+ this.jdks = jdks;
+ }
+
+ public EnvironmentInfoGatherer getEnvironmentInfoGatherer() {
+ return create();
+ }
+
+ public ProcessInfoGatherer getProcessInfoGatherer() {
+ return create();
+ }
+
+ private ToolKit create() {
+ Properties osProperty = Utils.getProperties(osName);
+ try {
+ ActionHelper helper = new ActionHelper(workdir, "config", osProperty, jdks);
+ return new ToolKit(helper, log, osName, "common");
+ } catch (InvalidValueException e) {
+ throw new IllegalStateException("can't create tool kit", e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlPage.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+import java.io.PrintWriter;
+import java.util.Objects;
+
+public class HtmlPage implements AutoCloseable {
+ private final PrintWriter writer;
+ private final HtmlSection rootSection;
+
+ public HtmlPage(PrintWriter writer) {
+ Objects.requireNonNull(writer, "writer cannot be null");
+ this.writer = writer;
+ rootSection = new HtmlSection(writer);
+ }
+
+ @Override
+ public void close() {
+ writer.close();
+ }
+
+ public HtmlSection getRootSection() {
+ return rootSection;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+public class HtmlSection {
+ protected final HtmlSection rootSection;
+ protected final String id;
+ protected final String name;
+
+ public PrintWriter getWriter() {
+ return textWriter;
+ }
+
+ protected final PrintWriter pw;
+ protected final PrintWriter textWriter;
+ protected boolean closed;
+
+ private HtmlSection child;
+
+
+ public HtmlSection(PrintWriter pw) {
+ this(pw, "", null, null);
+ }
+
+ private HtmlSection(PrintWriter pw, String id, String name, HtmlSection rootSection) {
+ this.pw = pw;
+ textWriter = new PrintWriter(new HtmlFilterWriter(pw));
+ this.id = id;
+ this.name = name;
+ child = null;
+ // main
+ if (rootSection == null) {
+ this.rootSection = this;
+ this.pw.println("<html>");
+ this.pw.println("<style>\n"
+ + "div { display:none;}\n"
+ + "</style>\n"
+ + "\n"
+ + "<script>\n"
+ + "function show(e) {\n"
+ + " while (e != null) {\n"
+ + " if (e.tagName == 'DIV') {\n"
+ + " e.style.display = 'block';\n"
+ + " }\n"
+ + " e = e.parentNode;\n"
+ + " }\n"
+ + "}\n"
+ + "\n"
+ + "function toggle(id) {\n"
+ + " e = document.getElementById(id);\n"
+ + " d = e.style.display;\n"
+ + " if (d == 'block') {\n"
+ + " e.style.display = 'none';\n"
+ + " } else {\n"
+ + " show(e);\n"
+ + " }\n"
+ + "}\n"
+ + "\n"
+ + "function main() {\n"
+ + " index = location.href.indexOf(\"#\");"
+ + " if (index != -1) {\n"
+ + " show(document.getElementById(location.href.substring(index + 1)));\n"
+ + " }\n"
+ + "}\n"
+ + "\n"
+ + "</script>\n"
+ + "</head>");
+
+ this.pw.println("<body onload='main()'>");
+ } else {
+ this.rootSection = rootSection;
+ this.pw.print("<ul>");
+ }
+ }
+
+ public HtmlSection createChildren(String section) {
+ if (child != null) {
+ if (child.name.equals(section)) {
+ return child;
+ }
+ child.close();
+ }
+ child = new SubSection(this, section, rootSection);
+ return child;
+ }
+
+ protected final void removeChild(HtmlSection child) {
+ if (this.child == child) {
+ this.child = null;
+ }
+ }
+
+ public void close() {
+ closeChild();
+ if (closed) {
+ return;
+ }
+ closed = true;
+
+ if (rootSection == this) {
+ pw.println("</body>");
+ pw.println("</html>");
+ pw.close();
+ } else {
+ pw.println("</ul>");
+ }
+
+ }
+
+ protected final void closeChild() {
+ if (child != null) {
+ child.close();
+ child = null;
+ }
+ }
+
+ public void link(HtmlSection section, String child, String name) {
+ String path = section.id;
+ if (path.isEmpty()) {
+ path = child;
+ } else if (child != null) {
+ path = String.format("%s.%s", path, child);
+ }
+ pw.printf("<a href=\"#%1$s\" onclick=\"show(document.getElementById('%1$s')); return true;\">%2$s</a>%n",
+ path, name);
+ }
+
+ public HtmlSection createChildren(String[] sections) {
+ int i = 0;
+ int n = sections.length;
+ HtmlSection current = rootSection;
+ if (current != null) {
+ for (; i < n && current.child != null;
+ ++i, current = current.child) {
+ if (!sections[i].equals(current.child.name)) {
+ break;
+ }
+ }
+ }
+ for (; i < n; ++i) {
+ current = current.createChildren(sections[i]);
+ }
+ return current;
+ }
+
+ private static class SubSection extends HtmlSection {
+ private final HtmlSection parent;
+
+ public SubSection(HtmlSection parent, String name,
+ HtmlSection rootSection) {
+ super(parent.pw,
+ parent.id.isEmpty()
+ ? name
+ : String.format("%s.%s", parent.id, name),
+ name, rootSection);
+ this.parent = parent;
+ pw.printf("<li><a name='%1$s'/><a href='#%1$s' onclick=\"toggle('%1$s'); return false;\">%2$s</a><div id='%1$s'><code><pre>",
+ id, name);
+ }
+
+ @Override
+ public void close() {
+ closeChild();
+ if (closed) {
+ return;
+ }
+ pw.print("</pre></code></div></li><!-- " + id + "-->");
+ parent.removeChild(this);
+ super.close();
+ }
+ }
+
+ private static class HtmlFilterWriter extends FilterWriter {
+ public HtmlFilterWriter(PrintWriter pw) {
+ super(pw);
+ }
+
+ @Override
+ public void write(int c) throws IOException {
+ switch (c) {
+ case '<':
+ super.write("<", 0, 4);
+ break;
+ case '>':
+ super.write(">", 0, 4);
+ break;
+ case '"':
+ super.write(""", 0, 5);
+ break;
+ case '&':
+ super.write("&", 0, 4);
+ break;
+ default:
+ super.write(c);
+ }
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ for (int i = off; i < len; ++i){
+ write(cbuf[i]);
+ }
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ for (int i = off; i < len; ++i){
+ write(str.charAt(i));
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/ProcessInfoGatherer.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+public interface ProcessInfoGatherer {
+ void gatherProcessInfo(HtmlSection section, long pid);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/Stopwatch.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+public final class Stopwatch {
+ protected boolean isResultAvailable;
+ protected boolean isRunning;
+
+ private long startTimeNs;
+ private long stopTimeNs;
+
+ public Stopwatch() {
+ isResultAvailable = false;
+ }
+
+ /**
+ * Starts measuring time.
+ */
+ public void start() {
+ startTimeNs = System.nanoTime();
+ isRunning = true;
+ }
+
+ /**
+ * Stops measuring time.
+ */
+ public void stop() {
+ if (!isRunning) {
+ throw new IllegalStateException(" hasn't been started");
+ }
+ stopTimeNs = System.nanoTime();
+ isRunning = false;
+ isResultAvailable = true;
+ }
+
+ /**
+ * @return time in nanoseconds measured between
+ * calls of {@link #start()} and {@link #stop()} methods.
+ *
+ * @throws IllegalStateException if called without preceding
+ * {@link #start()} {@link #stop()} method
+ */
+ public long getElapsedTimeNs() {
+ if (isRunning) {
+ throw new IllegalStateException("hasn't been stopped");
+ }
+ if (!isResultAvailable) {
+ throw new IllegalStateException("was not run");
+ }
+ return stopTimeNs - startTimeNs;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/ToolKit.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+import jdk.test.failurehandler.action.ActionSet;
+import jdk.test.failurehandler.action.ActionHelper;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+public class ToolKit implements EnvironmentInfoGatherer, ProcessInfoGatherer {
+ private final List<ActionSet> actions = new ArrayList<>();
+ private final ActionHelper helper;
+
+ public ToolKit(ActionHelper helper, PrintWriter log, String... names) {
+ this.helper = helper;
+ for (String name : names) {
+ actions.add(new ActionSet(helper, log, name));
+ }
+ }
+
+ @Override
+ public void gatherEnvironmentInfo(HtmlSection section) {
+ for (ActionSet set : actions) {
+ set.gatherEnvironmentInfo(section);
+ }
+ }
+
+ @Override
+ public void gatherProcessInfo(HtmlSection section, long pid) {
+ Queue<Long> pids = new LinkedList<>();
+ pids.add(pid);
+ for (Long p = pids.poll(); p != null; p = pids.poll()) {
+ HtmlSection pidSection = section.createChildren("" + p);
+ for (ActionSet set : actions) {
+ set.gatherProcessInfo(pidSection, p);
+ }
+ List<Long> children = helper.getChildren(pidSection, p);
+ if (!children.isEmpty()) {
+ HtmlSection s = pidSection.createChildren("children");
+ for (Long c : children) {
+ s.link(section, c.toString(), c.toString());
+ }
+ pids.addAll(children);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/Utils.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Properties;
+
+public final class Utils {
+ private static final int BUFFER_LENGTH = 1024;
+
+ public static String prependPrefix(String prefix, String name) {
+ return (prefix == null || prefix.isEmpty())
+ ? name
+ : (name == null || name.isEmpty())
+ ? prefix
+ : String.format("%s.%s", prefix, name);
+ }
+
+ public static void copyStream(InputStream in, OutputStream out)
+ throws IOException {
+ int n;
+ byte[] buffer = new byte[BUFFER_LENGTH];
+ while ((n = in.read(buffer)) != -1) {
+ out.write(buffer, 0, n);
+ }
+ out.flush();
+ }
+
+ public static void copyStream(Reader in, Writer out)
+ throws IOException {
+ int n;
+ char[] buffer = new char[BUFFER_LENGTH];
+ while ((n = in.read(buffer)) != -1) {
+ out.write(buffer, 0, n);
+ }
+ out.flush();
+ }
+
+ public static Properties getProperties(String name) {
+ Properties properties = new Properties();
+ String resourceName = String.format(
+ "/%s.%s", name.toLowerCase(), "properties");
+ InputStream stream = Utils.class.getResourceAsStream(resourceName);
+ if (stream == null) {
+ throw new IllegalStateException(String.format(
+ "resource '%s' doesn't exist%n", resourceName));
+ }
+ try {
+ try {
+ properties.load(stream);
+ } finally {
+ stream.close();
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException(String.format(
+ "can't read resource '%s' : %s%n",
+ resourceName, e.getMessage()), e);
+ }
+ return properties;
+ }
+
+ private Utils() { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/Action.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.action;
+
+import jdk.test.failurehandler.HtmlSection;
+
+public interface Action {
+ boolean isJavaOnly();
+ HtmlSection getSection(HtmlSection section);
+
+ ActionParameters getParameters();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.action;
+
+import com.sun.tools.attach.VirtualMachine;
+import com.sun.tools.attach.VirtualMachineDescriptor;
+import jdk.test.failurehandler.value.InvalidValueException;
+import jdk.test.failurehandler.value.Value;
+import jdk.test.failurehandler.value.ValueHandler;
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.Stopwatch;
+import jdk.test.failurehandler.Utils;
+
+import java.io.BufferedReader;
+import java.io.CharArrayReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.TimeUnit;
+
+public class ActionHelper {
+ private final Path workDir;
+ @Value(name = "execSuffix")
+ private String executableSuffix = "";
+ private Path[] paths;
+
+ private final PatternAction getChildren;
+
+ public ActionHelper(Path workDir, String prefix, Properties properties,
+ Path... jdks) throws InvalidValueException {
+ this.workDir = workDir.toAbsolutePath();
+ getChildren = new PatternAction("children",
+ Utils.prependPrefix(prefix, "getChildren"), properties);
+ ValueHandler.apply(this, properties, prefix);
+ String[] pathStrings = System.getenv("PATH").split(File.pathSeparator);
+ paths = new Path[pathStrings.length];
+ for (int i = 0; i < paths.length; ++i) {
+ paths[i] = Paths.get(pathStrings[i]);
+ }
+ addJdks(jdks);
+ }
+
+ public List<Long> getChildren(HtmlSection section, long pid) {
+ String pidStr = "" + pid;
+ ProcessBuilder pb = getChildren.prepareProcess(section, this, pidStr);
+ PrintWriter log = getChildren.getSection(section).getWriter();
+ CharArrayWriter writer = new CharArrayWriter();
+ ExitCode code = run(log, writer, pb, getChildren.getParameters());
+ Reader output = new CharArrayReader(writer.toCharArray());
+
+ if (!ExitCode.OK.equals(code)) {
+ log.println("WARNING: get children pids action failed");
+ try {
+ Utils.copyStream(output, log);
+ } catch (IOException e) {
+ e.printStackTrace(log);
+ }
+ return Collections.emptyList();
+ }
+
+ List<Long> result = new ArrayList<>();
+ try {
+ try (BufferedReader reader = new BufferedReader(output)) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ String value = line.trim();
+ if (value.isEmpty()) {
+ // ignore empty lines
+ continue;
+ }
+ try {
+ result.add(Long.valueOf(value));
+ } catch (NumberFormatException e) {
+ log.printf("WARNING: can't parse child pid %s : %s%n",
+ line, e.getMessage());
+ e.printStackTrace(log);
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace(log);
+ }
+ return result;
+ }
+
+ public ProcessBuilder prepareProcess(PrintWriter log, String app,
+ String... args) {
+ File appBin = findApp(app);
+ if (appBin == null) {
+ log.printf("ERROR: can't find %s in %s.%n",
+ app, Arrays.toString(paths));
+ return null;
+ }
+ List<String> command = new ArrayList<>(args.length + 1);
+ command.add(appBin.toString());
+ Collections.addAll(command, args);
+ return new ProcessBuilder()
+ .command(command)
+ .directory(workDir.toFile());
+ }
+
+ private File findApp(String app) {
+ String name = app + executableSuffix;
+ for (Path pathElem : paths) {
+ File result = pathElem.resolve(name).toFile();
+ if (result.exists()) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ private void addJdks(Path[] jdkPaths) {
+ if (jdkPaths != null && jdkPaths.length != 0) {
+ Path[] result = new Path[jdkPaths.length + paths.length];
+ for (int i = 0; i < jdkPaths.length; ++i) {
+ result[i] = jdkPaths[i].resolve("bin");
+ }
+ System.arraycopy(paths, 0, result, jdkPaths.length, paths.length);
+ paths = result;
+ }
+ }
+
+ private ExitCode run(PrintWriter log, Writer out, ProcessBuilder pb,
+ ActionParameters params) {
+ char[] lineChars = new char[40];
+ Arrays.fill(lineChars, '-');
+ String line = new String(lineChars);
+ Stopwatch stopwatch = new Stopwatch();
+ stopwatch.start();
+
+ log.printf("%s%n[%tF %<tT] %s%n%1$s%n", line, new Date(), pb.command());
+ Process process;
+ KillerTask killer;
+
+ ExitCode result = ExitCode.NEVER_STARTED;
+
+ try {
+ process = pb.start();
+ killer = new KillerTask(process);
+ killer.schedule(params.timeout);
+ Utils.copyStream(new InputStreamReader(process.getInputStream()),
+ out);
+ try {
+ result = new ExitCode(process.waitFor());
+ killer.cancel();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ if (!killer.cancel()) {
+ log.println(
+ "WARNING: interrupted when waiting for the tool:");
+ e.printStackTrace(log);
+ }
+ }
+ if (killer.hasTimedOut()) {
+ log.printf(
+ "WARNING: tool timed out: killed process after %d ms%n",
+ TimeUnit.MILLISECONDS.toMicros(params.timeout));
+ result = ExitCode.TIMED_OUT;
+ }
+ } catch (IOException e) {
+ e.printStackTrace(log);
+ result = ExitCode.LAUNCH_ERROR;
+ }
+
+ stopwatch.stop();
+ log.printf("%s%n[%tF %<tT] exit code : %d time : %d ms%n%1$s%n",
+ line, new Date(), result.value,
+ TimeUnit.MILLISECONDS.toSeconds(stopwatch.getElapsedTimeNs()));
+ return result;
+ }
+
+ public void runPatternAction(SimpleAction action, HtmlSection section) {
+ if (action != null) {
+ HtmlSection subSection = action.getSection(section);
+ PrintWriter log = subSection.getWriter();
+ ProcessBuilder pb = action.prepareProcess(log, this);
+ exec(subSection, pb, action.getParameters());
+ }
+ }
+
+ public void runPatternAction(PatternAction action, HtmlSection section,
+ String value) {
+ if (action != null) {
+ ProcessBuilder pb = action.prepareProcess(section, this, value);
+ HtmlSection subSection = action.getSection(section);
+ exec(subSection, pb, action.getParameters());
+ }
+ }
+
+ public boolean isJava(long pid, PrintWriter log) {
+ ProcessBuilder pb = prepareProcess(log, "jps", "-q");
+ if (pb == null) {
+ return false;
+ }
+ pb.redirectErrorStream(true);
+ boolean result = false;
+ String pidStr = "" + pid;
+ try {
+ Process process = pb.start();
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(process.getInputStream()))) {
+ String line;
+ while ((line = reader.readLine()) != null){
+ if (pidStr.equals(line)) {
+ result = true;
+ }
+ }
+ }
+ process.waitFor();
+ } catch (IOException e) {
+ log.printf("WARNING: can't run jps : %s%n", e.getMessage());
+ e.printStackTrace(log);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ e.printStackTrace(log);
+ }
+ return result;
+ }
+
+ private static class KillerTask extends TimerTask {
+ private static final Timer WATCHDOG = new Timer("WATCHDOG", true);
+ private final Process process;
+ private boolean timedOut;
+
+ public KillerTask(Process process) {
+ this.process = process;
+ }
+
+ public void run() {
+ try {
+ process.exitValue();
+ } catch (IllegalThreadStateException e) {
+ // !prepareProcess.isAlive()
+ process.destroy();
+ timedOut = true;
+ }
+ }
+
+ public boolean hasTimedOut() {
+ return timedOut;
+ }
+
+ public void schedule(long timeout) {
+ if (timeout > 0) {
+ WATCHDOG.schedule(this, timeout);
+ }
+ }
+ }
+
+ private void exec(HtmlSection section, ProcessBuilder process,
+ ActionParameters params) {
+ if (process == null) {
+ return;
+ }
+ PrintWriter sectionWriter = section.getWriter();
+ if (params.repeat > 1) {
+ for (int i = 0, n = params.repeat; i < n; ++i) {
+ HtmlSection iteration = section.createChildren(
+ String.format("iteration_%d", i));
+ PrintWriter writer = iteration.getWriter();
+ ExitCode exitCode = run(writer, writer, process, params);
+ if (params.stopOnError && !ExitCode.OK.equals(exitCode)) {
+ sectionWriter.printf(
+ "ERROR: non zero exit code[%d] -- break.",
+ exitCode.value);
+ break;
+ }
+ try {
+ Thread.sleep(params.pause);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ e.printStackTrace(sectionWriter);
+ }
+ }
+ } else {
+ run(section.getWriter(), section.getWriter(), process, params);
+ }
+ }
+
+ /**
+ * Special values for prepareProcess exit code.
+ *
+ * <p>Can we clash with normal codes?
+ * On Solaris and Linux, only [0..255] are returned.
+ * On Windows, prepareProcess exit codes are stored in unsigned int.
+ * On MacOSX no limits (except it should fit C int type)
+ * are defined in the exit() man pages.
+ */
+ private static class ExitCode {
+ /** Process exits gracefully */
+ public static final ExitCode OK = new ExitCode(0);
+ /** Error launching prepareProcess */
+ public static final ExitCode LAUNCH_ERROR = new ExitCode(-1);
+ /** Application prepareProcess has been killed by watchdog due to timeout */
+ public static final ExitCode TIMED_OUT = new ExitCode(-2);
+ /** Application prepareProcess has never been started due to program logic */
+ public static final ExitCode NEVER_STARTED = new ExitCode(-3);
+
+ public final int value;
+
+ private ExitCode(int value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ ExitCode exitCode = (ExitCode) o;
+ return value == exitCode.value;
+ }
+
+ @Override
+ public int hashCode() {
+ return value;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionParameters.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.action;
+
+import jdk.test.failurehandler.value.DefaultValue;
+import jdk.test.failurehandler.value.Value;
+
+public class ActionParameters {
+ @Value (name = "repeat")
+ @DefaultValue (value = "1")
+ public int repeat = 1;
+
+ @Value (name = "pause")
+ @DefaultValue (value = "500")
+ public long pause = 500;
+
+ @Value (name = "stopOnError")
+ @DefaultValue (value = "false")
+ public boolean stopOnError = false;
+
+ @Value (name = "timeout")
+ @DefaultValue (value = "" + 20_000L)
+ public long timeout = -1L;
+
+ public ActionParameters() { }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionSet.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.action;
+
+import jdk.test.failurehandler.ProcessInfoGatherer;
+import jdk.test.failurehandler.EnvironmentInfoGatherer;
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.Utils;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+public class ActionSet implements ProcessInfoGatherer, EnvironmentInfoGatherer {
+ private static final String ENVIRONMENT_PROPERTY = "environment";
+ private static final String ON_PID_PROPERTY = "onTimeout";
+
+ private final ActionHelper helper;
+
+ public String getName() {
+ return name;
+ }
+
+ private final String name;
+ private final List<SimpleAction> environmentActions;
+ private final List<PatternAction> processActions;
+
+
+ public ActionSet(ActionHelper helper, PrintWriter log, String name) {
+ this.helper = helper;
+ this.name = name;
+
+ Properties p = Utils.getProperties(name);
+ environmentActions = getSimpleActions(log, p, ENVIRONMENT_PROPERTY);
+ processActions = getPatternActions(log, p, ON_PID_PROPERTY);
+ }
+
+ private List<SimpleAction> getSimpleActions(PrintWriter log, Properties p,
+ String key) {
+ String[] tools = getTools(log, p, key);
+ List<SimpleAction> result = new ArrayList<>(tools.length);
+ for (String tool : tools) {
+ try {
+ SimpleAction action = new SimpleAction(
+ Utils.prependPrefix(name, tool), tool, p);
+ result.add(action);
+ } catch (Exception e) {
+ log.printf("ERROR: %s cannot be created : %s %n",
+ tool, e.getMessage());
+ e.printStackTrace(log);
+ }
+ }
+ return result;
+ }
+
+ private List<PatternAction> getPatternActions(PrintWriter log,
+ Properties p, String key) {
+ String[] tools = getTools(log, p, key);
+ List<PatternAction> result = new ArrayList<>(tools.length);
+ for (String tool : tools) {
+ try {
+ PatternAction action = new PatternAction(
+ Utils.prependPrefix(name, tool), tool, p);
+ result.add(action);
+ } catch (Exception e) {
+ log.printf("ERROR: %s cannot be created : %s %n",
+ tool, e.getMessage());
+ e.printStackTrace(log);
+ }
+ }
+ return result;
+ }
+
+ private String[] getTools(PrintWriter writer, Properties p, String key) {
+ String value = p.getProperty(key);
+ if (value == null || value.isEmpty()) {
+ writer.printf("ERROR: '%s' property is empty%n", key);
+ return new String[]{};
+ }
+ return value.split(" ");
+ }
+
+
+ @Override
+ public void gatherProcessInfo(HtmlSection section, long pid) {
+ String pidStr = "" + pid;
+ for (PatternAction action : processActions) {
+ if (action.isJavaOnly()) {
+ if (helper.isJava(pid, section.getWriter())) {
+ helper.runPatternAction(action, section, pidStr);
+ }
+ } else {
+ helper.runPatternAction(action, section, pidStr);
+ }
+ }
+ }
+
+ @Override
+ public void gatherEnvironmentInfo(HtmlSection section) {
+ for (SimpleAction action : environmentActions) {
+ helper.runPatternAction(action, section);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/PatternAction.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.action;
+
+import jdk.test.failurehandler.value.InvalidValueException;
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.value.Value;
+import jdk.test.failurehandler.value.ValueHandler;
+
+import java.util.Properties;
+
+public class PatternAction implements Action {
+ @Value(name = "pattern")
+ private String pattern = null;
+
+ private final SimpleAction action;
+ private final String[] originalArgs;
+
+ public PatternAction(String id, Properties properties)
+ throws InvalidValueException {
+ this(id, id, properties);
+ }
+
+ public PatternAction(String name, String id, Properties properties)
+ throws InvalidValueException {
+ action = new SimpleAction(("pattern." + name), id, properties);
+ ValueHandler.apply(this, properties, id);
+ originalArgs = action.args.clone();
+ }
+
+ public ProcessBuilder prepareProcess(HtmlSection section,
+ ActionHelper helper, String value) {
+ action.sections[0] = value;
+ section = getSection(section);
+ String[] args = action.args;
+ System.arraycopy(originalArgs, 0, args, 0, originalArgs.length);
+
+ for (int i = 0, n = args.length; i < n; ++i) {
+ args[i] = args[i].replace(pattern, value) ;
+ }
+ return action.prepareProcess(section.getWriter(), helper);
+ }
+
+ @Override
+ public HtmlSection getSection(HtmlSection section) {
+ return action.getSection(section);
+ }
+
+ @Override
+ public ActionParameters getParameters() {
+ return action.getParameters();
+ }
+
+ @Override
+ public boolean isJavaOnly() {
+ return action.isJavaOnly();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/SimpleAction.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.action;
+
+import jdk.test.failurehandler.HtmlSection;
+import jdk.test.failurehandler.value.InvalidValueException;
+import jdk.test.failurehandler.value.SubValues;
+import jdk.test.failurehandler.value.Value;
+import jdk.test.failurehandler.value.ValueHandler;
+import jdk.test.failurehandler.value.DefaultValue;
+
+import java.io.PrintWriter;
+import java.util.Properties;
+
+public class SimpleAction implements Action {
+ /* package-private */ final String[] sections;
+ @Value(name = "javaOnly")
+ @DefaultValue(value = "false")
+ private boolean javaOnly = false;
+
+ @Value (name = "app")
+ private String app = null;
+
+ @Value (name = "args")
+ @DefaultValue (value = "")
+ /* package-private */ String[] args = new String[]{};
+
+ @SubValues(prefix = "params")
+ private final ActionParameters params;
+
+ public SimpleAction(String id, Properties properties)
+ throws InvalidValueException {
+ this(id, id, properties);
+ }
+ public SimpleAction(String name, String id, Properties properties)
+ throws InvalidValueException {
+ sections = name.split("\\.");
+ this.params = new ActionParameters();
+ ValueHandler.apply(this, properties, id);
+ }
+
+ public ProcessBuilder prepareProcess(PrintWriter log, ActionHelper helper) {
+ ProcessBuilder process = helper.prepareProcess(log, app, args);
+ if (process != null) {
+ process.redirectErrorStream(true);
+ }
+
+ return process;
+ }
+
+ @Override
+ public boolean isJavaOnly() {
+ return javaOnly;
+ }
+
+ @Override
+ public HtmlSection getSection(HtmlSection section) {
+ return section.createChildren(sections);
+ }
+
+ @Override
+ public ActionParameters getParameters() {
+ return params;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.jtreg;
+
+import com.sun.javatest.Harness;
+import com.sun.javatest.Parameters;
+import com.sun.javatest.TestResult;
+import com.sun.javatest.regtest.RegressionParameters;
+import com.sun.javatest.regtest.OS;
+import jdk.test.failurehandler.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The jtreg test execution observer, which gathers info about
+ * system and dumps it to a file.
+ */
+public class GatherDiagnosticInfoObserver implements Harness.Observer {
+ public static final String LOG_FILENAME = "environment.log";
+ public static final String ENVIRONMENT_OUTPUT = "environment.html";
+
+ private String compileJdk;
+ private String testJdk;
+
+ /*
+ * The harness calls this method after each test.
+ */
+ @Override
+ public void finishedTest(TestResult tr) {
+ if (!tr.getStatus().isError() && !tr.getStatus().isFailed()) {
+ return;
+ }
+
+ String jtrFile = tr.getFile().toString();
+ final Path workDir = Paths.get(
+ jtrFile.substring(0, jtrFile.lastIndexOf('.')));
+ workDir.toFile().mkdir();
+
+ String name = getClass().getName();
+ PrintWriter log;
+ boolean needClose = false;
+ try {
+ log = new PrintWriter(new FileWriter(
+ workDir.resolve(LOG_FILENAME).toFile(), true));
+ needClose = true;
+ } catch (IOException e) {
+ log = new PrintWriter(System.out);
+ log.printf("ERROR: %s cannot open log file %s", name,
+ LOG_FILENAME);
+ e.printStackTrace(log);
+ }
+ try {
+ log.printf("%s ---%n", name);
+ GathererFactory gathererFactory = new GathererFactory(
+ OS.current().family, workDir, log,
+ Paths.get(testJdk), Paths.get(compileJdk));
+ gatherEnvInfo(workDir, name, log,
+ gathererFactory.getEnvironmentInfoGatherer());
+ } catch (Throwable e) {
+ log.printf("ERROR: exception in observer %s:", name);
+ e.printStackTrace(log);
+ } finally {
+ log.printf("--- %s%n", name);
+ if (needClose) {
+ log.close();
+ } else {
+ log.flush();
+ }
+ }
+ }
+
+ private void gatherEnvInfo(Path workDir, String name, PrintWriter log,
+ EnvironmentInfoGatherer gatherer) {
+ File output = workDir.resolve(ENVIRONMENT_OUTPUT).toFile();
+ try (HtmlPage html = new HtmlPage(new PrintWriter(
+ new FileWriter(output, true)))) {
+ try (ElapsedTimePrinter timePrinter
+ = new ElapsedTimePrinter(new Stopwatch(), name, log)) {
+ gatherer.gatherEnvironmentInfo(html.getRootSection());
+ }
+ } catch (Throwable e) {
+ log.printf("ERROR: exception in observer on getting environment "
+ + "information %s:", name);
+ e.printStackTrace(log);
+ }
+ }
+
+ /*
+ * The harness calls this method one time per run, not per test.
+ */
+ @Override
+ public void startingTestRun(Parameters params) {
+ // TODO find a better way to get JDKs
+ RegressionParameters rp = (RegressionParameters) params;
+ Map<?,?> map = new HashMap<>();
+ rp.save(map);
+ compileJdk = (String) map.get("regtest.compilejdk");
+ testJdk = (String) map.get("regtest.testjdk");
+ }
+
+ @Override
+ public void startingTest(TestResult tr) {
+ // no-op
+ }
+
+ @Override
+ public void stoppingTestRun() {
+ // no-op
+ }
+
+ @Override
+ public void finishedTesting() {
+ // no-op
+ }
+
+ @Override
+ public void finishedTestRun(boolean allOK) {
+ // no-op
+ }
+
+ @Override
+ public void error(String msg) {
+ // no-op
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.jtreg;
+
+import com.sun.javatest.regtest.OS;
+import com.sun.javatest.regtest.TimeoutHandler;
+import jdk.test.failurehandler.*;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Field;
+import java.nio.file.Path;
+
+/**
+ * A timeout handler for jtreg, which gathers information about the timed out
+ * process and its children.
+ */
+public class GatherProcessInfoTimeoutHandler extends TimeoutHandler {
+ static {
+ try {
+ System.loadLibrary("timeoutHandler");
+ } catch (UnsatisfiedLinkError ignore) {
+ // not all os need timeoutHandler native-library
+ }
+ }
+ private static final String LOG_FILENAME = "processes.log";
+ private static final String OUTPUT_FILENAME = "processes.html";
+
+ public GatherProcessInfoTimeoutHandler(PrintWriter jtregLog, File outputDir,
+ File testJdk) {
+ super(jtregLog, outputDir, testJdk);
+ }
+
+ /**
+ * Runs various actions for jtreg timeout handler.
+ *
+ * <p>Please see method code for the actions.
+ */
+ @Override
+ protected void runActions(Process process, long pid)
+ throws InterruptedException {
+ Path workDir = outputDir.toPath();
+
+ String name = getClass().getName();
+ PrintWriter actionsLog;
+ try {
+ // try to open a separate file for aciton log
+ actionsLog = new PrintWriter(new FileWriter(
+ workDir.resolve(LOG_FILENAME).toFile(), true));
+ } catch (IOException e) {
+ // use jtreg log as a fallback
+ actionsLog = log;
+ actionsLog.printf("ERROR: %s cannot open log file %s : %s", name,
+ LOG_FILENAME, e.getMessage());
+ }
+ try {
+ actionsLog.printf("%s ---%n", name);
+
+ File output = workDir.resolve(OUTPUT_FILENAME).toFile();
+ try {
+ PrintWriter pw = new PrintWriter(new FileWriter(output, true));
+ runGatherer(name, workDir, actionsLog, pw, pid);
+ } catch (IOException e) {
+ actionsLog.printf("IOException: cannot open output file[%s] : %s",
+ output, e.getMessage());
+ e.printStackTrace(actionsLog);
+ }
+ } finally {
+ actionsLog.printf("--- %s%n", name);
+ // don't close jtreg log
+ if (actionsLog != log) {
+ actionsLog.close();
+ } else {
+ log.flush();
+ }
+ }
+ }
+
+ @Override
+ protected long getProcessId(Process process) {
+ long result = super.getProcessId(process);
+ if (result == 0L) {
+ /* jtreg didn't find pid, most probably we are on JDK < 9
+ there is no Process::getPid */
+ if ("windows".equals(OS.current().family)) {
+ try {
+ Field field = process.getClass().getDeclaredField("handle");
+ boolean old = field.isAccessible();
+ try {
+ field.setAccessible(true);
+ long handle = field.getLong(process);
+ result = getWin32Pid(handle);
+ } finally {
+ field.setAccessible(old);
+ }
+ } catch (ReflectiveOperationException e) {
+ e.printStackTrace(log);
+ }
+ }
+ }
+ return result;
+ }
+
+ private native long getWin32Pid(long handle);
+
+ private void runGatherer(String name, Path workDir, PrintWriter log,
+ PrintWriter out, long pid) {
+ try (HtmlPage html = new HtmlPage(out)) {
+ ProcessInfoGatherer gatherer = new GathererFactory(
+ OS.current().family,
+ workDir, log, testJdk.toPath()).getProcessInfoGatherer();
+ try (ElapsedTimePrinter timePrinter
+ = new ElapsedTimePrinter(new Stopwatch(), name, log)) {
+ gatherer.gatherProcessInfo(html.getRootSection(), pid);
+ }
+ } catch (Throwable e) {
+ log.printf("ERROR: exception in timeout handler %s:", name);
+ e.printStackTrace(log);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ArrayParser.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import java.lang.reflect.Array;
+import java.util.Objects;
+
+public class ArrayParser implements ValueParser {
+ private final ValueParser parser;
+
+ public ArrayParser(ValueParser parser) {
+ Objects.requireNonNull(parser);
+ this.parser = parser;
+ }
+
+ @Override
+ public Object parse(Class<?> type, String value, String delimiter) {
+ Class<?> component = type.getComponentType();
+ if (component.isArray()) {
+ throw new IllegalArgumentException(
+ "multidimensional array fields aren't supported");
+ }
+ String[] values = (value == null || value.isEmpty())
+ ? new String[]{}
+ : value.split(delimiter);
+ Object result = Array.newInstance(component, values.length);
+ for (int i = 0, n = values.length; i < n; ++i) {
+ Array.set(result, i, parser.parse(component, values[i], delimiter));
+ }
+ return result;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/DefaultParser.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class DefaultParser implements ValueParser {
+ private static final Map<Class<?>, BasicParser> PARSERS = new HashMap<>();
+
+ static {
+ BasicParser.init();
+ }
+
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ if (type.isArray()) {
+ return new ArrayParser(this).parse(type, value, s);
+ }
+ ValueParser parser = PARSERS.get(type);
+ if (parser == null) {
+ throw new IllegalArgumentException("can't find parser for "
+ + type.getName());
+ }
+
+ return parser.parse(type, value, s);
+ }
+
+ private static enum BasicParser implements ValueParser {
+ BOOL(boolean.class, Boolean.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Boolean.valueOf(value);
+ }
+ },
+ BYTE(byte.class, Byte.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Byte.decode(value);
+ }
+ },
+ CHAR(char.class, Character.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ if (value.length() != 1) {
+ throw new IllegalArgumentException(
+ String.format("can't cast %s to char", value));
+ }
+ return value.charAt(0);
+ }
+ },
+ SHORT(short.class, Short.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Short.decode(value);
+ }
+ },
+ INT(int.class, Integer.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Integer.decode(value);
+ }
+ },
+ LONG(long.class, Long.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Long.decode(value);
+ }
+ },
+ FLOAT(float.class, Float.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Float.parseFloat(value);
+ }
+ },
+ DOUBLE(double.class, Double.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return Double.parseDouble(value);
+ }
+ },
+ STRING(String.class, Object.class) {
+ @Override
+ public Object parse(Class<?> type, String value, String s) {
+ return value;
+ }
+ };
+
+ private BasicParser(Class<?>... classes) {
+ for (Class<?> aClass : classes) {
+ DefaultParser.PARSERS.put(aClass, this);
+ }
+ }
+
+ private static void init() {
+ // no-op used to provoke <cinit>
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/DefaultValue.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.FIELD)
+public @interface DefaultValue {
+ String value();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/InvalidValueException.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+public class InvalidValueException extends Exception {
+ public InvalidValueException() { }
+
+ public InvalidValueException(String message) {
+ super(message);
+ }
+
+ public InvalidValueException(String s, Throwable e) {
+ super(s, e);
+ }
+
+ public InvalidValueException(Throwable cause) {
+ super(cause);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/PathValueParser.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import java.io.File;
+
+public class PathValueParser implements ValueParser {
+ @Override
+ public Object parse(Class<?> type, String value, String delimiter) {
+ if (type.isArray()) {
+ return new ArrayParser(this).parse(type, value, delimiter);
+ }
+ return new File(value).toPath();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/SubValues.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.FIELD)
+public @interface SubValues {
+ String prefix();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/Value.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = ElementType.FIELD)
+public @interface Value {
+ String name();
+ Class<? extends ValueParser> parser() default DefaultParser.class;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueHandler.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import jdk.test.failurehandler.Utils;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Objects;
+import java.util.Properties;
+
+public final class ValueHandler {
+ public static <T> void apply(T object, Properties properties,
+ String prefix) throws InvalidValueException {
+ Objects.requireNonNull(object, "object cannot be null");
+ Objects.requireNonNull(properties, "properties cannot be null");
+ Class<?> aClass = object.getClass();
+ while (aClass != null) {
+ for (Field field : aClass.getDeclaredFields()) {
+ Value p = field.getAnnotation(Value.class);
+ if (p != null) {
+ applyToField(p, object, field, properties, prefix);
+ } else {
+ SubValues sub
+ = field.getAnnotation(SubValues.class);
+ if (sub != null) {
+ getAccess(field);
+ try {
+ apply(field.get(object), properties,
+ Utils.prependPrefix(prefix, sub.prefix()));
+ } catch (IllegalAccessException e) {
+ throw new InvalidValueException(String.format(
+ "can't apply sub properties to %s.",
+ field.getName()));
+ }
+ }
+ }
+ }
+ aClass = aClass.getSuperclass();
+ }
+ }
+
+ private static void applyToField(Value property, Object object,
+ Field field, Properties properties, String prefix)
+ throws InvalidValueException {
+ getAccess(field);
+ if (Modifier.isFinal(field.getModifiers())) {
+ throw new InvalidValueException(
+ String.format("field '%s' is final", field));
+ }
+ String name = Utils.prependPrefix(prefix, property.name());
+ String value = getProperty(properties, prefix, property.name());
+ if (value == null) {
+ DefaultValue defaultValue
+ = field.getAnnotation(DefaultValue.class);
+ value = defaultValue == null ? null : defaultValue.value();
+ }
+ if (value == null) {
+ throw new InvalidValueException(String.format(
+ "can't set '%s', because properties don't have '%s'.",
+ field.getName(), name));
+ }
+ String delimiter = getProperty(properties,
+ Utils.prependPrefix(prefix, property.name()), "delimiter");
+ delimiter = delimiter == null ? " " : delimiter;
+ Class<? extends ValueParser> parserClass = property.parser();
+ try {
+ field.set(object, parserClass.newInstance().parse(
+ field.getType(), value, delimiter));
+ } catch (ReflectiveOperationException | IllegalArgumentException e) {
+ throw new InvalidValueException(
+ String.format("can't set field '%s' : %s",
+ field.getName(), e.getMessage()), e);
+ }
+ }
+
+ private static String getProperty(Properties properties,
+ String prefix, String name) {
+ if (prefix == null || prefix.isEmpty()) {
+ return properties.getProperty(name);
+ }
+ int index = prefix.length();
+ do {
+ String value = properties.getProperty(
+ Utils.prependPrefix(prefix.substring(0, index), name));
+ if (value != null) {
+ return value;
+ }
+ index = prefix.lastIndexOf('.', index - 1);
+ } while (index > 0);
+ return properties.getProperty(name);
+ }
+
+ private static void getAccess(Field field) {
+ int modifiers = field.getModifiers();
+ if (!Modifier.isPublic(modifiers)) {
+ field.setAccessible(true);
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/value/ValueParser.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+public interface ValueParser {
+ Object parse(Class<?> type, String value, String delimiter);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/common.properties Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,74 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+pattern=%p
+javaOnly=true
+args=%p
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+ jinfo \
+ jcmd.compiler.codecache jcmd.compiler.codelist \
+ jcmd.compiler.queue \
+ jcmd.vm.classloader_stats jcmd.vm.stringtable \
+ jcmd.vm.symboltable jcmd.vm.uptime jcmd.vm.dynlibs \
+ jcmd.vm.system_properties \
+ jcmd.gc.class_stats jcmd.gc.class_histogram \
+ jstack \
+ jmap.heap jmap.histo jmap.clstats jmap.finalizerinfo
+
+jinfo.app=jinfo
+
+jcmd.app=jcmd
+
+jcmd.compiler.codecache.args=%p Compiler.codecache
+jcmd.compiler.codelist.args=%p Compiler.codelist
+jcmd.compiler.queue.args=%p Compiler.queue
+
+jcmd.vm.classloader_stats.args=%p VM.classloader_stats
+jcmd.vm.stringtable.args=%p VM.stringtable
+jcmd.vm.symboltable.args=%p VM.symboltable
+jcmd.vm.uptime.args=%p VM.uptime
+jcmd.vm.dynlibs.args=%p VM.dynlibs
+jcmd.vm.system_properties.args=%p VM.system_properties
+
+jcmd.gc.class_stats.args=%p GC.class_stats
+jcmd.gc.class_histogram.args=%p GC.class_histogram
+
+jstack.app=jstack
+jstack.params.repeat=6
+
+jmap.app=jmap
+jmap.heap.args=-heap %p
+jmap.histo.args=-histo %p
+jmap.clstats.args=-clstats %p
+jmap.finalizerinfo.args=-finalizerinfo %p
+
+################################################################################
+# environment info to gather
+################################################################################
+environment=jps
+jps.app=jps
+jps.args=-mlv
+################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/linux.properties Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,110 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=
+config.getChildren.pattern=%p
+config.getChildren.app=ps
+config.getChildren.args=--no-headers -o pid --ppid %p
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+ native.pmap.normal native.pmap.everything \
+ native.files native.locks \
+ native.stack native.core
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+native.args=%p
+
+native.pmap.app=pmap
+native.pmap.normal.args=-p %p
+native.pmap.everything.args=-XXp %p
+
+native.files.app=lsof
+native.files.args=-p %p
+
+native.locks.app=lslocks
+native.locks.args=-u --pid %p
+
+native.stack.app=gdb
+native.stack.args=--pid=%p\0-batch\0-ex\0thread apply all backtrace
+native.stack.args.delimiter=\0
+native.stack.params.repeat=6
+
+native.core.app=gcore
+native.core.args=-o ./core.%p %p
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+ users.current users.logged users.last \
+ disk \
+ env \
+ system.dmesg system.sysctl \
+ process.top process.ps \
+ memory.free memory.vmstat.default memory.vmstat.statistics \
+ memory.vmstat.slabinfo memory.vmstat.disk \
+ files \
+ locks \
+ net.sockets net.statistics
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=who
+users.logged.args=-a
+users.last.app=last
+users.last.args=-10
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.dmesg.app=dmesg
+system.sysctl.app=sysctl
+system.sysctl.args=-a
+
+process.top.app=top
+process.top.args=-b -n 1
+process.ps.app=ps
+process.ps.args=-Leo pid,pcpu,cputime,start,pmem,vsz,rssize,stackp,stat,sgi_p,wchan,user,args
+
+memory.free.app=free
+memory.free.args=-h
+memory.vmstat.app=vmstat
+memory.vmstat.default.args=3 3
+memory.vmstat.statistics.args=-s
+memory.vmstat.slabinfo.args=-m
+memory.vmstat.disk.args=-d
+
+files.app=lsof
+locks.app=lslocks
+locks.args=-u
+
+net.app=netstat
+net.sockets.args=-aeeopv
+net.statistics.args=-sv
+################################################################################
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/mac.properties Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,98 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=
+config.getChildren.pattern=%p
+config.getChildren.app=pgrep
+config.getChildren.args=-P %p
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+ native.vmmap native.heap native.leaks native.spindump \
+ native.stack native.core
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+native.args=%p
+
+# Some of them require root privileges
+native.vmmap.app=vmmap
+native.heap.app=heap
+native.leaks.app=leaks
+native.spindump.app=spindump
+native.spindump.args=%p -stdout
+
+native.stack.app=lldb
+native.stack.delimiter=\0
+native.stack.params.repeat=6
+native.stack.args=-o\0attach %p\0-o\0thread backtrace all\0-o\0detach\0-o\0quit
+
+native.core.app=bash
+native.core.delimiter=\0
+native.core.args=-c\0gcore -o ./core.%p %p || \
+ lldb -o 'attach %p' -o 'process save-core core.%p' -o 'detach' -o 'quit'
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+ users.current users.logged users.last \
+ disk \
+ env \
+ system.dmesg system.sysctl \
+ process.ps process.top \
+ memory.vmstat \
+ netstat.av netstat.aL netstat.m netstat.s
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=who
+users.logged.args=-a
+users.last.app=last
+users.last.args=-10
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.dmesg.app=dmesg
+system.sysctl.app=sysctl
+system.sysctl.args=-a
+
+process.ps.app=ps
+process.ps.args=-Meo pid,pcpu,cputime,start,pmem,vsz,rss,state,wchan,user,args
+process.top.app=top
+process.top.args=-l 1
+
+memory.vmstat.app=vm_stat
+memory.vmstat.args=-c 3 3
+
+
+netstat.app=netstat
+netstat.av.args=-av
+netstat.aL.args=-aL
+netstat.m.args=-m
+netstat.s.args=-s
+################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/solaris.properties Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,111 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=
+# pattern will be replaced with the PID
+config.getChildren.pattern=%p
+config.getChildren.app=pgrep
+config.getChildren.args=-P %p
+################################################################################
+# prepareProcess info to gather
+################################################################################
+onTimeout=\
+ native.pmap \
+ native.pfiles \
+ native.stack native.core
+################################################################################
+# solaris specific
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+
+native.pmap.app=pmap
+native.pmap.args=-F %p
+
+native.pfiles.app=pfiles
+native.pfiles.args=-F %p
+
+# native.locks TODO find 'analog for solaris' for Linux lslocks
+
+native.stack.app=pstack
+native.stack.args=-F %p
+native.stack.params.repeat=6
+
+native.core.app=gcore
+native.core.args=-F -o ./core %p
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+ users.current users.logged users.last \
+ disk \
+ env \
+ system.dmesg system.prtconf system.sysdef \
+ process.ps process.top \
+ memory.swap memory.vmstat.default memory.vmstat.statistics memory.pagesize \
+ netstat.av netstat.m netstat.s netstat.i
+################################################################################
+# common unix
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=who
+users.logged.args=-a
+users.last.app=last
+users.last.args=-10
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.dmesg.app=dmesg
+system.prtconf.app=prtconf
+system.sysdef.app=sysdef
+
+memory.swap.app=swap
+memory.swap.args=-l
+
+process.ps.app=ps
+process.ps.args=-Leo pid,lwp,ppid,tty,s,wchan,pcpu,time,stime,pmem,vsz,osz,rss,args
+
+process.top.app=top
+process.top.args=-b -n
+
+memory.vmstat.app=vmstat
+memory.vmstat.default.args=3 3
+memory.vmstat.statistics.args=-s
+
+memory.pagesize.app=pagesize
+
+# TODO: how to start prstat to show statistics and exit?
+# prstat.app=prstat
+# prstat.args=-a
+
+netstat.app=netstat
+netstat.av.args=-av
+netstat.m.args=-m
+netstat.s.args=-s
+netstat.i.args=-i 1 5
+################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/share/conf/windows.properties Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,115 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+config.execSuffix=.exe
+config.getChildren.app=bash
+config.getChildren.pattern=%p
+config.getChildren.args=-c\0wmic process where ParentProcessId=%p get ProcessId | tail -n+2
+config.getChildren.args.delimiter=\0
+################################################################################
+# process info to gather
+################################################################################
+onTimeout=\
+ native.info \
+ native.pmap.normal native.pmap.everything \
+ native.files native.locks \
+ native.stack native.core
+################################################################################
+native.pattern=%p
+native.javaOnly=false
+native.args=%p
+
+native.info.app=wmic
+native.info.args=process where processId=%p list full
+
+native.pmap.app=pmap
+native.pmap.normal.args=%p
+native.pmap.everything.args=-x %p
+
+native.files.app=handle
+native.files.args=-p %p
+# TODO
+native.locks.app=lslocks
+native.locks.args=-u --pid %p
+
+native.stack.app=cdb
+native.stack.args=-c "~*kP n;qd" -p %p
+native.stack.params.repeat=6
+
+native.core.app=cdb
+native.core.args=-c ".dump /f core.%p;qd" -p %p
+native.core.params.timeout=3600000
+################################################################################
+# environment info to gather
+################################################################################
+environment=\
+ users.current users.logged \
+ disk \
+ env \
+ system.events.system system.events.application system.os \
+ process.top process.ps process.tasklist \
+ memory.free memory.vmstat.default memory.vmstat.statistics \
+ memory.vmstat.slabinfo memory.vmstat.disk \
+ files \
+ net.sockets net.statistics
+################################################################################
+users.current.app=id
+users.current.args=-a
+users.logged.app=query
+users.logged.args=user
+
+disk.app=df
+disk.args=-h
+
+env.app=env
+
+system.events.app=powershell
+system.events.delimiter=\0
+system.events.system.args=-NoLogo\0-Command\0Get-EventLog System -After (Get-Date).AddDays(-1) | Format-List
+system.events.application.args=-NoLogo\0-Command\0Get-EventLog Application -After (Get-Date).AddDays(-1) | Format-List
+
+system.os.app=wmic
+system.os.args=os get /format:list
+
+process.top.app=top
+process.top.args=-b -n 1
+process.ps.app=ps
+process.ps.args=-efW
+process.tasklist.app=tasklist
+process.tasklist.args=/V
+
+memory.free.app=free
+memory.vmstat.app=vmstat
+memory.vmstat.statistics.args=-s
+memory.vmstat.slabinfo.args=-m
+memory.vmstat.disk.args=-d
+
+files.app=openfiles
+files.args=/query
+
+net.sockets.app=bash
+net.sockets.args=-c\0netstat -b -a -t -o || netstat -a -t -o
+net.sockets.args.delimiter=\0
+net.statistics.app=netstat
+net.statistics.args=-s -e
+################################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/src/windows/native/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.c Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#include <jni.h>
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT jlong JNICALL Java_jdk_test_failurehandler_jtreg_GatherProcessInfoTimeoutHandler_getWin32Pid
+ (JNIEnv* env, jobject o, jlong handle) {
+ return GetProcessId(handle);
+}
+#ifdef __cplusplus
+}
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Crash.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import sun.misc.Unsafe;
+
+import java.lang.reflect.Field;
+
+/*
+ * @test
+ * @run main/othervm Crash
+ */
+public class Crash {
+ public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
+ Field f = Unsafe.class.getDeclaredField("theUnsafe");
+ f.setAccessible(true);
+ Unsafe u = (Unsafe) f.get(null);
+ u.setMemory(0, 42, (byte) 0xFF);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Deadlock.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+
+/*
+ * @test
+ * @summary Deadlocked client
+ */
+public class Deadlock {
+ public double e;
+ private volatile int i;
+
+ public static void main(String[] args) {
+ new Deadlock().test();
+ }
+ private void test() {
+ final Object a = new Object();
+ final Object b = new Object();
+
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ synchronized (a) {
+ do {
+ i |= 1;
+ } while (i != 3);
+
+ synchronized (b) {
+ e = 1;
+ }
+ }
+ }}).start();
+
+ synchronized (b) {
+ do {
+ i |= 2;
+ } while (i != 3);
+ synchronized (a) {
+ e = 2;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Livelock.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * @test
+ * @summary Busy infinite loop client, calculating E number
+ */
+public class Livelock {
+
+ public static double elim;
+
+ public static void main(String[] args) {
+ System.out.printf(
+ "%24s %24s %24s %24s %24s %24s%n",
+ "n", "n!", "e = lim(...)", "e = taylor series",
+ "err e-lim", "err e-taylor");
+
+ while (true) {
+ double esum = 2;
+ double nfac = 1;
+ double iter = 1;
+ for (double n = 1; !Double.isInfinite(n) && !Double.isNaN(n) ; n = n * 2) {
+ elim = Math.pow(1 + 1 / n, n);
+
+ iter += 1;
+ nfac *= iter;
+ esum += 1 / nfac;
+
+ System.out.printf("% 24.16e % 24.16e % 24.16e % 24.16e"
+ + "%- 24.16e %- 24.16e%n",
+ n, nfac, elim, esum, (Math.E - elim), (Math.E - esum));
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/OOME.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+
+import java.util.LinkedList;
+
+/*
+ * @test
+ * @summary Slowly eat all memory in an infinite loop
+ * @run main/othervm Crash
+ */
+public class OOME {
+ @SuppressWarnings ("UnusedDeclaration")
+ private static Object garbage;
+ public static void main(String args[]) {
+
+ int chunkSize = 0x8000;
+ LinkedList<int[]> list = new LinkedList<>();
+ garbage = list;
+
+ while (true) {
+ try {
+ list.add(new int[chunkSize]);
+ } catch (OutOfMemoryError e) {
+ chunkSize >>= 1;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/Suicide.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+
+
+import java.lang.management.ManagementFactory;
+
+/*
+ * @test
+ * @summary Suicide test
+ * @run main/othervm Crash
+ */
+public class Suicide {
+ public static void main(String[] args) {
+ String cmd = null;
+ try {
+ String pidStr = ManagementFactory.getRuntimeMXBean().getName()
+ .split("@")[0];
+ String osName = System.getProperty("os.name");
+ if (osName.contains("Windows")) {
+ cmd = "taskkill.exe /F /PID " + pidStr;
+ } else {
+ cmd = "kill -9 " + pidStr;
+ }
+
+ System.out.printf("executing `%s'%n", cmd);
+ Runtime.getRuntime().exec(cmd);
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.err.printf("TEST/ENV BUG: %s didn't kill JVM%n", cmd);
+ System.exit(1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/SystemExit.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * @test
+ * @run main/othervm SystemExit
+ */
+public class SystemExit {
+ public static void main(String[] args) {
+ System.exit(1);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/ThrowError.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/*
+ * @test
+ */
+public class ThrowError {
+ public static void main(String[] args) {
+ throw new Error("TEST FAIL");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/sanity/WaitForDeadlock.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.io.IOException;
+import java.nio.file.Paths;
+
+/*
+ * @test
+ * @build Deadlock
+ * @run driver WaitForDeadlock
+ */
+public class WaitForDeadlock {
+ public static void main(String[] args) throws Exception {
+ System.out.println("START");
+ ProcessBuilder pb = new ProcessBuilder(Paths.get(
+ System.getProperty("test.jdk"), "bin", "java").toString(),
+ "-cp", System.getProperty("java.class.path"),
+ Deadlock.class.getName());
+ pb.redirectError(ProcessBuilder.Redirect.to(Paths.get("out").toFile()));
+ pb.redirectOutput(ProcessBuilder.Redirect.to(Paths.get("err").toFile()));
+ int r = pb.start().waitFor();
+ System.out.println("END. " + r);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/unit/jdk/test/failurehandler/value/DefaultParserTest.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DefaultParserTest {
+ @Test
+ public void testParseStringArray() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ String line = "a aa aaa";
+ String[] result = {"a", "aa", "", "", "aaa"};
+ Assert.assertArrayEquals(result,
+ (Object[]) parser.parse(result.getClass(), line, " "));
+
+ line = null;
+ result = new String[]{};
+ Assert.assertArrayEquals(result,
+ (Object[]) parser.parse(result.getClass(), line, " "));
+ }
+
+ @Test
+ public void testParseObjectArray() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ String line = "a aa aaa";
+ String[] result = {"a", "aa", "", "", "aaa"};
+ Assert.assertArrayEquals(result,
+ (String[]) parser.parse(result.getClass(), line, " "));
+ Object[] result2 = {"a", "aa", "", "", "aaa"};
+ Assert.assertArrayEquals(result2,
+ (Object[]) parser.parse(result.getClass(), line, " "));
+ }
+
+ @Test
+ public void testParseCharArray() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ String line = "a b c a";
+ char[] result = {'a', 'b', 'c', 'a'};
+ Assert.assertArrayEquals(result,
+ (char[]) parser.parse(result.getClass(), line, " "));
+
+ Character[] result2 = {'a', 'b', 'c', 'a'};
+ Assert.assertArrayEquals(result2,
+ (Character[]) parser.parse(result2.getClass(), line, " "));
+ }
+
+ @Test
+ public void testParseBoolean() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ String line = "a b c a";
+ Assert.assertEquals(false,
+ (boolean) parser.parse(boolean.class, line, " "));
+ Assert.assertEquals(Boolean.FALSE,
+ parser.parse(Boolean.class, line, " "));
+ line = "trUe";
+ Assert.assertEquals(true,
+ (boolean) parser.parse(boolean.class, line, " "));
+ Assert.assertEquals(Boolean.TRUE,
+ parser.parse(Boolean.class, line, " "));
+ }
+
+ @Test
+ public void testParseShort() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ Assert.assertSame("10", (short) 10,
+ parser.parse(short.class, "10", " "));
+ Assert.assertSame("010", (short) 8,
+ parser.parse(short.class, "010", " "));
+ Assert.assertSame("0x10", (short) 16,
+ parser.parse(short.class, "0x10", " "));
+ }
+
+ @Test
+ public void testParseByte() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ Assert.assertSame("11", (byte) 11,
+ parser.parse(byte.class, "11", " "));
+ Assert.assertSame("011", (byte) 9,
+ parser.parse(byte.class, "011", " "));
+ Assert.assertSame("0x11", (byte) 17,
+ parser.parse(byte.class, "0x11", " "));
+ }
+
+ @Test
+ public void testParseInt() throws Exception {
+ DefaultParser parser = new DefaultParser();
+ Assert.assertEquals("20", (int) 20,
+ parser.parse(int.class, "20", " "));
+ Assert.assertEquals("020", (int) 16,
+ parser.parse(int.class, "020", " "));
+ Assert.assertEquals("0x20", (int) 32,
+ parser.parse(int.class, "0x20", " "));
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/failure_handler/test/unit/jdk/test/failurehandler/value/ValueHandlerTest.java Wed Jul 05 21:14:30 2017 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2015, 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.failurehandler.value;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.util.Properties;
+
+public class ValueHandlerTest {
+ @Test
+ public void testApplyAnonymousPrivateFinalInt() throws Exception {
+ Properties p = new Properties();
+ p.put("int", "010");
+ Object o = new Object() {
+ @Value (name = "int")
+ private final int i1 = -1;
+ };
+ Field f = o.getClass().getDeclaredField("i1");
+ f.setAccessible(true);
+ int value = f.getInt(o);
+ Assert.assertEquals(value, -1);
+ f.setAccessible(false);
+ ValueHandler.apply(o, p, null);
+ f.setAccessible(true);
+ value = f.getInt(o);
+ Assert.assertEquals(value, 8);
+ f.setAccessible(false);
+ }
+
+ @Test
+ public void testApplyPublicStaticWithDefault() throws Exception {
+ Assert.assertEquals(StaticDefaultCase.s, null);
+ Properties p = new Properties();
+ StaticDefaultCase o = new StaticDefaultCase();
+ ValueHandler.apply(o, p, "prefix");
+ Assert.assertEquals(StaticDefaultCase.s, "default");
+ p.put("s", "new2");
+ ValueHandler.apply(o, p, "prefix");
+ Assert.assertEquals(StaticDefaultCase.s, "new2");
+ p.put("prefix.s", "new");
+ ValueHandler.apply(o, p, "prefix");
+ Assert.assertEquals(StaticDefaultCase.s, "new");
+ ValueHandler.apply(o, p, null);
+ Assert.assertEquals(StaticDefaultCase.s, "new2");
+ }
+
+ protected class InnerClass1 {
+ @Value (name = "innerClass")
+ String[] arr = null;
+ }
+
+ public class InnerClass2 extends InnerClass1 {
+ @Value (name = "float")
+ float f = 0.0f;
+
+ @SubValues (prefix = "inner")
+ InnerClass1 inner1 = new InnerClass1();
+
+ @SubValues (prefix = "")
+ InnerClass1 inner2 = new InnerClass1();
+ }
+
+ @Test
+ public void testApplySub() throws Exception {
+ InnerClass2 o = new InnerClass2();
+ Assert.assertArrayEquals(o.arr, null);
+ Assert.assertArrayEquals(o.inner1.arr, null);
+ Assert.assertArrayEquals(o.inner2.arr, null);
+ Assert.assertEquals(o.f, 0.0f, Float.MIN_VALUE);
+
+ Properties p = new Properties();
+ p.put("float", "1.f");
+ p.put("innerClass", "a b");
+ p.put("inner.innerClass", "a b c");
+ ValueHandler.apply(o, p, "");
+ Assert.assertArrayEquals(o.arr, new String[]{"a", "b"});
+ Assert.assertArrayEquals(o.inner1.arr, new String[]{"a", "b", "c"});
+ Assert.assertArrayEquals(o.inner2.arr, new String[]{"a", "b"});
+ Assert.assertEquals(o.f, 1.0f, Float.MIN_VALUE);
+ }
+}
+
+class StaticDefaultCase {
+ @Value (name = "s")
+ @DefaultValue (value = "default")
+ public static String s;
+}
--- a/test/lib/sun/hotspot/WhiteBox.java Thu Jan 21 10:16:09 2016 -0800
+++ b/test/lib/sun/hotspot/WhiteBox.java Wed Jul 05 21:14:30 2017 +0200
@@ -140,6 +140,23 @@
return g1IsHumongous0(o);
}
+ private native boolean g1BelongsToHumongousRegion0(long adr);
+ public boolean g1BelongsToHumongousRegion(long adr) {
+ if (adr == 0) {
+ throw new IllegalArgumentException("adr argument should not be null");
+ }
+ return g1BelongsToHumongousRegion0(adr);
+ }
+
+
+ private native boolean g1BelongsToFreeRegion0(long adr);
+ public boolean g1BelongsToFreeRegion(long adr) {
+ if (adr == 0) {
+ throw new IllegalArgumentException("adr argument should not be null");
+ }
+ return g1BelongsToFreeRegion0(adr);
+ }
+
public native long g1NumMaxRegions();
public native long g1NumFreeRegions();
public native int g1RegionSize();