undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com Patches, unit tests, benchmarks, whitepaper, and outreach briefs. Public domain — no copyright claimed. Use freely.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
112
make/test/BuildFailureHandler.gmk
Normal file
112
make/test/BuildFailureHandler.gmk
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
#
|
||||
# Copyright (c) 2016, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
FH_BASEDIR := $(TOPDIR)/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, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
|
||||
SRC := $(FH_BASEDIR)/src/share/classes $(FH_BASEDIR)/src/share/conf, \
|
||||
BIN := $(FH_SUPPORT)/classes, \
|
||||
DISABLED_WARNINGS := options serial try this-escape, \
|
||||
COPY := .properties, \
|
||||
CLASSPATH := $(JTREG_JAR) $(TOOLS_JAR), \
|
||||
JAR := $(FH_JAR), \
|
||||
JAVAC_FLAGS := -XDstringConcat=inline, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_FAILURE_HANDLER)
|
||||
|
||||
################################################################################
|
||||
# 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
|
||||
#
|
||||
# Most likely you want to select a specific test from test/failure_handler/test
|
||||
# and manually inspect the results. This target does not actually verify
|
||||
# anything about the failure_handler's output or even if it ran at all.
|
||||
#
|
||||
RUN_DIR := $(FH_SUPPORT)/test
|
||||
|
||||
test:
|
||||
$(RM) -r $(RUN_DIR)
|
||||
$(MKDIR) -p $(RUN_DIR)
|
||||
$(CD) $(FH_BASEDIR)/test && $(JAVA) -Dprogram=jtreg \
|
||||
-jar $(JT_HOME)/lib/jtreg.jar \
|
||||
-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: images test
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
66
make/test/BuildJtregTestThreadFactory.gmk
Normal file
66
make/test/BuildJtregTestThreadFactory.gmk
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Copyright (c) 2022, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
TTF_BASEDIR := $(TOPDIR)/test/jtreg_test_thread_factory
|
||||
TTF_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/jtreg_test_thread_factory
|
||||
TTF_JAR := $(TTF_SUPPORT)/jtregTestThreadFactory.jar
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_JTREG_TEST_THREAD_FACTORY, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SRC := $(TTF_BASEDIR)/src/share/classes, \
|
||||
BIN := $(TTF_SUPPORT)/classes, \
|
||||
JAR := $(TTF_JAR), \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_JTREG_TEST_THREAD_FACTORY)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to hotspot jtreg test image
|
||||
$(eval $(call SetupCopyFiles, COPY_TTF, \
|
||||
SRC := $(TTF_SUPPORT), \
|
||||
DEST := $(TEST_IMAGE_DIR)/jtreg_test_thread_factory, \
|
||||
FILES := $(TTF_JAR), \
|
||||
))
|
||||
|
||||
IMAGES_TARGETS += $(COPY_TTF)
|
||||
|
||||
build: $(TARGETS)
|
||||
images: $(IMAGES_TARGETS)
|
||||
|
||||
.PHONY: images
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
169
make/test/BuildMicrobenchmark.gmk
Normal file
169
make/test/BuildMicrobenchmark.gmk
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
#
|
||||
# Copyright (c) 2018, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JarArchive.gmk
|
||||
include JavaCompilation.gmk
|
||||
include TestFilesCompilation.gmk
|
||||
|
||||
ifeq ($(JMH_CORE_JAR), )
|
||||
$(info Error: JMH is missing. Please use configure --with-jmh.)
|
||||
$(error Cannot continue)
|
||||
endif
|
||||
|
||||
#### Variables
|
||||
|
||||
MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
|
||||
MICROBENCHMARK_IMAGE_DIR := $(TEST_IMAGE_DIR)/micro
|
||||
MICROBENCHMARK_JAR := $(MICROBENCHMARK_IMAGE_DIR)/benchmarks.jar
|
||||
|
||||
MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro
|
||||
MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes
|
||||
MICROBENCHMARK_GENSRC := $(MICROBENCHMARK_OUTPUT)/gensrc
|
||||
MICROBENCHMARK_JAR_BIN := $(MICROBENCHMARK_OUTPUT)/jar
|
||||
|
||||
MICROBENCHMARK_TOOLS_CLASSES := $(MICROBENCHMARK_OUTPUT)/tools-classes
|
||||
|
||||
JMH_UNPACKED_DIR := $(MICROBENCHMARK_OUTPUT)/jmh_jars
|
||||
JMH_UNPACKED_JARS_DONE := $(JMH_UNPACKED_DIR)/_unpacked.marker
|
||||
|
||||
# External dependencies
|
||||
WHITEBOX_JAR := $(SUPPORT_OUTPUTDIR)/test/lib/wb.jar
|
||||
JMH_COMPILE_JARS := $(JMH_CORE_JAR) $(JMH_GENERATOR_JAR) $(WHITEBOX_JAR)
|
||||
JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JAR)
|
||||
|
||||
# Native dependencies
|
||||
MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC)
|
||||
MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native
|
||||
MICROBENCHMARK_NATIVE_EXCLUDE :=
|
||||
|
||||
###
|
||||
|
||||
# Need double \n to get new lines and no trailing spaces
|
||||
MICROBENCHMARK_MANIFEST := Build: $(FULL_VERSION)\n\
|
||||
\nJMH-Version: $(JMH_VERSION)\n\
|
||||
\nName: OpenJDK Microbenchmark Suite
|
||||
|
||||
#### Compile Targets
|
||||
|
||||
# Building microbenchmark requires the jdk.unsupported and java.management modules.
|
||||
# sun.security.util is required to compile Cache benchmark.
|
||||
# jmh uses annotation processors to generate the benchmark jar and thus
|
||||
# requires the use of -processor option during benchmark compilation.
|
||||
|
||||
# Build microbenchmark suite for the current JDK
|
||||
$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SMALL_JAVA := false, \
|
||||
CLASSPATH := $(JMH_COMPILE_JARS), \
|
||||
CREATE_API_DIGEST := true, \
|
||||
DISABLED_WARNINGS := restricted this-escape processing rawtypes removal cast \
|
||||
serial preview dangling-doc-comments, \
|
||||
SRC := $(MICROBENCHMARK_SRC), \
|
||||
BIN := $(MICROBENCHMARK_CLASSES), \
|
||||
JAVAC_FLAGS := \
|
||||
--add-exports java.base/jdk.internal.classfile.components=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.impl=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.event=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.jimage=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.util=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.util=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.util.math=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.util.math.intpoly=ALL-UNNAMED \
|
||||
--enable-preview \
|
||||
-XDsuppressNotes \
|
||||
-processor org.openjdk.jmh.generators.BenchmarkProcessor \
|
||||
-s $(MICROBENCHMARK_GENSRC), \
|
||||
JAVA_FLAGS := \
|
||||
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
|
||||
--add-modules jdk.unsupported \
|
||||
--enable-preview \
|
||||
--limit-modules java.management, \
|
||||
))
|
||||
|
||||
$(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)
|
||||
|
||||
# Unpacking dependencies for inclusion in the benchmark JARs
|
||||
$(JMH_UNPACKED_JARS_DONE): $(JMH_RUNTIME_JARS)
|
||||
$(RM) -r $(JMH_UNPACKED_DIR)
|
||||
$(MKDIR) -p $(JMH_UNPACKED_DIR)
|
||||
$(foreach jar, $(JMH_RUNTIME_JARS), \
|
||||
$$($(UNZIP) -oq $(jar) -d $(JMH_UNPACKED_DIR)))
|
||||
$(RM) -r $(JMH_UNPACKED_DIR)/META-INF
|
||||
$(TOUCH) $@
|
||||
|
||||
# Copy dependency files for inclusion in the benchmark JARs
|
||||
$(eval $(call SetupCopyFiles, COPY_JAXP_TEST_XML, \
|
||||
SRC := $(TOPDIR)/test/jaxp/javax/xml/jaxp/unittest, \
|
||||
DEST := $(MICROBENCHMARK_CLASSES)/org/openjdk/bench/javax/xml, \
|
||||
FILES := \
|
||||
stream/XMLStreamWriterTest/message_12.xml \
|
||||
validation/tck/reZ003vExc23082309.xml \
|
||||
transform/msgAttach.xml, \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
# Create benchmarks JAR file with benchmarks for both the old and new JDK
|
||||
$(eval $(call SetupJarArchive, BUILD_JDK_JAR, \
|
||||
DEPENDENCIES := $(BUILD_JDK_MICROBENCHMARK) $(JMH_UNPACKED_JARS_DONE) $(COPY_JAXP_TEST_XML), \
|
||||
SRCS := $(MICROBENCHMARK_CLASSES) $(JMH_UNPACKED_DIR), \
|
||||
BIN := $(MICROBENCHMARK_JAR_BIN), \
|
||||
SUFFIXES := .*, \
|
||||
EXCLUDE_FILES := _the.BUILD_JDK_MICROBENCHMARK_batch \
|
||||
_the.BUILD_JDK_MICROBENCHMARK.vardeps _unpacked.marker, \
|
||||
EXTRA_MANIFEST_ATTR := $(MICROBENCHMARK_MANIFEST), \
|
||||
JARMAIN := org.openjdk.jmh.Main, \
|
||||
JAR := $(MICROBENCHMARK_JAR), \
|
||||
))
|
||||
|
||||
# Setup compilation of native library dependencies
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_MICROBENCHMARK_LIBRARIES, \
|
||||
TYPE := LIBRARY, \
|
||||
SOURCE_DIRS := $(MICROBENCHMARK_NATIVE_SRC_DIRS), \
|
||||
OUTPUT_DIR := $(MICROBENCHMARK_NATIVE_OUTPUT), \
|
||||
EXCLUDE := $(MICROBENCHMARK_NATIVE_EXCLUDE), \
|
||||
))
|
||||
|
||||
# Setup copy of native dependencies to image output dir
|
||||
$(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \
|
||||
SRC := $(MICROBENCHMARK_NATIVE_OUTPUT)/lib, \
|
||||
DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \
|
||||
FILES := $(filter $(MICROBENCHMARK_NATIVE_OUTPUT)/lib/%, \
|
||||
$(BUILD_MICROBENCHMARK_LIBRARIES)), \
|
||||
))
|
||||
|
||||
all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
101
make/test/BuildTestLib.gmk
Normal file
101
make/test/BuildTestLib.gmk
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file builds the Java components of testlib.
|
||||
# It also covers the test-image part, where the built files are copied to the
|
||||
# test image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Targets for building the test lib jars
|
||||
################################################################################
|
||||
|
||||
TEST_LIB_SOURCE_DIR := $(TOPDIR)/test/lib
|
||||
TEST_LIB_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/lib
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_WB_JAR, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SRC := $(TEST_LIB_SOURCE_DIR)/jdk/test/whitebox/, \
|
||||
BIN := $(TEST_LIB_SUPPORT)/wb_classes, \
|
||||
JAR := $(TEST_LIB_SUPPORT)/wb.jar, \
|
||||
DISABLED_WARNINGS := deprecation removal preview, \
|
||||
JAVAC_FLAGS := --enable-preview, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_WB_JAR)
|
||||
|
||||
ifeq ($(call isTargetOs, linux), false)
|
||||
BUILD_TEST_LIB_JAR_EXCLUDES := jdk/test/lib/containers
|
||||
endif
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SRC := $(TEST_LIB_SOURCE_DIR), \
|
||||
EXCLUDES := $(BUILD_TEST_LIB_JAR_EXCLUDES), \
|
||||
BIN := $(TEST_LIB_SUPPORT)/test-lib_classes, \
|
||||
HEADERS := $(TEST_LIB_SUPPORT)/test-lib_headers, \
|
||||
JAR := $(TEST_LIB_SUPPORT)/test-lib.jar, \
|
||||
JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.attribute=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.module=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.platform=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.pkcs=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.provider.certpath=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED \
|
||||
--add-exports java.base/sun.security.x509=ALL-UNNAMED \
|
||||
--enable-preview, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_TEST_LIB_JAR)
|
||||
|
||||
build-test-lib: $(TARGETS)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy the jars to the test image.
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBTEST_JARS, \
|
||||
DEST := $(TEST_IMAGE_DIR)/lib-test, \
|
||||
FILES := $(BUILD_WB_JAR_JAR) $(BUILD_TEST_LIB_JAR_JAR), \
|
||||
))
|
||||
|
||||
test-image-lib: $(COPY_LIBTEST_JARS)
|
||||
|
||||
all: build-test-lib
|
||||
|
||||
.PHONY: build-test-lib test-image-lib
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
90
make/test/BuildTestLibNative.gmk
Normal file
90
make/test/BuildTestLibNative.gmk
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
#
|
||||
# Copyright (c) 2020, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file builds the native component of testlib.
|
||||
# It also covers the test-image part, where the built files are copied to the
|
||||
# test image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include TestFilesCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Targets for building the native tests themselves.
|
||||
################################################################################
|
||||
|
||||
BUILD_LIBTEST_NATIVE_SRC := $(TOPDIR)/test/lib
|
||||
|
||||
BUILD_LIBTEST_OUTPUT_DIR := $(OUTPUTDIR)/support/test/lib/native
|
||||
|
||||
BUILD_LIBTEST_IMAGE_DIR := $(TEST_IMAGE_DIR)/lib
|
||||
|
||||
ifeq ($(call isTargetOs, windows), false)
|
||||
BUILD_LIBTEST_LIBRARIES_EXCLUDE += libFileUtils.c
|
||||
endif
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-lib-native, $(MAKECMDGOALS)), )
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_LIBTEST_LIBRARIES, \
|
||||
TYPE := LIBRARY, \
|
||||
SOURCE_DIRS := $(BUILD_LIBTEST_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_LIBTEST_OUTPUT_DIR), \
|
||||
))
|
||||
endif
|
||||
|
||||
build-test-lib-native: $(BUILD_LIBTEST_LIBRARIES)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to testlib test image. We need it in both hotspot and jdk.
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBTEST_NATIVE_TO_HOTSPOT, \
|
||||
SRC := $(BUILD_LIBTEST_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/hotspot/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(BUILD_LIBTEST_OUTPUT_DIR), /lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBTEST_NATIVE_TO_JDK, \
|
||||
SRC := $(BUILD_LIBTEST_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/jdk/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(BUILD_LIBTEST_OUTPUT_DIR), /lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
test-image-lib-native: $(COPY_LIBTEST_NATIVE_TO_HOTSPOT) $(COPY_LIBTEST_NATIVE_TO_JDK)
|
||||
|
||||
all: build-test-lib-native
|
||||
|
||||
.PHONY: build-test-lib-native test-image-lib-native
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
69
make/test/BuildTestSetupAOT.gmk
Normal file
69
make/test/BuildTestSetupAOT.gmk
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#
|
||||
# Copyright (c) 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file builds the TestSetupAOT.class, which is used by SetupAOT
|
||||
# in ../RunTests.gmk
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include JavaCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
SETUP_AOT_BASEDIR := $(TOPDIR)/test/setup_aot
|
||||
SETUP_AOT_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/setup_aot
|
||||
SETUP_AOT_JAR := $(SETUP_AOT_SUPPORT)/TestSetupAOT.jar
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_SETUP_AOT, \
|
||||
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
|
||||
SRC := $(SETUP_AOT_BASEDIR), \
|
||||
BIN := $(SETUP_AOT_SUPPORT)/classes, \
|
||||
JAR := $(SETUP_AOT_JAR), \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_SETUP_AOT)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to hotspot jtreg test image
|
||||
$(eval $(call SetupCopyFiles, COPY_SETUP_AOT, \
|
||||
DEST := $(TEST_IMAGE_DIR)/setup_aot, \
|
||||
FILES := $(SETUP_AOT_JAR), \
|
||||
))
|
||||
|
||||
IMAGES_TARGETS += $(COPY_SETUP_AOT)
|
||||
|
||||
images: $(IMAGES_TARGETS)
|
||||
|
||||
.PHONY: images
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
173
make/test/JtregNativeHotspot.gmk
Normal file
173
make/test/JtregNativeHotspot.gmk
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file builds the native component of the JTReg tests for Hotspot.
|
||||
# It also covers the test-image part, where the built files are copied to the
|
||||
# test image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include TestFilesCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Targets for building the native tests themselves.
|
||||
################################################################################
|
||||
|
||||
# This might have been added to by a custom extension.
|
||||
HOTSPOT_JTREG_NATIVE_SRC += $(TOPDIR)/test/hotspot/jtreg
|
||||
|
||||
HOTSPOT_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/hotspot/jtreg/native
|
||||
VM_TESTBASE_DIR := $(TOPDIR)/test/hotspot/jtreg/vmTestbase
|
||||
NSK_SHARE_DIR := $(VM_TESTBASE_DIR)/nsk/share
|
||||
|
||||
################################################################################
|
||||
# Platform independent setup
|
||||
|
||||
# Optimization -O3 needed, HIGH == -O3
|
||||
HOTSPOT_JTREG_LIBRARIES_OPTIMIZATION_libNoFramePointer := HIGH
|
||||
|
||||
HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exesigtest := java.base:libjvm
|
||||
HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exedaemonDestroy := java.base:libjvm
|
||||
|
||||
################################################################################
|
||||
# Platform specific setup
|
||||
|
||||
ifeq ($(call isTargetOs, linux), true)
|
||||
HOTSPOT_JTREG_LIBRARIES_CFLAGS_libNoFramePointer := -fomit-frame-pointer
|
||||
HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rw := -z noexecstack
|
||||
HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libtest-rwx := -z execstack
|
||||
HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exeinvoke := java.base:libjvm
|
||||
HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exestack-gap := java.base:libjvm
|
||||
HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exestack-tls := java.base:libjvm
|
||||
TEST_exeinvoke_exeinvoke.c_OPTIMIZATION := NONE
|
||||
HOTSPOT_JTREG_EXECUTABLES_LIBS_exeFPRegs := -ldl
|
||||
HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit += -ldl
|
||||
HOTSPOT_JTREG_LIBRARIES_LIBS_libAsyncGetCallTraceTest := -ldl
|
||||
HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libfast-math := -ffast-math
|
||||
else
|
||||
HOTSPOT_JTREG_EXCLUDE += libtest-rw.c libtest-rwx.c \
|
||||
exeinvoke.c exestack-gap.c exestack-tls.c libAsyncGetCallTraceTest.cpp
|
||||
endif
|
||||
|
||||
ifneq ($(call isTargetOs, linux)+$(call isTargetCpu, aarch64), true+true)
|
||||
HOTSPOT_JTREG_EXCLUDE += libTestSVEWithJNI.c
|
||||
endif
|
||||
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
|
||||
HOTSPOT_JTREG_LIBRARIES_JDK_LIBS_libnativeStack := java.base:libjvm
|
||||
|
||||
HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c libTestJNI.c \
|
||||
libCompleteExit.c libMonitorWithDeadObjectTest.c libTestPsig.c \
|
||||
exeGetCreatedJavaVMs.c libTestUnloadedClass.cpp
|
||||
else
|
||||
HOTSPOT_JTREG_EXECUTABLES_JDK_LIBS_exeGetCreatedJavaVMs := java.base:libjvm
|
||||
|
||||
HOTSPOT_JTREG_EXCLUDE += libNativeException.c exeGetProcessorInfo.c
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Global setup
|
||||
|
||||
# Any executable which launches the JVM and uses a custom launcher needs to
|
||||
# explicitly link in the default ASan and LSan options.
|
||||
ifeq ($(ASAN_ENABLED), true)
|
||||
HOTSPOT_JTREG_EXTRA_FILES += $(TOPDIR)/make/data/asan/asan_default_options.c
|
||||
endif
|
||||
ifeq ($(LSAN_ENABLED), true)
|
||||
HOTSPOT_JTREG_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.c
|
||||
endif
|
||||
|
||||
HOTSPOT_JTREG_CFLAGS := \
|
||||
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS \
|
||||
-I$(NSK_SHARE_DIR)/aod \
|
||||
-I$(NSK_SHARE_DIR)/gc/lock/jni \
|
||||
-I$(NSK_SHARE_DIR)/gc/lock/jniref \
|
||||
-I$(NSK_SHARE_DIR)/jdi \
|
||||
-I$(NSK_SHARE_DIR)/jni \
|
||||
-I$(NSK_SHARE_DIR)/jvmti \
|
||||
-I$(NSK_SHARE_DIR)/jvmti/agent_common \
|
||||
-I$(NSK_SHARE_DIR)/jvmti/aod \
|
||||
-I$(NSK_SHARE_DIR)/locks \
|
||||
-I$(NSK_SHARE_DIR)/native \
|
||||
-I$(TOPDIR)/test/lib/jdk/test/lib/jvmti \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/stress/jni \
|
||||
-I$(VM_TESTBASE_DIR)/vm/mlvm/share \
|
||||
-I$(VM_TESTBASE_DIR)/vm/share \
|
||||
#
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-hotspot-jtreg-native, $(MAKECMDGOALS)), )
|
||||
$(eval $(call SetupTestFilesCompilation, HOTSPOT_JTREG_LIBRARIES, \
|
||||
TYPE := LIBRARY, \
|
||||
SOURCE_DIRS := $(HOTSPOT_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(HOTSPOT_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(HOTSPOT_JTREG_EXCLUDE), \
|
||||
CFLAGS := $(HOTSPOT_JTREG_CFLAGS), \
|
||||
LIBS := $(LIBPTHREAD), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTestFilesCompilation, HOTSPOT_JTREG_EXECUTABLES, \
|
||||
TYPE := PROGRAM, \
|
||||
SOURCE_DIRS := $(HOTSPOT_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(HOTSPOT_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(HOTSPOT_JTREG_EXCLUDE), \
|
||||
EXTRA_FILES := $(HOTSPOT_JTREG_EXTRA_FILES), \
|
||||
CFLAGS := $(HOTSPOT_JTREG_CFLAGS), \
|
||||
LIBS := $(LIBPTHREAD), \
|
||||
))
|
||||
endif
|
||||
|
||||
build-test-hotspot-jtreg-native: $(HOTSPOT_JTREG_LIBRARIES) \
|
||||
$(HOTSPOT_JTREG_EXECUTABLES)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to hotspot jtreg test image
|
||||
$(eval $(call SetupCopyFiles, COPY_HOTSPOT_JTREG_NATIVE, \
|
||||
SRC := $(HOTSPOT_JTREG_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/hotspot/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(HOTSPOT_JTREG_OUTPUT_DIR), /bin/* \
|
||||
/lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
test-image-hotspot-jtreg-native: $(COPY_HOTSPOT_JTREG_NATIVE)
|
||||
|
||||
all: build-test-hotspot-jtreg-native
|
||||
test-image: test-image-hotspot-jtreg-native
|
||||
|
||||
.PHONY: build-test-hotspot-jtreg-native test-image-hotspot-jtreg-native \
|
||||
test-image
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
173
make/test/JtregNativeJdk.gmk
Normal file
173
make/test/JtregNativeJdk.gmk
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
#
|
||||
# Copyright (c) 2015, 2026, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file builds the native component of the JTReg tests for JDK.
|
||||
# It also covers the test-image part, where the built files are copied to the
|
||||
# test image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include TestFilesCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Targets for building the native tests themselves.
|
||||
################################################################################
|
||||
|
||||
# This might have been added to by a custom extension.
|
||||
BUILD_JDK_JTREG_NATIVE_SRC += $(TOPDIR)/test/jdk
|
||||
|
||||
BUILD_JDK_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/jdk/jtreg/native
|
||||
|
||||
BUILD_JDK_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/jdk/jtreg
|
||||
|
||||
BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeJliLaunchTest := \
|
||||
-I$(TOPDIR)/src/java.base/share/native/libjli \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
|
||||
#
|
||||
|
||||
BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeJliLaunchTest := java.base:libjli
|
||||
BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeCallerAccessTest := java.base:libjvm
|
||||
BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeNullCallerTest := java.base:libjvm
|
||||
|
||||
BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libstringPlatformChars := java.base:libjava
|
||||
BUILD_JDK_JTREG_LIBRARIES_JDK_LIBS_libGetXSpace := java.base:libjava
|
||||
|
||||
# Platform specific setup
|
||||
ifeq ($(call isTargetOs, windows), true)
|
||||
BUILD_JDK_JTREG_EXCLUDE += libDirectIO.c libInheritedChannel.c \
|
||||
libExplicitAttach.c libImplicitAttach.c \
|
||||
exelauncher.c libFDLeaker.c exeFDLeakTester.c \
|
||||
libChangeSignalDisposition.c exePrintSignalDisposition.c \
|
||||
libConcNativeFork.c libPipesCloseOnExec.c
|
||||
|
||||
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX)
|
||||
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib
|
||||
BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeNullCallerTest := /EHsc
|
||||
else
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeThread := -pthread
|
||||
|
||||
# java.lang.foreign tests
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libAsyncStackWalk := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libAsyncInvokers := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLinkerInvokerUnnamed := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLinkerInvokerModule := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLoaderLookupInvoker := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libConcNativeFork := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libPipesCloseOnExec := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLoaderLookupInvoker := -pthread
|
||||
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libExplicitAttach := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libImplicitAttach := -pthread
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libJNIAttachMutator := -pthread
|
||||
BUILD_JDK_JTREG_EXCLUDE += exerevokeall.c
|
||||
ifeq ($(call isTargetOs, linux), true)
|
||||
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exelauncher := -ldl
|
||||
endif
|
||||
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX)
|
||||
endif
|
||||
|
||||
ifeq ($(call isTargetOs, macosx), true)
|
||||
BUILD_JDK_JTREG_EXCLUDE += exelauncher.c
|
||||
BUILD_JDK_JTREG_LIBRARIES_LIBS_libTestMainKeyWindow := \
|
||||
-framework Cocoa
|
||||
BUILD_JDK_JTREG_EXECUTABLES_JDK_LIBS_exeJniInvocationTest := java.base:libjli
|
||||
BUILD_JDK_JTREG_LIBRARIES_LIBS_libTestDynamicStore := \
|
||||
-framework Cocoa -framework SystemConfiguration
|
||||
else
|
||||
BUILD_JDK_JTREG_EXCLUDE += libTestMainKeyWindow.m
|
||||
BUILD_JDK_JTREG_EXCLUDE += libTestDynamicStore.m
|
||||
BUILD_JDK_JTREG_EXCLUDE += exeJniInvocationTest.c
|
||||
BUILD_JDK_JTREG_EXCLUDE += exeLibraryCache.c
|
||||
endif
|
||||
|
||||
ifeq ($(call isTargetOs, linux), true)
|
||||
# Unconditionally compile with debug symbols and don't ever perform
|
||||
# stripping during the test libraries' build.
|
||||
BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libFib := -g
|
||||
BUILD_JDK_JTREG_LIBRARIES_STRIP_SYMBOLS_libFib := false
|
||||
# nio tests' libCreationTimeHelper native needs -ldl linker flag
|
||||
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libCreationTimeHelper := -ldl
|
||||
endif
|
||||
|
||||
ifeq ($(ASAN_ENABLED), true)
|
||||
# Any executable which launches the JVM and uses a custom launcher needs to explicitly link in the
|
||||
# default ASan options.
|
||||
BUILD_JDK_JTREG_EXTRA_FILES += $(TOPDIR)/make/data/asan/asan_default_options.c
|
||||
endif
|
||||
|
||||
ifeq ($(LSAN_ENABLED), true)
|
||||
# Any executable which launches the JVM and uses a custom launcher needs to explicitly link in the
|
||||
# default LSan options.
|
||||
BUILD_JDK_JTREG_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.c
|
||||
endif
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-jdk-jtreg-native, $(MAKECMDGOALS)), )
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_LIBRARIES, \
|
||||
TYPE := LIBRARY, \
|
||||
SOURCE_DIRS := $(BUILD_JDK_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_JDK_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(BUILD_JDK_JTREG_EXCLUDE), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_JDK_JTREG_EXECUTABLES, \
|
||||
TYPE := PROGRAM, \
|
||||
SOURCE_DIRS := $(BUILD_JDK_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_JDK_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(BUILD_JDK_JTREG_EXCLUDE), \
|
||||
EXTRA_FILES := $(BUILD_JDK_JTREG_EXTRA_FILES), \
|
||||
LIBS := $(LIBPTHREAD), \
|
||||
))
|
||||
endif
|
||||
|
||||
build-test-jdk-jtreg-native: $(BUILD_JDK_JTREG_LIBRARIES) $(BUILD_JDK_JTREG_EXECUTABLES)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to jdk jtreg test image
|
||||
$(eval $(call SetupCopyFiles, COPY_JDK_JTREG_NATIVE, \
|
||||
SRC := $(BUILD_JDK_JTREG_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/jdk/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(BUILD_JDK_JTREG_OUTPUT_DIR), /bin/* /lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
test-image-jdk-jtreg-native: $(COPY_JDK_JTREG_NATIVE)
|
||||
|
||||
all: build-test-jdk-jtreg-native
|
||||
test-image: test-image-jdk-jtreg-native
|
||||
|
||||
.PHONY: build-test-jdk-jtreg-native test-image-jdk-jtreg-native test-image
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
91
make/test/JtregNativeLibTest.gmk
Normal file
91
make/test/JtregNativeLibTest.gmk
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#
|
||||
# Copyright (c) 2020, 2025, 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.
|
||||
#
|
||||
|
||||
include MakeFileStart.gmk
|
||||
|
||||
################################################################################
|
||||
# This file builds the native component of the JTReg tests for testlibrary.
|
||||
# It also covers the test-image part, where the built files are copied to the
|
||||
# test image.
|
||||
################################################################################
|
||||
|
||||
include CopyFiles.gmk
|
||||
include TestFilesCompilation.gmk
|
||||
|
||||
################################################################################
|
||||
# Targets for building the native tests themselves.
|
||||
################################################################################
|
||||
|
||||
# This might have been added to by a custom extension.
|
||||
BUILD_LIBTEST_JTREG_NATIVE_SRC += $(TOPDIR)/test/lib-test
|
||||
|
||||
BUILD_LIBTEST_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/lib-test/jtreg/native
|
||||
|
||||
BUILD_LIBTEST_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/lib-test/jtreg
|
||||
|
||||
BUILD_LIBTEST_JTREG_EXECUTABLES_JDK_LIBS_exejvm-test-launcher := java.base:libjvm
|
||||
|
||||
# This evaluation is expensive and should only be done if this target was
|
||||
# explicitly called.
|
||||
ifneq ($(filter build-test-libtest-jtreg-native, $(MAKECMDGOALS)), )
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_LIBTEST_JTREG_LIBRARIES, \
|
||||
TYPE := LIBRARY, \
|
||||
SOURCE_DIRS := $(BUILD_LIBTEST_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(BUILD_LIBTEST_JTREG_EXCLUDE), \
|
||||
))
|
||||
|
||||
$(eval $(call SetupTestFilesCompilation, BUILD_LIBTEST_JTREG_EXECUTABLES, \
|
||||
TYPE := PROGRAM, \
|
||||
SOURCE_DIRS := $(BUILD_LIBTEST_JTREG_NATIVE_SRC), \
|
||||
OUTPUT_DIR := $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), \
|
||||
EXCLUDE := $(BUILD_LIBTEST_JTREG_EXCLUDE), \
|
||||
))
|
||||
endif
|
||||
|
||||
build-test-libtest-jtreg-native: $(BUILD_LIBTEST_JTREG_LIBRARIES) $(BUILD_LIBTEST_JTREG_EXECUTABLES)
|
||||
|
||||
################################################################################
|
||||
# Targets for building test-image.
|
||||
################################################################################
|
||||
|
||||
# Copy to lib-test jtreg test image
|
||||
$(eval $(call SetupCopyFiles, COPY_LIBTEST_JTREG_NATIVE, \
|
||||
SRC := $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), \
|
||||
DEST := $(TEST_IMAGE_DIR)/lib-test/jtreg/native, \
|
||||
FILES := $(wildcard $(addprefix $(BUILD_LIBTEST_JTREG_OUTPUT_DIR), /bin/* /lib/*)), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
test-image-libtest-jtreg-native: $(COPY_LIBTEST_JTREG_NATIVE)
|
||||
|
||||
all: build-test-libtest-jtreg-native
|
||||
test-image: test-image-libtest-jtreg-native
|
||||
|
||||
.PHONY: build-test-libtest-jtreg-native test-image-libtest-jtreg-native test-image
|
||||
|
||||
################################################################################
|
||||
|
||||
include MakeFileEnd.gmk
|
||||
Loading…
Add table
Add a link
Reference in a new issue