提交 01fc8452 编写于 作者: B bpb

8198834: (ch) Enable...

8198834: (ch) Enable java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java on linux-x64
Summary: Move to using centralized native build and remove obsolete .so files
Reviewed-by: alanb, erikj
上级 cdd9bc91
#
# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, 2018, 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
......@@ -50,6 +50,7 @@ BUILD_JDK_JTREG_NATIVE_SRC += \
ifneq ($(OPENJDK_TARGET_OS), windows)
BUILD_JDK_JTREG_NATIVE_SRC += $(TOPDIR)/test/jdk/java/nio/channels/FileChannel/directio
BUILD_JDK_JTREG_NATIVE_SRC += $(TOPDIR)/test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel
endif
BUILD_JDK_JTREG_OUTPUT_DIR := $(OUTPUTDIR)/support/test/jdk/jtreg/native
......@@ -59,9 +60,14 @@ BUILD_JDK_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/jdk/jtreg
ifeq ($(OPENJDK_TARGET_OS), windows)
WIN_LIB_JAVA := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := $(WIN_LIB_JAVA)
else ifeq ($(OPENJDK_TARGET_OS), linux)
BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava
BUILD_JDK_JTREG_LIBRARIES_LIBS_libDirectIO := -ljava
BUILD_JDK_JTREG_LIBRARIES_LIBS_libInheritedChannel := -ljava
else ifeq ($(OPENJDK_TARGET_OS), solaris)
BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava -lc
BUILD_JDK_JTREG_LIBRARIES_LIBS_libDirectIO := -ljava -lc
BUILD_JDK_JTREG_LIBRARIES_LIBS_libInheritedChannel := -ljava -lc
else
BUILD_JDK_JTREG_LIBRARIES_LIBS_libstringPlatformChars := -ljava
BUILD_JDK_JTREG_LIBRARIES_LIBS_libDirectIO := -ljava
......
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2018 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
......@@ -34,7 +34,7 @@
* jdk.test.lib.Platform
* jdk.test.lib.process.*
* StateTest StateTestService EchoTest EchoService CloseTest Launcher Util
* @run testng/othervm InheritedChannelTest
* @run testng/othervm/native InheritedChannelTest
* @key intermittent
*/
......@@ -68,9 +68,7 @@ public class InheritedChannelTest {
private static final String OS_ARCH = ARCH.equals("i386") ? "i586" : ARCH;
private static final Path LD_LIBRARY_PATH
= Paths.get(TEST_SRC, "lib", OS_NAME + "-" + OS_ARCH);
private static final Path LAUNCHERLIB = LD_LIBRARY_PATH.resolve("libLauncher.so");
= Paths.get(System.getProperty("java.library.path"));
@DataProvider
public Object[][] testCases() {
......@@ -99,11 +97,6 @@ public class InheritedChannelTest {
@Test(dataProvider = "testCases")
public void test(String desc, List<String> opts) throws Throwable {
if (!Files.exists(LAUNCHERLIB)) {
System.out.println("Cannot find " + LAUNCHERLIB
+ " - library not available for this system");
return;
}
System.out.println("LD_LIBRARY_PATH=" + LD_LIBRARY_PATH);
List<String> args = new ArrayList<>();
......
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2018, 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
......@@ -35,7 +35,7 @@ import java.nio.channels.SocketChannel;
public class Launcher {
static {
System.loadLibrary("Launcher");
System.loadLibrary("InheritedChannel");
}
private static native void launch0(String cmdarray[], int fd) throws IOException;
......
#
#
# Makefile for building libLauncher.so
#
# To build libLauncher.so requires :-
# JAVA_HOME environment variable
# cc (Solaris) or gcc (Linux) on PATH
#
# The library is created in a architecture specific directory :-
#
# lib/solaris-sparc/libLauncher.so (Solaris/SPARC)
# lib/solaris-i586/libLauncher.so (Solaris/x86)
# lib/linux-i586/libLauncher.so (Linux/x86)
ECHO = echo
MKDIR = mkdir
UNAME = uname
uname := $(shell uname)
ifeq ($(uname), SunOS)
PLATFORM = solaris
ISAINFO = isainfo
ARCH_DATA_MODEL=64
ARCH := $(shell $(ISAINFO) -n)
CC = cc
LD = ld
CFLAGS = -D_REENTRANT -D__solaris__
LDFLAGS_COMMON = -G
EXTRA_LIBS = -lc
CC += -m64 -Kpic
endif
ifeq ($(uname), Linux)
PLATFORM = linux
archExpr = case "`$(UNAME) -m`" in \
i[3-6]86) \
$(ECHO) i586 \
;; \
sparc*) \
$(ECHO) sparc \
;; \
*) \
$(UNAME) -m \
;; \
esac
ARCH := $(shell $(archExpr) )
CC = gcc
CFLAGS = -fno-strict-aliasing -fPIC -W -Wall
LD = ld
LDFLAGS_COMMON = -shared
EXTRA_LIBS = -lc
endif
LIBDIR=lib/$(PLATFORM)-$(ARCH)
LAUNCHERLIB=$(LIBDIR)/libLauncher.so
all: java_home $(LAUNCHERLIB)
$(LAUNCHERLIB) : $(LIBDIR) $(LIBDIR)/Launcher.o
$(LD) $(LDFLAGS_COMMON) -o $(LAUNCHERLIB) $(LIBDIR)/Launcher.o $(EXTRA_LIBS)
$(LIBDIR):
@$(MKDIR) -p $(LIBDIR)
$(LIBDIR)/Launcher.o : Launcher.c \
Launcher.h
$(CC) -c $(CFLAGS) -o $(LIBDIR)/Launcher.o \
-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/$(PLATFORM) Launcher.c
Launcher.class Launcher.h : Launcher.java
$(JAVA_HOME)/bin/javac -h . Launcher.java
java_home:
ifndef JAVA_HOME
@$(ECHO) "ERROR: Your JAVA_HOME environment variable is not set."
exit 1
endif
The unit tests in this directory depend on a native launcher library
(libLauncher.so). This native library is built off-line and the
resulting libLauncher.so for each processor/OS combination is checked
into the workspace. The reason for this is because the test environment
may not have the required compilers/build environment.
In order to rebuild libLauncher.so the following is required :-
1. Check-out each of the shared libraries (sccs edit)
2. Edit Launcher.c with the appropriate changes
3. Execute the make script (gnumake all) on each processor/OS so
that the appropriate lib/<platform>/libLauncher.so is built.
4. Test the changes
5. Check-in each of the shared library (sccs delget)
(libInheritedChannel.so). This library is built by executing
$ make test-image-jdk-jtreg-native
For step 4 (re-building libLauncher.so) the following environment is required:
in the root directory of the OpenJDK clone. It will generate
libInheritedChannel.so in two locations:
(a) JAVA_HOME needs to be set to J2SE directory, eg:-
export JAVA_HOME=/usr/local/java/jdk1.5/solaris-sparc
$ $JDK_ROOT/build/$PLATFORM/support/test/jdk/jtreg/native/lib/libInheritedChannel.so
$ $JDK_ROOT/build/$PLATFORM/images/test/jdk/jtreg/native/libInheritedChannel.so
(b) For Solaris the SOS8 'cc' needs to be on the PATH, check using:
# cc -V
cc: Sun C 5.5 2003/03/12
The test may then be run using jtreg for example as follows:
(c) Execute the make script :-
Solaris: gnumake all
Linux: gmake all
$ jtreg -s -w:/tmp -r:/tmp -va -dir:$JDK_ROOT/test/jdk \
-nativepath:$JDK_ROOT/build/$PLATFORM/support/test/jdk/jtreg/native/lib \
java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java
/*
* Copyright (c) 2003, 2018, 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.
*/
/*
* A simple launcher to launch a program as if it was launched by inetd.
*/
#include <stdio.h>
......@@ -15,8 +36,6 @@
#include "jni.h"
#include "Launcher.h"
/*
* Throws the exception of the given class name and detail message
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册