8219393: Add native library support for microbenchmarks

Reviewed-by: erikj
This commit is contained in:
Jorn Vernee 2019-02-19 23:02:41 +01:00 committed by Claes Redestad
parent 272869390e
commit 67c2e382d3
2 changed files with 27 additions and 2 deletions

View File

@ -658,6 +658,8 @@ define SetupRunMicroTestBody
# Current tests needs to open java.io
$1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
# Set library path for native dependencies
$1_MICRO_JAVA_OPTIONS += -Djava.library.path=$$(TEST_IMAGE_DIR)/micro/native
# Save output as JSON or CSV file
ifneq ($$(MICRO_RESULTS_FORMAT), )

View File

@ -30,6 +30,7 @@ include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
include TestFilesCompilation.gmk
ifeq ($(JMH_CORE_JAR), )
$(info Error: JMH is missing. Please use configure --with-jmh.)
@ -39,7 +40,8 @@ endif
#### Variables
MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
MICROBENCHMARK_JAR := $(IMAGES_OUTPUTDIR)/test/micro/benchmarks.jar
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
@ -54,6 +56,11 @@ JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JA
MICROBENCHMARK_CLASSPATH := $(call PathList, $(JMH_COMPILE_JARS))
# 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
@ -108,6 +115,22 @@ $(eval $(call SetupJarArchive, BUILD_JDK_JAR, \
JAR := $(MICROBENCHMARK_JAR), \
))
all: $(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), \
DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \
FILES := $(BUILD_MICROBENCHMARK_LIBRARIES), \
FLATTEN := true, \
))
all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
.PHONY: all