8219393: Add native library support for microbenchmarks
Reviewed-by: erikj
Contributed-by: jbvernee@xs4all.nl
--- a/make/RunTests.gmk Tue Feb 19 13:51:11 2019 -0800
+++ b/make/RunTests.gmk Tue Feb 19 23:02:41 2019 +0100
@@ -658,6 +658,8 @@
# 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), )
--- a/make/test/BuildMicrobenchmark.gmk Tue Feb 19 13:51:11 2019 -0800
+++ b/make/test/BuildMicrobenchmark.gmk Tue Feb 19 23:02:41 2019 +0100
@@ -30,6 +30,7 @@
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 @@
#### 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 @@
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 @@
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