From 67c2e382d35734ea85c69bd5d01a03e272727672 Mon Sep 17 00:00:00 2001 From: Jorn Vernee Date: Tue, 19 Feb 2019 23:02:41 +0100 Subject: [PATCH] 8219393: Add native library support for microbenchmarks Reviewed-by: erikj --- make/RunTests.gmk | 2 ++ make/test/BuildMicrobenchmark.gmk | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index 37a21829947..b42c27faa36 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -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), ) diff --git a/make/test/BuildMicrobenchmark.gmk b/make/test/BuildMicrobenchmark.gmk index cebf444cafe..d12f67fa460 100644 --- a/make/test/BuildMicrobenchmark.gmk +++ b/make/test/BuildMicrobenchmark.gmk @@ -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