--- ./hotspot/test/compiler/5091921/Test7005594.sh Mon Nov 28 13:51:31 2016 -0800 +++ ./hotspot/test/compiler/5091921/Test7005594.sh Sat Jan 28 19:02:08 2017 -0800 @@ -60,6 +60,15 @@ # Windows/MKS MEM=`"$ROOTDIR/mksnt/sysinf" memory -v | grep "Total Physical Memory: " | sed 's/Total Physical Memory: *//g'` MEM="$(($machine_memory / 1024))" +elif [ -x "/sbin/sysctl" ]; then + # BSD + MEM=`(/sbin/sysctl -n hw.physmem64 2> /dev/null || /sbin/sysctl -n hw.physmem)` + if [ -z "$MEM" ]; then + echo "Unable to determine amount of physical memory on the machine" + MEM=0 + else + MEM="$(($MEM / 1024 / 1024))" + fi else echo "Unable to determine amount of physical memory on the machine" fi --- ./hotspot/test/compiler/6894807/Test6894807.sh Mon Nov 28 13:51:31 2016 -0800 +++ ./hotspot/test/compiler/6894807/Test6894807.sh Sat Jan 28 19:02:08 2017 -0800 @@ -21,7 +21,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin ) + SunOS | Linux | *BSD | Darwin ) NULL=/dev/null PS=":" FS="/" --- ./hotspot/test/runtime/7110720/Test7110720.sh Mon Nov 28 13:51:31 2016 -0800 +++ ./hotspot/test/runtime/7110720/Test7110720.sh Sat Jan 28 19:02:08 2017 -0800 @@ -28,7 +28,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin ) + SunOS | Linux | *BSD | Darwin ) FS="/" RM=/bin/rm CP=/bin/cp --- ./hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java Mon Nov 28 13:51:31 2016 -0800 +++ ./hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java Sat Jan 28 19:02:08 2017 -0800 @@ -37,8 +37,8 @@ public static void main(String args[]) throws Throwable { System.out.println("Regression test for bugs 7051189 and 8023393"); - if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) { - System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping"); + if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX() && !Platform.isBSD()) { + System.out.println("Test only applicable on Solaris, Linux, BSD, and Mac OSX, skipping"); return; } --- ./hotspot/test/test_env.sh Mon Nov 28 13:51:31 2016 -0800 +++ ./hotspot/test/test_env.sh Sat Jan 28 19:02:08 2017 -0800 @@ -53,7 +53,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - AIX | Darwin | Linux | SunOS ) + AIX | *BSD | Darwin | Linux | SunOS ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/com/sun/corba/5036554/TestCorbaBug.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/corba/5036554/TestCorbaBug.sh Sat Jan 28 19:08:22 2017 -0800 @@ -48,7 +48,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/com/sun/corba/cachedSocket/7056731.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/corba/cachedSocket/7056731.sh Sat Jan 28 19:08:22 2017 -0800 @@ -31,7 +31,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/com/sun/jdi/ImmutableResourceTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/jdi/ImmutableResourceTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -56,7 +56,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" ;; --- ./jdk/test/com/sun/jdi/JITDebug.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/jdi/JITDebug.sh Sat Jan 28 19:08:22 2017 -0800 @@ -63,7 +63,7 @@ OS=`uname -s` export TRANSPORT_METHOD case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" TRANSPORT_METHOD=dt_socket ;; --- ./jdk/test/com/sun/jdi/PrivateTransportTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/jdi/PrivateTransportTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -106,7 +106,7 @@ xx=`find ${jreloc}/lib -name libdt_socket.so` libloc=`dirname ${xx}` ;; - Darwin) + *BSD | Darwin) libloc=${jreloc}/lib ;; Windows*) --- ./jdk/test/com/sun/jdi/ShellScaffold.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/jdi/ShellScaffold.sh Sat Jan 28 19:08:22 2017 -0800 @@ -284,7 +284,7 @@ psCmd=ps jstack=jstack.exe ;; - SunOS | Linux | Darwin | AIX) + SunOS | Linux | *BSD | Darwin | AIX) transport=dt_socket address= devnull=/dev/null --- ./jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/com/sun/jdi/connect/spi/JdiLoadedByCustomLoader.sh Sat Jan 28 19:08:22 2017 -0800 @@ -45,7 +45,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" ;; Windows* | CYGWIN*) --- ./jdk/test/java/awt/JAWT/JAWT.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/awt/JAWT/JAWT.sh Sat Jan 28 19:08:22 2017 -0800 @@ -62,6 +62,23 @@ MAKE="make" LD_LIBRARY_PATH="." ;; + *BSD ) + NULL=/dev/null + PS=":" + FS="/" + ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL + if [ $? -eq '0' ] + then + ARCH="amd64" + else + ARCH="i386" + fi + SYST="bsd" + MAKEFILE="Makefile.unix" + CC="cc" + MAKE="make" + LD_LIBRARY_PATH="." + ;; SunOS ) NULL=/dev/null PS=":" @@ -111,7 +128,7 @@ MAKE="make" ;; Darwin ) - echo "Test passed. This test is not for MacOS." + echo "Test passed. This test is not for MacOS" exit 0; ;; * ) --- ./jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -86,6 +86,14 @@ TMP="/tmp" ;; + *BSD ) + VAR="A different value for BSD" + DEFAULT_JDK=/usr/local/openjdk8 + FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + Windows* ) VAR="A different value for Win32" DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" --- ./jdk/test/java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -59,7 +59,7 @@ # Checking for proper OS OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | CYGWIN* ) + SunOS | Linux | *BSD | Darwin | AIX ) FILESEP="/" ;; --- ./jdk/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -119,6 +119,14 @@ TMP="/tmp" ;; + *BSD ) + VAR="A different value for BSD" + DEFAULT_JDK=/usr/local/openjdk8 + FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + Windows* ) VAR="A different value for Win32" DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" --- ./jdk/test/java/io/File/GetXSpace.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/io/File/GetXSpace.java Sat Jan 28 19:08:22 2017 -0800 @@ -51,7 +51,7 @@ private static final String dfFormat; static { if (name.equals("SunOS") || name.equals("Linux") - || name.contains("OS X")) { + || name.endsWith("BSD") || name.contains("OS X")) { // FileSystem Total Used Available Use% MountedOn dfFormat = "([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s]+)"; } else if (name.startsWith("Windows")) { --- ./jdk/test/java/io/File/GetXSpace.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/io/File/GetXSpace.sh Sat Jan 28 19:08:22 2017 -0800 @@ -26,7 +26,7 @@ # set platform-dependent variable OS=`uname -s` case "$OS" in - SunOS | Linux ) TMP=/tmp ;; + SunOS | Linux | *BSD | Darwin ) TMP=/tmp ;; Windows_98 ) return ;; Windows* ) SID=`sid`; TMP="c:/temp" ;; * ) --- ./jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/io/Serializable/evolution/RenamePackage/run.sh Sat Jan 28 19:08:22 2017 -0800 @@ -45,7 +45,7 @@ # Need to determine the classpath separator and filepath separator based on the # operating system. case "$OS" in -SunOS | Linux | Darwin | AIX ) +SunOS | Linux | *BSD | Darwin | AIX ) PS=":" ;; Windows* | CYGWIN* ) PS=";" ;; --- ./jdk/test/java/io/Serializable/serialver/classpath/run.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/io/Serializable/serialver/classpath/run.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,7 +47,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" ;; Windows* | CYGWIN* ) PS=";" ;; --- ./jdk/test/java/io/Serializable/serialver/nested/run.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/io/Serializable/serialver/nested/run.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,7 +47,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" ;; Windows* | CYGWIN* ) PS=";" ;; --- ./jdk/test/java/lang/ClassLoader/Assert.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/ClassLoader/Assert.sh Sat Jan 28 19:08:22 2017 -0800 @@ -25,7 +25,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin ) + SunOS | Linux | Darwin | *BSD ) FS="/" CHMOD="${FS}bin${FS}chmod" ;; --- ./jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh Sat Jan 28 19:08:22 2017 -0800 @@ -55,7 +55,7 @@ Linux ) FS="/" ;; - Darwin ) + *BSD | Darwin ) FS="/" ;; AIX ) --- ./jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh Sat Jan 28 19:08:22 2017 -0800 @@ -60,7 +60,7 @@ Linux ) FS="/" ;; - Darwin ) + *BSD | Darwin ) FS="/" ;; AIX ) --- ./jdk/test/java/lang/ProcessBuilder/DestroyTest.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/ProcessBuilder/DestroyTest.java Sat Jan 28 19:08:22 2017 -0800 @@ -148,6 +148,9 @@ } else if (osName.startsWith("Linux") == true) { return new UnixTest( File.createTempFile("ProcessTrap-", ".sh",null)); + } else if (osName.endsWith("BSD")) { + return new UnixTest( + File.createTempFile("ProcessTrap-", ".sh",null)); } else if (osName.startsWith("Mac OS")) { return new MacTest( File.createTempFile("ProcessTrap-", ".sh",null)); --- ./jdk/test/java/lang/ProcessBuilder/Zombies.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/ProcessBuilder/Zombies.java Sat Jan 28 19:08:22 2017 -0800 @@ -34,7 +34,7 @@ static final String os = System.getProperty("os.name"); - static final String TrueCommand = os.contains("OS X")? + static final String TrueCommand = (os.endsWith("BSD") || os.contains("OS X")) ? "/usr/bin/true" : "/bin/true"; public static void main(String[] args) throws Throwable { --- ./jdk/test/java/lang/StringCoding/CheckEncodings.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/StringCoding/CheckEncodings.sh Sat Jan 28 19:08:22 2017 -0800 @@ -30,7 +30,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) ;; + SunOS | Linux | *BSD | Darwin | AIX ) ;; Windows* | CYGWIN* ) echo "Passed"; exit 0 ;; * ) echo "Unrecognized system!" ; exit 1 ;; --- ./jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/annotation/loaderLeak/LoaderLeak.sh Sat Jan 28 19:08:22 2017 -0800 @@ -48,7 +48,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/java/lang/instrument/MakeJAR2.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/instrument/MakeJAR2.sh Sat Jan 28 19:08:22 2017 -0800 @@ -55,7 +55,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux ) + SunOS | Linux | *BSD | Darwin ) PATHSEP=":" ;; --- ./jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/instrument/appendToClassLoaderSearch/CommonSetup.sh Sat Jan 28 19:08:22 2017 -0800 @@ -43,7 +43,7 @@ PS=":" FS="/" ;; - Darwin ) + *BSD | Darwin ) PS=":" FS="/" ;; --- ./jdk/test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java Sat Jan 28 19:08:22 2017 -0800 @@ -79,8 +79,10 @@ System.out.println("Test passed."); } + private static String osName = System.getProperty("os.name"); + private static String LOAD_AVERAGE_TEXT - = System.getProperty("os.name").contains("OS X") + = (osName.endsWith("BSD") || osName.contains("OS X")) ? "load averages:" : "load average:"; @@ -99,7 +101,7 @@ System.out.println("Load average returned from uptime = " + output); System.out.println("getSystemLoadAverage() returned " + loadavg); - String[] lavg = System.getProperty("os.name").contains("OS X") + String[] lavg = (osName.endsWith("BSD") || osName.contains("OS X")) ? output.split(" ") : output.split(","); double expected = Double.parseDouble(lavg[0]); --- ./jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh Sat Jan 28 19:08:22 2017 -0800 @@ -61,7 +61,7 @@ while true; do echo "Run $i: TestSystemLoadAvg" case `uname -s` in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) runOne GetSystemLoadAverage ;; * ) --- ./jdk/test/java/net/Authenticator/B4933582.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/Authenticator/B4933582.sh Sat Jan 28 19:08:22 2017 -0800 @@ -26,7 +26,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/net/DatagramSocket/Send12k.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/DatagramSocket/Send12k.java Sat Jan 28 19:08:22 2017 -0800 @@ -36,9 +36,10 @@ public static void main(String args[]) throws Exception { - int SEND_SIZE=0; + String osName = System.getProperty("os.name"); + int SEND_SIZE; - if(System.getProperty("os.name").contains("Mac")) { + if(osName.endsWith("BSD") || osName.contains("Mac")) { SEND_SIZE = 16 * 576; } else { SEND_SIZE = 16 * 1024; --- ./jdk/test/java/net/DatagramSocket/SendDatagramToBadAddress.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/DatagramSocket/SendDatagramToBadAddress.java Sat Jan 28 19:08:22 2017 -0800 @@ -45,6 +45,8 @@ return (true); if (p.getProperty ("os.name").equals ("Linux")) return (true); + if (p.getProperty ("os.name").endsWith ("BSD")) + return (true); if (p.getProperty ("os.name").startsWith ("Mac OS")) return (true); // Check for specific Solaris version from here --- ./jdk/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/DatagramSocket/SetDatagramSocketImplFactory/ADatagramSocket.sh Sat Jan 28 19:08:22 2017 -0800 @@ -27,11 +27,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Darwin | AIX ) - PATHSEP=":" - FILESEP="/" - ;; - Linux ) + SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/net/Socket/OldSocketImpl.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/Socket/OldSocketImpl.sh Sat Jan 28 19:08:22 2017 -0800 @@ -28,7 +28,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/net/URL/B5086147.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/URL/B5086147.sh Sat Jan 28 19:08:22 2017 -0800 @@ -26,7 +26,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) exit 0 ;; CYGWIN* ) --- ./jdk/test/java/net/URLClassLoader/B5077773.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/URLClassLoader/B5077773.sh Sat Jan 28 19:08:22 2017 -0800 @@ -34,11 +34,7 @@ OS=`uname -s` case "$OS" in - SunOS | Darwin | AIX ) - PS=":" - FS="/" - ;; - Linux ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/net/URLClassLoader/sealing/checksealed.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/URLClassLoader/sealing/checksealed.sh Sat Jan 28 19:08:22 2017 -0800 @@ -27,11 +27,7 @@ OS=`uname -s` case "$OS" in - SunOS | Darwin | AIX ) - PS=":" - FS="/" - ;; - Linux ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/net/URLConnection/6212146/test.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/net/URLConnection/6212146/test.sh Sat Jan 28 19:08:22 2017 -0800 @@ -33,11 +33,7 @@ OS=`uname -s` case "$OS" in - SunOS | Darwin | AIX ) - PS=":" - FS="/" - ;; - Linux ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/nio/channels/FileChannel/Transfer.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/nio/channels/FileChannel/Transfer.java Sat Jan 28 19:08:22 2017 -0800 @@ -228,7 +228,7 @@ // Windows and Linux can't handle the really large file sizes for a // truncate or a positional write required by the test for 4563125 String osName = System.getProperty("os.name"); - if (!(osName.startsWith("SunOS") || osName.contains("OS X"))) + if (!(osName.startsWith("SunOS") || osName.endsWith("BSD") || osName.contains("OS X"))) return; File source = File.createTempFile("blah", null); source.deleteOnExit(); --- ./jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.c Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/Launcher.c Sat Jan 28 19:08:22 2017 -0800 @@ -17,6 +17,12 @@ #include "Launcher.h" +#ifdef _ALLBSD_SOURCE +#define FD_DIR "/dev/fd" +#else +#define FD_DIR "/proc/self/fd" +#endif + /* * Throws the exception of the given class name and detail message */ @@ -135,7 +141,7 @@ } close(thisFd); - if ((dp = opendir("/proc/self/fd")) == NULL) { + if ((dp = opendir(FD_DIR)) == NULL) { _exit(-1); } --- ./jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/nio/charset/coders/CheckSJISMappingProp.sh Sat Jan 28 19:08:22 2017 -0800 @@ -34,7 +34,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) ;; + SunOS | Linux | *BSD | Darwin | AIX ) ;; # Skip locale test for Windows Windows* | CYGWIN* ) echo "Passed"; exit 0 ;; --- ./jdk/test/java/nio/charset/spi/basic.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/nio/charset/spi/basic.sh Sat Jan 28 19:08:22 2017 -0800 @@ -48,7 +48,7 @@ DIR=`pwd` case `uname` in - SunOS | Linux | Darwin | AIX ) CPS=':' ;; + SunOS | Linux | *BSD | Darwin | AIX ) CPS=':' ;; Windows* ) CPS=';' ;; CYGWIN* ) DIR=`/usr/bin/cygpath -a -s -m $DIR` --- ./jdk/test/java/nio/file/FileSystem/Basic.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/nio/file/FileSystem/Basic.java Sat Jan 28 19:08:22 2017 -0800 @@ -76,7 +76,7 @@ checkSupported(fs, "posix", "unix", "owner", "acl", "user"); if (os.equals("Linux")) checkSupported(fs, "posix", "unix", "owner", "dos", "user"); - if (os.contains("OS X")) + if (os.endsWith("BSD") || os.contains("OS X")) checkSupported(fs, "posix", "unix", "owner"); if (os.equals("Windows")) checkSupported(fs, "owner", "dos", "acl", "user"); --- ./jdk/test/java/nio/file/Files/CopyAndMove.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/nio/file/Files/CopyAndMove.java Sat Jan 28 19:08:22 2017 -0800 @@ -651,7 +651,7 @@ // check POSIX attributes are copied String os = System.getProperty("os.name"); - if ((os.equals("SunOS") || os.equals("Linux")) && + if ((os.equals("SunOS") || os.equals("Linux") || os.endsWith("BSD")) && testPosixAttributes) { checkPosixAttributes( @@ -1155,7 +1155,7 @@ static void randomizeAttributes(Path file) throws IOException { String os = System.getProperty("os.name"); boolean isWindows = os.startsWith("Windows"); - boolean isUnix = os.equals("SunOS") || os.equals("Linux"); + boolean isUnix = os.equals("SunOS") || os.equals("Linux") || os.endsWith("BSD"); boolean isDirectory = isDirectory(file, NOFOLLOW_LINKS); if (isUnix) { --- ./jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ext.sh Sat Jan 28 19:08:22 2017 -0800 @@ -33,7 +33,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" ;; Windows* | CYGWIN* ) --- ./jdk/test/java/rmi/registry/readTest/readTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/rmi/registry/readTest/readTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -34,7 +34,7 @@ REGARGS="" case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" CHMOD="${FS}bin${FS}chmod" --- ./jdk/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh Sat Jan 28 19:08:22 2017 -0800 @@ -58,7 +58,7 @@ PATHSEP=":" FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock.sh Sat Jan 28 19:08:22 2017 -0800 @@ -42,7 +42,7 @@ PATHSEP=":" FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Sat Jan 28 19:08:22 2017 -0800 @@ -66,7 +66,7 @@ PATHSEP=";" FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/security/Security/signedfirst/Dyn.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/security/Security/signedfirst/Dyn.sh Sat Jan 28 19:08:22 2017 -0800 @@ -58,7 +58,7 @@ PATHSEP=":" FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/security/Security/signedfirst/Static.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/security/Security/signedfirst/Static.sh Sat Jan 28 19:08:22 2017 -0800 @@ -58,7 +58,7 @@ PATHSEP=":" FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/util/Currency/PropertiesTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/util/Currency/PropertiesTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -52,7 +52,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/util/PluggableLocale/ExecTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/util/PluggableLocale/ExecTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -62,7 +62,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/java/util/ResourceBundle/Bug6299235Test.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/util/ResourceBundle/Bug6299235Test.sh Sat Jan 28 19:08:22 2017 -0800 @@ -31,7 +31,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/java/util/ServiceLoader/basic.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/util/ServiceLoader/basic.sh Sat Jan 28 19:08:22 2017 -0800 @@ -43,9 +43,7 @@ OS=`uname -s` case "$OS" in - SunOS | Darwin | AIX ) - SEP=':' ;; - Linux ) + SunOS | Linux | *BSD | Darwin | AIX ) SEP=':' ;; * ) SEP='\;' ;; --- ./jdk/test/java/util/prefs/CheckUserPrefsStorage.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/java/util/prefs/CheckUserPrefsStorage.sh Sat Jan 28 19:08:22 2017 -0800 @@ -31,7 +31,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/javax/crypto/SecretKeyFactory/FailOverTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/javax/crypto/SecretKeyFactory/FailOverTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -56,7 +56,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -89,7 +89,7 @@ FILESEP="/" ;; - Linux | Darwin | AIX ) + Linux | *BSD | Darwin | AIX ) VAR="A different value for Linux" DEFAULT_JDK=/none #DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 --- ./jdk/test/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatThreadTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/javax/imageio/metadata/IIOMetadataFormat/runMetadataFormatThreadTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -90,7 +90,7 @@ FILESEP="/" ;; - Linux | Darwin | AIX ) + Linux | *BSD | Darwin | AIX ) VAR="A different value for Linux" DEFAULT_JDK=/none #DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386 --- ./jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/javax/imageio/stream/StreamCloserLeak/run_test.sh Sat Jan 28 19:08:22 2017 -0800 @@ -108,6 +108,14 @@ TMP="/tmp" ;; + *BSD ) + VAR="A different value for BSD" + DEFAULT_JDK=/usr/local/openjdk8 + FILESEP="/" + PATHSEP=":" + TMP="/tmp" + ;; + Windows* ) VAR="A different value for Win32" DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0" --- ./jdk/test/javax/script/CommonSetup.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/javax/script/CommonSetup.sh Sat Jan 28 19:08:22 2017 -0800 @@ -36,7 +36,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/javax/security/auth/Subject/doAs/Test.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/javax/security/auth/Subject/doAs/Test.sh Sat Jan 28 19:08:22 2017 -0800 @@ -43,7 +43,7 @@ FS="/" RM="/bin/rm -f" ;; - Darwin ) + *BSD | Darwin ) PS=":" FS="/" RM="/bin/rm -f" --- ./jdk/test/lib/security/java.policy/Ext_AllPolicy.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/lib/security/java.policy/Ext_AllPolicy.sh Sat Jan 28 19:08:22 2017 -0800 @@ -53,7 +53,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Sat Jan 28 19:08:22 2017 -0800 @@ -53,8 +53,13 @@ return isOs("linux"); } + public static boolean isBSD() { + return isOs("bsd"); + } + private static boolean isOs(String osname) { - return osName.toLowerCase().startsWith(osname.toLowerCase()); + return (osName.toLowerCase().startsWith(osname.toLowerCase()) || + osName.toLowerCase().endsWith(osname.toLowerCase())); } public static String getOsName() { --- ./jdk/test/sun/awt/dnd/8024061/bug8024061.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/awt/dnd/8024061/bug8024061.java Sat Jan 28 19:08:22 2017 -0800 @@ -107,8 +107,8 @@ public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException { OSType type = OSInfo.getOSType(); - if (type != OSType.LINUX && type != OSType.SOLARIS) { - System.out.println("This test is for Linux and Solaris only... " + + if (type != OSType.LINUX && type != OSType.SOLARIS && type != OSType.BSD) { + System.out.println("This test is for BSD, Linux and Solaris only... " + "skipping!"); return; } --- ./jdk/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/management/jmxremote/bootstrap/GeneratePropertyPassword.sh Sat Jan 28 19:08:22 2017 -0800 @@ -42,7 +42,7 @@ fi case $OS in -SunOS | Linux | Darwin | AIX ) +SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" FILESEP="/" DFILESEP=$FILESEP --- ./jdk/test/sun/net/ftp/MarkResetTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/net/ftp/MarkResetTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -28,7 +28,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/net/www/http/HttpClient/RetryPost.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/net/www/http/HttpClient/RetryPost.sh Sat Jan 28 19:08:22 2017 -0800 @@ -28,7 +28,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/net/www/protocol/jar/B5105410.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/net/www/protocol/jar/B5105410.sh Sat Jan 28 19:08:22 2017 -0800 @@ -31,7 +31,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/net/www/protocol/jar/jarbug/run.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/net/www/protocol/jar/jarbug/run.sh Sat Jan 28 19:08:22 2017 -0800 @@ -31,7 +31,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" CHMOD="${FS}bin${FS}chmod" --- ./jdk/test/sun/nio/ch/SelProvider.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/nio/ch/SelProvider.java Sat Jan 28 19:08:22 2017 -0800 @@ -39,7 +39,7 @@ expected = "sun.nio.ch.DevPollSelectorProvider"; } else if ("Linux".equals(osname)) { expected = "sun.nio.ch.EPollSelectorProvider"; - } else if (osname.contains("OS X")) { + } else if (osname.endsWith("BSD") || osname.contains("OS X")) { expected = "sun.nio.ch.KQueueSelectorProvider"; } else { return; --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ ./jdk/test/sun/reflect/ReflectionFactory/ReflectionFactoryTest.java Sat Jan 28 19:08:22 2017 -0800 @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2016, 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. + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectInputStream; +import java.io.ObjectOutput; +import java.io.ObjectOutputStream; +import java.io.OptionalDataException; +import java.io.Serializable; +import java.lang.invoke.MethodHandle; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +import sun.reflect.ReflectionFactory; + +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.testng.annotations.DataProvider; +import org.testng.TestNG; + +/* + * @test + * @bug 8137058 8164908 8168980 + * @run testng ReflectionFactoryTest + * @run testng/othervm/policy=security.policy ReflectionFactoryTest + * @summary Basic test for the unsupported ReflectionFactory + */ + +public class ReflectionFactoryTest { + + // Initialized by init() + static ReflectionFactory factory; + + @DataProvider(name = "ClassConstructors") + static Object[][] classConstructors() { + return new Object[][] { + {Object.class}, + {Foo.class}, + {Bar.class}, + }; + } + + @BeforeClass + static void init() { + factory = ReflectionFactory.getReflectionFactory(); + } + + /** + * Test that the correct Constructor is selected and run. + * @param type type of object to create + * @throws NoSuchMethodException - error + * @throws InstantiationException - error + * @throws IllegalAccessException - error + * @throws InvocationTargetException - error + */ + @Test(dataProvider="ClassConstructors") + static void testConstructor(Class type) + throws NoSuchMethodException, InstantiationException, + IllegalAccessException, InvocationTargetException + { + @SuppressWarnings("unchecked") + Constructor c = factory.newConstructorForSerialization(type); + + Object o = c.newInstance(); + Assert.assertEquals(o.getClass(), type, "Instance is wrong type"); + if (o instanceof Foo) { + Foo foo = (Foo)o; + foo.check(); + } + } + + @DataProvider(name = "NonSerialConstructors") + static Object[][] constructors() throws NoSuchMethodException { + return new Object[][] { + {Foo.class, Object.class.getDeclaredConstructor()}, + {Foo.class, Foo.class.getDeclaredConstructor()}, + {Baz.class, Object.class.getDeclaredConstructor()}, + {Baz.class, Foo.class.getDeclaredConstructor()}, + {Baz.class, Baz.class.getDeclaredConstructor()} + }; + } + + /** + * Tests that the given Constructor, in the hierarchy, is run. + */ + @Test(dataProvider="NonSerialConstructors") + static void testNonSerializableConstructor(Class cl, + Constructor constructorToCall) + throws ReflectiveOperationException + { + @SuppressWarnings("unchecked") + Constructor c = factory.newConstructorForSerialization(cl, + constructorToCall); + + Object o = c.newInstance(); + Assert.assertEquals(o.getClass(), cl, "Instance is wrong type"); + + int expectedFoo = 0; + int expectedBaz = 0; + if (constructorToCall.getName().equals("ReflectionFactoryTest$Foo")) { + expectedFoo = 1; + } else if (constructorToCall.getName().equals("ReflectionFactoryTest$Baz")) { + expectedFoo = 1; + expectedBaz = 4; + } + + Assert.assertEquals(((Foo)o).foo(), expectedFoo); + if (o instanceof Baz) { + Assert.assertEquals(((Baz)o).baz(), expectedBaz); + } + } + + static class Foo { + private int foo; + public Foo() { + this.foo = 1; + } + + public String toString() { + return "foo: " + foo; + } + + public void check() { + int expectedFoo = 1; + Assert.assertEquals(foo, expectedFoo, "foo() constructor not run"); + } + + public int foo() { return foo; } + } + + static class Bar extends Foo implements Serializable { + private static final long serialVersionUID = 3L; + + private int bar; + public Bar() { + this.bar = 1; + } + + public String toString() { + return super.toString() + ", bar: " + bar; + } + + public void check() { + super.check(); + int expectedBar = 0; + Assert.assertEquals(bar, expectedBar, "bar() constructor not run"); + } + } + + static class Baz extends Foo { + private static final long serialVersionUID = 4L; + + private final int baz; + public Baz() { this.baz = 4; } + public int baz() { return baz; } + } + + /** + * Test newConstructorForExternalization returns the constructor and it can be called. + * @throws NoSuchMethodException - error + * @throws InstantiationException - error + * @throws IllegalAccessException - error + * @throws InvocationTargetException - error + */ + @Test + static void newConstructorForExternalization() + throws NoSuchMethodException, InstantiationException, + IllegalAccessException, InvocationTargetException { + Constructor cons = factory.newConstructorForExternalization(Ext.class); + Ext ext = (Ext)cons.newInstance(); + Assert.assertEquals(ext.ext, 1, "Constructor not run"); + } + + static class Ext implements Externalizable { + private static final long serialVersionUID = 1L; + + int ext; + + public Ext() { + ext = 1; + } + + @Override + public void writeExternal(ObjectOutput out) throws IOException {} + + @Override + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {} + } + + @Test + static void testReadWriteObjectForSerialization() throws Throwable { + MethodHandle readObjectMethod = factory.readObjectForSerialization(Ser.class); + Assert.assertNotNull(readObjectMethod, "readObjectMethod not found"); + + MethodHandle readObjectNoDataMethod = factory.readObjectNoDataForSerialization(Ser.class); + Assert.assertNotNull(readObjectNoDataMethod, "readObjectNoDataMethod not found"); + + MethodHandle writeObjectMethod = factory.writeObjectForSerialization(Ser.class); + Assert.assertNotNull(writeObjectMethod, "writeObjectMethod not found"); + + MethodHandle readResolveMethod = factory.readResolveForSerialization(Ser.class); + Assert.assertNotNull(readResolveMethod, "readResolveMethod not found"); + + MethodHandle writeReplaceMethod = factory.writeReplaceForSerialization(Ser.class); + Assert.assertNotNull(writeReplaceMethod, "writeReplaceMethod not found"); + + byte[] data = null; + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos)) { + Ser ser = new Ser(); + + writeReplaceMethod.invoke(ser); + Assert.assertTrue(ser.writeReplaceCalled, "writeReplace not called"); + Assert.assertFalse(ser.writeObjectCalled, "writeObject should not have been called"); + + writeObjectMethod.invoke(ser, oos); + Assert.assertTrue(ser.writeReplaceCalled, "writeReplace should have been called"); + Assert.assertTrue(ser.writeObjectCalled, "writeObject not called"); + oos.flush(); + data = baos.toByteArray(); + } + + try (ByteArrayInputStream bais = new ByteArrayInputStream(data); + ObjectInputStream ois = new ObjectInputStream(bais)) { + Ser ser2 = new Ser(); + + readObjectMethod.invoke(ser2, ois); + Assert.assertTrue(ser2.readObjectCalled, "readObject not called"); + Assert.assertFalse(ser2.readObjectNoDataCalled, "readObjectNoData should not be called"); + Assert.assertFalse(ser2.readResolveCalled, "readResolve should not be called"); + + readObjectNoDataMethod.invoke(ser2, ois); + Assert.assertTrue(ser2.readObjectCalled, "readObject should have been called"); + Assert.assertTrue(ser2.readObjectNoDataCalled, "readObjectNoData not called"); + Assert.assertFalse(ser2.readResolveCalled, "readResolve should not be called"); + + readResolveMethod.invoke(ser2); + Assert.assertTrue(ser2.readObjectCalled, "readObject should have been called"); + Assert.assertTrue(ser2.readObjectNoDataCalled, "readObjectNoData not called"); + Assert.assertTrue(ser2.readResolveCalled, "readResolve not called"); + } + } + + @Test + static void hasStaticInitializer() { + boolean actual = factory.hasStaticInitializerForSerialization(Ser.class); + Assert.assertTrue(actual, "hasStaticInitializerForSerialization is wrong"); + } + + static class Ser implements Serializable { + private static final long serialVersionUID = 2L; + static { + // Define a static class initialization method + } + + boolean readObjectCalled = false; + boolean readObjectNoDataCalled = false; + boolean writeObjectCalled = false; + boolean readResolveCalled = false; + boolean writeReplaceCalled = false; + + public Ser() {} + + private void readObject(ObjectInputStream ois) throws IOException { + Assert.assertFalse(writeObjectCalled, "readObject called too many times"); + readObjectCalled = ois.readBoolean(); + } + + private void readObjectNoData(ObjectInputStream ois) throws IOException { + Assert.assertFalse(readObjectNoDataCalled, "readObjectNoData called too many times"); + readObjectNoDataCalled = true; + } + + private void writeObject(ObjectOutputStream oos) throws IOException { + Assert.assertFalse(writeObjectCalled, "writeObject called too many times"); + writeObjectCalled = true; + oos.writeBoolean(writeObjectCalled); + } + + private Object writeReplace() { + Assert.assertFalse(writeReplaceCalled, "writeReplace called too many times"); + writeReplaceCalled = true; + return this; + } + + private Object readResolve() { + Assert.assertFalse(readResolveCalled, "readResolve called too many times"); + readResolveCalled = true; + return this; + } + } + + /** + * Test the constructor of OptionalDataExceptions. + */ + @Test + static void newOptionalDataException() { + OptionalDataException ode = factory.newOptionalDataExceptionForSerialization(true); + Assert.assertTrue(ode.eof, "eof wrong"); + ode = factory.newOptionalDataExceptionForSerialization(false); + Assert.assertFalse(ode.eof, "eof wrong"); + + } + + + + // Main can be used to run the tests from the command line with only testng.jar. + @SuppressWarnings("raw_types") + @Test(enabled = false) + public static void main(String[] args) { + Class[] testclass = {ReflectionFactoryTest.class}; + TestNG testng = new TestNG(); + testng.setTestClasses(testclass); + testng.run(); + } +} --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ ./jdk/test/sun/reflect/ReflectionFactory/security.policy Sat Jan 28 19:08:22 2017 -0800 @@ -0,0 +1,11 @@ +// Individual Permissions for ReflectionFactoryTest +grant { + // Permissions needed to run the test + permission java.util.PropertyPermission "*", "read"; + permission java.io.FilePermission "<>", "read,write,delete,execute"; + + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.reflect"; + permission java.lang.RuntimePermission "reflectionFactoryAccess"; +}; --- ./jdk/test/sun/security/krb5/runNameEquals.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/krb5/runNameEquals.sh Sat Jan 28 19:08:22 2017 -0800 @@ -52,7 +52,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin ) + SunOS | Linux | *BSD | Darwin ) PATHSEP=":" FILESEP="/" NATIVE=true --- ./jdk/test/sun/security/mscapi/ShortRSAKey1024.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/mscapi/ShortRSAKey1024.sh Sat Jan 28 19:08:22 2017 -0800 @@ -50,7 +50,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | CYGWIN* ) + SunOS | Linux | *BSD | Darwin | CYGWIN* ) FS="/" ;; Windows_* ) --- ./jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/pkcs11/Provider/ConfigQuotedString.sh Sat Jan 28 19:08:22 2017 -0800 @@ -66,7 +66,7 @@ CP="${FS}bin${FS}cp" CHMOD="${FS}bin${FS}chmod" ;; - Darwin ) + *BSD | Darwin ) FS="/" PS=":" CP="${FS}bin${FS}cp" --- ./jdk/test/sun/security/pkcs11/Provider/Login.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/pkcs11/Provider/Login.sh Sat Jan 28 19:08:22 2017 -0800 @@ -67,7 +67,7 @@ CP="${FS}bin${FS}cp" CHMOD="${FS}bin${FS}chmod" ;; - Darwin ) + *BSD | Darwin ) FS="/" PS=":" CP="${FS}bin${FS}cp" --- ./jdk/test/sun/security/provider/KeyStore/DKSTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/provider/KeyStore/DKSTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -50,7 +50,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.sh Sat Jan 28 19:08:22 2017 -0800 @@ -52,7 +52,7 @@ PATHSEP=":" FILESEP="/" ;; - Linux ) + Linux | *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh Sat Jan 28 19:08:22 2017 -0800 @@ -59,7 +59,7 @@ PS=":" FS="/" ;; - Darwin ) + *BSD | Darwin ) PS=":" FS="/" ;; --- ./jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/EngineArgs/DebugReportsOneExtraByte.sh Sat Jan 28 19:08:22 2017 -0800 @@ -33,7 +33,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) FILESEP="/" PATHSEP=":" ;; --- ./jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh Sat Jan 28 19:08:22 2017 -0800 @@ -32,7 +32,7 @@ HOSTNAME=`uname -n` OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh Sat Jan 28 19:08:22 2017 -0800 @@ -32,7 +32,7 @@ HOSTNAME=`uname -n` OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PS=":" FS="/" ;; --- ./jdk/test/sun/security/tools/jarsigner/AlgOptions.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/jarsigner/AlgOptions.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/jarsigner/PercentSign.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/jarsigner/PercentSign.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/jarsigner/diffend.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/jarsigner/diffend.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,6 +47,13 @@ FS="/" CP="${FS}bin${FS}cp -f" ;; + *BSD ) + NULL=/dev/null + PS=":" + FS="/" + PATH="${PATH}${PS}${FS}usr${FS}local${FS}bin" + CP="${FS}bin${FS}cp -f" + ;; CYGWIN* ) NULL=/dev/null PS=";" --- ./jdk/test/sun/security/tools/jarsigner/emptymanifest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/jarsigner/emptymanifest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -39,6 +39,11 @@ Windows_* ) FS="\\" ;; + *BSD ) + PS=":" + FS="/" + PATH="${PATH}${PS}${FS}usr${FS}local${FS}bin" + ;; * ) FS="/" ;; --- ./jdk/test/sun/security/tools/jarsigner/oldsig.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/jarsigner/oldsig.sh Sat Jan 28 19:08:22 2017 -0800 @@ -42,7 +42,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/keytool/AltProviderPath.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/AltProviderPath.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/keytool/CloneKeyAskPassword.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/CloneKeyAskPassword.sh Sat Jan 28 19:08:22 2017 -0800 @@ -55,7 +55,7 @@ PATHSEP=":" FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/sun/security/tools/keytool/NoExtNPE.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/NoExtNPE.sh Sat Jan 28 19:08:22 2017 -0800 @@ -48,7 +48,7 @@ Linux ) FILESEP="/" ;; - Darwin ) + *BSD | Darwin ) FILESEP="/" ;; AIX ) --- ./jdk/test/sun/security/tools/keytool/SecretKeyKS.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/SecretKeyKS.sh Sat Jan 28 19:08:22 2017 -0800 @@ -45,7 +45,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/keytool/StandardAlgName.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/StandardAlgName.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/StorePasswordsByShell.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX) + SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" FILESEP="/" ;; --- ./jdk/test/sun/security/tools/keytool/i18n.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/i18n.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux ) + SunOS | Linux | *BSD ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/keytool/printssl.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/printssl.sh Sat Jan 28 19:08:22 2017 -0800 @@ -40,7 +40,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) FS="/" ;; CYGWIN* ) --- ./jdk/test/sun/security/tools/keytool/resource.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/resource.sh Sat Jan 28 19:08:22 2017 -0800 @@ -43,7 +43,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null FS="/" ;; --- ./jdk/test/sun/security/tools/keytool/standard.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/keytool/standard.sh Sat Jan 28 19:08:22 2017 -0800 @@ -45,7 +45,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX | CYGWIN* ) + SunOS | Linux | *BSD | Darwin | AIX ) FS="/" ;; Windows_* ) --- ./jdk/test/sun/security/tools/policytool/Alias.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/Alias.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,7 +47,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/policytool/ChangeUI.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/ChangeUI.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/policytool/OpenPolicy.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/OpenPolicy.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/policytool/SaveAs.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/SaveAs.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,7 +47,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/policytool/UpdatePermissions.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/UpdatePermissions.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,7 +47,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/policytool/UsePolicy.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/UsePolicy.sh Sat Jan 28 19:08:22 2017 -0800 @@ -46,7 +46,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/security/tools/policytool/i18n.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/security/tools/policytool/i18n.sh Sat Jan 28 19:08:22 2017 -0800 @@ -49,7 +49,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) NULL=/dev/null PS=":" FS="/" --- ./jdk/test/sun/tools/common/CommonSetup.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/tools/common/CommonSetup.sh Sat Jan 28 19:08:22 2017 -0800 @@ -47,6 +47,7 @@ # isLinux - true if OS is Linux # isSolaris - true if OS is Solaris # isWindows - true if OS is Windows +# isBSD - true if OS is BSD # isMacos - true if OS is Macos X # isAIX - true if OS is AIX @@ -83,6 +84,7 @@ isSolaris=false isUnknownOS=false isWindows=false +isBSD=false isMacos=false isAIX=false @@ -107,6 +109,10 @@ OS="Linux" isLinux=true ;; + *BSD ) + OS="BSD" + isBSD=true + ;; Darwin ) OS="Mac OS X" isMacos=true --- ./jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/tools/jconsole/ResourceCheckTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -54,7 +54,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX) + SunOS | Linux | *BSD | Darwin | AIX) PATHSEP=":" ;; --- ./jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh Sat Jan 28 19:08:22 2017 -0800 @@ -56,7 +56,7 @@ OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | AIX ) + SunOS | Linux | *BSD | Darwin | AIX ) PATHSEP=":" ;; --- ./jdk/test/tools/launcher/ExecutionEnvironment.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/tools/launcher/ExecutionEnvironment.java Sat Jan 28 19:08:22 2017 -0800 @@ -194,7 +194,7 @@ Map env = new HashMap<>(); - if (TestHelper.isLinux || TestHelper.isMacOSX || TestHelper.isAIX) { + if (TestHelper.isLinux || TestHelper.isBSD || TestHelper.isMacOSX || TestHelper.isAIX) { for (String x : LD_PATH_STRINGS) { String pairs[] = x.split("="); env.put(pairs[0], pairs[1]); --- ./jdk/test/tools/launcher/RunpathTest.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/tools/launcher/RunpathTest.java Sat Jan 28 19:08:22 2017 -0800 @@ -69,7 +69,7 @@ } public static void main(String... args) throws Exception { - if (isSolaris || isLinux) { + if (isSolaris || isLinux || isBSD) { RunpathTest rp = new RunpathTest(); rp.testRpath(); } --- ./jdk/test/tools/launcher/Test7029048.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/tools/launcher/Test7029048.java Sat Jan 28 19:08:22 2017 -0800 @@ -223,7 +223,7 @@ } else if (isSolaris && passes < 9) { throw new Exception("Test7029048: FAIL: " + "all tests did not run, expected " + 9 + " got " + passes); - } else if (isLinux && passes < 6) { + } else if ((isLinux || isBSD) && passes < 6) { throw new Exception("Test7029048: FAIL: " + "all tests did not run, expected " + 6 + " got " + passes); } else { --- ./jdk/test/tools/launcher/TestHelper.java Wed Nov 30 13:46:05 2016 +0300 +++ ./jdk/test/tools/launcher/TestHelper.java Sat Jan 28 19:08:22 2017 -0800 @@ -94,6 +94,8 @@ System.getProperty("os.name", "unknown").startsWith("Linux"); static final boolean isAIX = System.getProperty("os.name", "unknown").startsWith("AIX"); + static final boolean isBSD = + System.getProperty("os.name", "unknown").endsWith("BSD"); static final String LIBJVM = isWindows ? "jvm.dll" : "libjvm" + (isMacOSX ? ".dylib" : ".so"); --- ./langtools/test/Makefile Mon Nov 28 13:53:32 2016 -0800 +++ ./langtools/test/Makefile Sat Jan 28 19:02:01 2017 -0800 @@ -34,6 +34,14 @@ ARCH=i586 endif endif +ifneq ($(findstring BSD, $(OSNAME)), ) + PLATFORM = bsd + JT_PLATFORM = linux + ARCH = $(shell uname -p) + ifeq ($(ARCH), i386) + ARCH=i586 + endif +endif ifeq ($(OSNAME), Darwin) PLATFORM = bsd ARCH = $(shell uname -m) --- ./langtools/test/tools/javah/ReadOldClass.sh Mon Nov 28 13:53:32 2016 -0800 +++ ./langtools/test/tools/javah/ReadOldClass.sh Sat Jan 28 19:02:01 2017 -0800 @@ -43,7 +43,7 @@ # set platform-dependent variables OS=`uname -s` case "$OS" in - SunOS | Linux | Darwin | CYGWIN* ) + SunOS | Linux | *BSD | Darwin | CYGWIN* ) PS=":" FS="/" ;; --- ./nashorn/test/script/jfx.js Mon Nov 28 13:53:48 2016 -0800 +++ ./nashorn/test/script/jfx.js Sat Jan 28 19:02:03 2017 -0800 @@ -93,6 +93,8 @@ f2 = new File(sb.append(fsep + "linux.png").toString()); } else if (OSInfo.getOSType() == OSType.MACOSX) { f2 = new File(sb.append(fsep + "macosx.png").toString()); + } else if (OSInfo.getOSType() == OSType.BSD) { + f2 = new File(sb.append(fsep + "bsd.png").toString()); } if (f1.exists() && f2.exists()) { var image1 = new AWTImage(PNGDecoder.decode(f1.getAbsolutePath()));