2
# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation. Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
32
include JavaCompilation.gmk
36
################################################################################
38
FH_BASEDIR := $(TOPDIR)/test/failure_handler
39
FH_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/failure_handler
40
FH_JAR := $(FH_SUPPORT)/jtregFailureHandler.jar
42
JTREG_JAR := $(JT_HOME)/lib/jtreg.jar
43
ifeq ($(wildcard $(JTREG_JAR)), )
44
$(error Cannot build failure handler without jtreg)
46
# tools.jar is only needed if it exists in the boot jdk
47
TOOLS_JAR := $(wildcard $(BOOT_JDK)/lib/tools.jar)
49
FH_CLASSPATH := $(call PathList, $(JTREG_JAR) $(TOOLS_JAR))
51
$(eval $(call SetupJavaCompilation, BUILD_FAILURE_HANDLER, \
52
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
53
SRC := $(FH_BASEDIR)/src/share/classes $(FH_BASEDIR)/src/share/conf, \
54
BIN := $(FH_SUPPORT)/classes, \
55
DISABLED_WARNINGS := options serial try this-escape, \
56
COPY := .properties, \
57
CLASSPATH := $(JTREG_JAR) $(TOOLS_JAR), \
59
JAVAC_FLAGS := -XDstringConcat=inline, \
62
TARGETS += $(BUILD_FAILURE_HANDLER)
64
################################################################################
65
# Targets for building test-image.
66
################################################################################
68
# Copy to hotspot jtreg test image
69
$(eval $(call SetupCopyFiles, COPY_FH, \
70
SRC := $(FH_SUPPORT), \
71
DEST := $(TEST_IMAGE_DIR)/failure_handler, \
72
FILES := $(FH_JAR) $(BUILD_LIBTIMEOUT_HANDLER), \
75
IMAGES_TARGETS += $(COPY_FH)
77
################################################################################
78
# Test the failure handler itself
79
################################################################################
81
# Use JTREG_TEST_OPTS for test VM options
82
# Use JTREG_TESTS for jtreg tests parameter
84
# Most likely you want to select a specific test from test/failure_handler/test
85
# and manually inspect the results. This target does not actually verify
86
# anything about the failure_handler's output or even if it ran at all.
88
RUN_DIR := $(FH_SUPPORT)/test
92
$(MKDIR) -p $(RUN_DIR)
93
$(CD) $(FH_BASEDIR)/test && $(JAVA) -Dprogram=jtreg \
94
-jar $(JT_HOME)/lib/jtreg.jar \
97
-timeout:0.1 -va -retain:all \
101
-th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
103
-o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
104
-w:$(RUN_DIR)/JTwork -r:$(RUN_DIR)/JTreport \
105
$(if $(JTREG_TESTS), $(JTREG_TESTS), .) \
108
################################################################################
111
images: $(IMAGES_TARGETS)
113
.PHONY: all images test