8072842: Add support for building native JTReg tests

Reviewed-by: erikj, sla
This commit is contained in:
Magnus Ihse Bursie 2015-02-27 11:56:34 +01:00
parent 44cc65ae49
commit 0624f19e6e
5 changed files with 171 additions and 3 deletions

@ -0,0 +1,81 @@
#
# Copyright (c) 2015, 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.
#
################################################################################
# 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.
################################################################################
default: all
include $(SPEC)
include MakeBase.gmk
include TestFilesCompilation.gmk
################################################################################
# Targets for building the native tests themselves.
################################################################################
# Add more directories here when needed.
BUILD_HOTSPOT_JTREG_NATIVE_SRC := \
$(HOTSPOT_TOPDIR)/test/native_sanity \
#
BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_LIBRARIES, \
TYPE := LIBRARY, \
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
))
$(eval $(call SetupTestFilesCompilation, BUILD_HOTSPOT_JTREG_EXECUTABLES, \
TYPE := PROGRAM, \
SOURCE_DIRS := $(BUILD_HOTSPOT_JTREG_NATIVE_SRC), \
OUTPUT_DIR := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
))
build-test-hotspot-jtreg-native: $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES)
################################################################################
# Targets for building test-image.
################################################################################
# Copy to hotspot jtreg test image
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_JTREG_NATIVE, \
SRC := $(BUILD_HOTSPOT_JTREG_OUTPUT_DIR), \
DEST := $(TEST_IMAGE_DIR)/hotspot/jtreg/native, \
FILES := $(BUILD_HOTSPOT_JTREG_LIBRARIES) $(BUILD_HOTSPOT_JTREG_EXECUTABLES), \
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: default all build-test-hotspot-jtreg-native test-image-hotspot-jtreg-native test-image

@ -1,5 +1,5 @@
#
# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1995, 2015, 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
@ -143,11 +143,24 @@ ifndef PRODUCT_HOME
endif
# Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
JAVA_OPTIONS =
JAVA_OPTIONS =
ifdef JAVA_ARGS
JAVA_OPTIONS = $(JAVA_ARGS)
endif
# jtreg -nativepath <dir>
#
# Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true
# should be JPRT_TESTNATIVE_PATH
ifdef TEST_IMAGE_DIR
TESTNATIVE_DIR = $(TEST_IMAGE_DIR)
else ifdef JPRT_TESTNATIVE_PATH
TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH)
endif
ifdef TESTNATIVE_DIR
JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/hotspot/jtreg/native")
endif
# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ifdef JPRT_ARCHIVE_BUNDLE
@ -303,6 +316,7 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
-r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
-w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
-jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
$(JTREG_NATIVE_PATH) \
$(JTREG_EXCLUSIONS) \
$(JTREG_TEST_OPTIONS) \
$(TEST_SELECTION) \
@ -313,7 +327,7 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
PHONY_LIST += jtreg_tests
# flags used to execute java in test targets
TEST_FLAGS += -version -Xinternalversion -X -help
TEST_FLAGS += -version -Xinternalversion -X -help
sanitytest: prep $(PRODUCT_HOME)
@for flag in $(TEST_FLAGS); \

@ -332,6 +332,9 @@ applicable_cmsgc = \
hotspot_wbapitest = \
sanity/
hotspot_native_sanity = \
native_sanity
hotspot_compiler_1 = \
compiler/arraycopy/ \
compiler/c1/ \

@ -0,0 +1,41 @@
/*
* Copyright (c) 2015, 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.
*
* 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.
*/
/*
* @test
* @run main/native JniVersion
*/
public class JniVersion {
public static final int JNI_VERSION_1_8 = 0x00010008;
public static void main(String... args) throws Exception {
System.loadLibrary("JniVersion");
int res = getJniVersion();
if (res < JNI_VERSION_1_8) {
throw new Exception("Unexpected value returned from getJniVersion(): 0x" + Integer.toHexString(res));
}
}
static native int getJniVersion();
}

@ -0,0 +1,29 @@
/*
* Copyright (c) 2015, 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.
*
* 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 <jni.h>
JNIEXPORT jint JNICALL
Java_JniVersion_getJniVersion(JNIEnv *env, jclass clz) {
return (*env)->GetVersion(env);
}