8149777: Enable enhanced failure handler for "make test"

Reviewed-by: ihse
This commit is contained in:
Erik Joelsson 2016-04-14 15:13:42 +02:00
parent ec3913386e
commit 0b57773edd
4 changed files with 156 additions and 8 deletions

View File

@ -385,9 +385,25 @@ test-image-jdk-jtreg-native:
build-test-lib:
+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk)
# Builds the failure handler jtreg extension
build-test-failure-handler:
+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
-f BuildFailureHandler.gmk build)
# Runs the tests for the failure handler jtreg extension
test-failure-handler:
+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
-f BuildFailureHandler.gmk test)
# Copies the failure handler jtreg extension into the test image
test-image-failure-handler:
+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) \
-f BuildFailureHandler.gmk images)
ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \
test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
test-image-jdk-jtreg-native build-test-lib
test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
test-failure-handler test-image-failure-handler
################################################################################
# Run tests
@ -582,6 +598,12 @@ else
build-test-lib: java
build-test-failure-handler: interim-langtools
test-failure-handler: build-test-failure-handler
test-image-failure-handler: build-test-failure-handler
build-test-hotspot-jtreg-native: buildtools-jdk
build-test-jdk-jtreg-native: buildtools-jdk
@ -671,7 +693,7 @@ docs-image: docs-javadoc docs-jvmtidoc
# This target builds the test image
test-image: prepare-test-image test-image-hotspot-jtreg-native \
test-image-jdk-jtreg-native
test-image-jdk-jtreg-native test-image-failure-handler
# all-images is the top-most target, it builds all our deliverables ("images").
all-images: product-images test-image docs-image

View File

@ -0,0 +1,128 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. 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.
#
default: build
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
include NativeCompilation.gmk
TARGETS :=
################################################################################
FH_BASEDIR := $(SRC_ROOT)/test/failure_handler
FH_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/failure_handler
FH_JAR := $(FH_SUPPORT)/jtregFailureHandler.jar
JTREG_JAR := $(JT_HOME)/lib/jtreg.jar
ifeq ($(wildcard $(JTREG_JAR)), )
$(error Cannot build failure handler without jtreg)
endif
# tools.jar is only needed if it exists in the boot jdk
TOOLS_JAR := $(wildcard $(BOOT_JDK)/lib/tools.jar)
FH_CLASSPATH := $(call PathList, $(JTREG_JAR) $(TOOLS_JAR))
$(eval $(call SetupJavaCompilation, BUILD_FAILURE_HANDLER, \
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(FH_BASEDIR)/src/share/classes $(FH_BASEDIR)/src/share/conf, \
BIN := $(FH_SUPPORT)/classes, \
COPY := .properties, \
CLASSPATH := $(JTREG_JAR) $(TOOLS_JAR), \
JAR := $(FH_JAR), \
))
TARGETS += $(BUILD_FAILURE_HANDLER)
################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupNativeCompilation, BUILD_LIBTIMEOUT_HANDLER, \
LIBRARY := timeoutHandler, \
SRC := $(FH_BASEDIR)/src/windows/native/libtimeoutHandler, \
OBJECT_DIR := $(FH_SUPPORT)/libtimeoutHandler, \
OUTPUT_DIR := $(FH_SUPPORT), \
CFLAGS := $(CFLAGS_JDKLIB), \
LDFLAGS := $(LDFLAGS_JDKLIB), \
OPTIMIZATION := LOW, \
))
TARGETS += $(BUILD_LIBTIMEOUT_HANDLER)
endif
################################################################################
# Targets for building test-image.
################################################################################
# Copy to hotspot jtreg test image
$(eval $(call SetupCopyFiles, COPY_FH, \
SRC := $(FH_SUPPORT), \
DEST := $(TEST_IMAGE_DIR)/failure_handler, \
FILES := $(FH_JAR) $(BUILD_LIBTIMEOUT_HANDLER), \
))
IMAGES_TARGETS += $(COPY_FH)
################################################################################
# Test the failure handler itself
################################################################################
#
# Use JTREG_TEST_OPTS for test VM options
# Use JTREG_TESTS for jtreg tests parameter
#
RUN_DIR := $(FH_SUPPORT)/test
# Add the dir of the dll to the path on windows
ifeq ($(OPENJDK_TARGET_OS), windows)
export PATH := $(PATH);$(FH_SUPPORT)
endif
test:
$(RM) -r $(RUN_DIR)
$(MKDIR) -p $(RUN_DIR)
$(CD) $(FH_BASEDIR)/test && JT_JAVA=$(BOOT_JDK) $(JTREGEXE) \
-jdk:$(BOOT_JDK) \
$(JTREG_TEST_OPTS) \
-timeout:0.1 -va -retain:all \
-noreport \
-agentvm \
-thd:$(FH_JAR) \
-th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
-od:$(FH_JAR) \
-o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
-w:$(RUN_DIR)/JTwork -r:$(RUN_DIR)/JTreport \
$(if $(JTREG_TESTS), $(JTREG_TESTS), .) \
|| true
################################################################################
build: $(TARGETS)
images: $(IMAGES_TARGETS)
.PHONY: all images test

View File

@ -36,11 +36,9 @@ 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.
The library is built using the top level build-test-failure-handler target and
is automatically included in the test image and picked up by hotspot and jdk
test makefiles.
CONFIGURATION

View File

@ -30,7 +30,7 @@ extern "C" {
JNIEXPORT jlong JNICALL Java_jdk_test_failurehandler_jtreg_GatherProcessInfoTimeoutHandler_getWin32Pid
(JNIEnv* env, jobject o, jlong handle) {
return GetProcessId(handle);
return GetProcessId((HANDLE) handle);
}
#ifdef __cplusplus
}