8316657: Support whitebox testing in microbenchmarks

Reviewed-by: erikj, redestad
This commit is contained in:
Magnus Ihse Bursie 2023-12-11 14:17:38 +00:00
parent ce8399fd60
commit 486594d427
3 changed files with 51 additions and 18 deletions

View File

@ -744,9 +744,16 @@ endif
$(eval $(call SetupTarget, build-test-lib, \ $(eval $(call SetupTarget, build-test-lib, \
MAKEFILE := test/BuildTestLib, \ MAKEFILE := test/BuildTestLib, \
TARGET := build-test-lib, \
DEPS := exploded-image, \ DEPS := exploded-image, \
)) ))
$(eval $(call SetupTarget, test-image-lib, \
MAKEFILE := test/BuildTestLib, \
TARGET := test-image-lib, \
DEPS := build-test-lib, \
))
ifeq ($(BUILD_FAILURE_HANDLER), true) ifeq ($(BUILD_FAILURE_HANDLER), true)
# Builds the failure handler jtreg extension # Builds the failure handler jtreg extension
$(eval $(call SetupTarget, build-test-failure-handler, \ $(eval $(call SetupTarget, build-test-failure-handler, \
@ -781,7 +788,7 @@ endif
$(eval $(call SetupTarget, build-microbenchmark, \ $(eval $(call SetupTarget, build-microbenchmark, \
MAKEFILE := test/BuildMicrobenchmark, \ MAKEFILE := test/BuildMicrobenchmark, \
DEPS := interim-langtools exploded-image, \ DEPS := interim-langtools exploded-image build-test-lib, \
)) ))
################################################################################ ################################################################################
@ -1264,7 +1271,7 @@ all-docs-bundles: docs-jdk-bundles docs-javase-bundles docs-reference-bundles
# This target builds the test image # This target builds the test image
test-image: prepare-test-image test-image-jdk-jtreg-native \ test-image: prepare-test-image test-image-jdk-jtreg-native \
test-image-demos-jdk test-image-libtest-jtreg-native \ test-image-demos-jdk test-image-libtest-jtreg-native \
test-image-lib-native test-image-lib test-image-lib-native
ifneq ($(JVM_TEST_IMAGE_TARGETS), ) ifneq ($(JVM_TEST_IMAGE_TARGETS), )
# If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the # If JVM_TEST_IMAGE_TARGETS is externally defined, use it instead of the

View File

@ -53,11 +53,10 @@ JMH_UNPACKED_DIR := $(MICROBENCHMARK_OUTPUT)/jmh_jars
JMH_UNPACKED_JARS_DONE := $(JMH_UNPACKED_DIR)/_unpacked.marker JMH_UNPACKED_JARS_DONE := $(JMH_UNPACKED_DIR)/_unpacked.marker
# External dependencies # External dependencies
JMH_COMPILE_JARS := $(JMH_CORE_JAR) $(JMH_GENERATOR_JAR) 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) JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JAR)
MICROBENCHMARK_CLASSPATH := $(call PathList, $(JMH_COMPILE_JARS))
# Native dependencies # Native dependencies
MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC) MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC)
MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native
@ -92,24 +91,28 @@ $(eval $(call SetupJavaCompilation, BUILD_INDIFY, \
$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \ TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
SMALL_JAVA := false, \ SMALL_JAVA := false, \
CLASSPATH := $(MICROBENCHMARK_CLASSPATH), \ CLASSPATH := $(JMH_COMPILE_JARS), \
DISABLED_WARNINGS := restricted this-escape processing rawtypes cast serial preview, \ DISABLED_WARNINGS := restricted this-escape processing rawtypes cast \
serial preview, \
SRC := $(MICROBENCHMARK_SRC), \ SRC := $(MICROBENCHMARK_SRC), \
BIN := $(MICROBENCHMARK_CLASSES), \ BIN := $(MICROBENCHMARK_CLASSES), \
JAVAC_FLAGS := --add-exports java.base/sun.security.util=ALL-UNNAMED \ JAVAC_FLAGS := \
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
--add-exports java.base/jdk.internal.classfile.impl=ALL-UNNAMED \ --add-exports java.base/jdk.internal.classfile.impl=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports java.base/jdk.internal.event=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.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm=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 \
--enable-preview \ --enable-preview \
-processor org.openjdk.jmh.generators.BenchmarkProcessor, \ -processor org.openjdk.jmh.generators.BenchmarkProcessor, \
JAVA_FLAGS := --add-modules jdk.unsupported --limit-modules java.management \ JAVA_FLAGS := \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \ --add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--enable-preview, \ --add-modules jdk.unsupported \
--enable-preview \
--limit-modules java.management, \
)) ))
$(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS) $(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)

View File

@ -23,12 +23,22 @@
# questions. # questions.
# #
################################################################################
# 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.
################################################################################
default: all default: all
include $(SPEC) include $(SPEC)
include MakeBase.gmk include MakeBase.gmk
include JavaCompilation.gmk include JavaCompilation.gmk
################################################################################
# Targets for building the test lib jars
################################################################################
TARGETS := TARGETS :=
TEST_LIB_SOURCE_DIR := $(TOPDIR)/test/lib TEST_LIB_SOURCE_DIR := $(TOPDIR)/test/lib
@ -63,8 +73,21 @@ $(eval $(call SetupJavaCompilation, BUILD_TEST_LIB_JAR, \
TARGETS += $(BUILD_TEST_LIB_JAR) TARGETS += $(BUILD_TEST_LIB_JAR)
########################################################################################## build-test-lib: $(TARGETS)
all: $(TARGETS) ################################################################################
# Targets for building test-image.
################################################################################
.PHONY: default all # 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: default all build-test-lib test-image-lib