jdk
109 строк · 4.2 Кб
1#
2# Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
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.
8#
9# This code is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12# version 2 for more details (a copy is included in the LICENSE file that
13# accompanied this code).
14#
15# You should have received a copy of the GNU General Public License version
16# 2 along with this work; if not, write to the Free Software Foundation,
17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18#
19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20# or visit www.oracle.com if you need additional information or have any
21# questions.
22#
23
24#
25# This is a temporary standalone makefile
26#
27
28BUILD_DIR := $(shell pwd)/build
29CLASSES_DIR := ${BUILD_DIR}/classes
30IMAGE_DIR := ${BUILD_DIR}/image
31RUN_DIR := $(shell pwd)/run
32CLASSPATH := ${JTREG_HOME}/lib/jtreg.jar:${JAVA_HOME}/lib/tools.jar
33SRC_DIR := src/share/classes/
34SOURCES := ${SRC_DIR}/jdk/test/failurehandler/*.java \
35${SRC_DIR}/jdk/test/failurehandler/action/*.java \
36${SRC_DIR}/jdk/test/failurehandler/jtreg/*.java \
37${SRC_DIR}/jdk/test/failurehandler/value/*.java
38
39CONF_DIR = src/share/conf
40
41JAVA_RELEASE = 15
42
43TARGET_JAR = ${IMAGE_DIR}/lib/jtregFailureHandler.jar
44
45OS_NAME := $(shell uname -o 2>&1)
46
47ifeq ("${OS_NAME}", "Cygwin")
48BUILD_DIR := $(shell cygpath -m "${BUILD_DIR}")
49CLASSES_DIR := $(shell cygpath -m "${CLASSES_DIR}")
50IMAGE_DIR := $(shell cygpath -m "${IMAGE_DIR}")
51RUN_DIR := $(shell cygpath -m "${RUN_DIR}")
52SRC_DIR := $(shell cygpath -m "${SRC_DIR}")
53JAVA_HOME := $(shell cygpath -m "${JAVA_HOME}")
54JTREG_HOME := $(shell cygpath -m "${JTREG_HOME}")
55CLASSPATH := $(shell cygpath -pm "${CLASSPATH}")
56endif
57
58all: clean test
59
60check_defined = $(foreach 1,$1,$(__check_defined))
61__check_defined = $(if $(value $1),, $(error $1 is not set))
62
63classes: require_env
64mkdir -p ${IMAGE_DIR}/bin ${IMAGE_DIR}/lib ${CLASSES_DIR}
65"${JAVA_HOME}"/bin/javac -target ${JAVA_RELEASE} -source ${JAVA_RELEASE} \
66-sourcepath "$(shell pwd)" \
67-cp "${CLASSPATH}" \
68-d ${CLASSES_DIR} \
69${SOURCES}
70"${JAVA_HOME}"/bin/jar cf "${TARGET_JAR}" -C "${CLASSES_DIR}" .
71"${JAVA_HOME}"/bin/jar uf "${TARGET_JAR}" -C "${CONF_DIR}" .
72
73#
74# Use JTREG_TEST_OPTS for test VM options
75# Use JTREG_TESTS for jtreg tests parameter
76#
77test: require_env build
78rm -rf "${RUN_DIR}"
79mkdir -p "${RUN_DIR}"
80"${JTREG_HOME}"/bin/jtreg \
81-jdk:"${JAVA_HOME}" \
82${JTREG_TEST_OPTS} \
83-timeout:0.1 -va -retain:all \
84-noreport \
85-agentvm \
86-thd:"${TARGET_JAR}" \
87-th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
88-thtimeout:0 \
89-od:"${TARGET_JAR}" \
90-o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
91-w:"${RUN_DIR}/JTwork" \
92-r:"${RUN_DIR}/JTreport" \
93$(if ${JTREG_TESTS}, ${JTREG_TESTS}, test) \
94&& false || true
95
96debug: JTREG_TEST_OPTS += "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'"
97debug: test
98
99require_env:
100$(call check_defined, JAVA_HOME)
101$(call check_defined, JTREG_HOME)
102
103clean:
104rm -rf "${BUILD_DIR}" "${RUN_DIR}"
105
106build: classes
107
108.PHONY: all build classes test require_env clean
109.DEFAULT: all
110