Mon, 11 Mar 2019 15:50:26 +0000
8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
8180904: Hotspot tests running with -agentvm failing due to classpath
Summary: Add -cp System.getProperty("java.class.path") to ProcessBuilder arguments.
Reviewed-by: sla, gtriantafill
1.1 --- a/test/Makefile Tue Oct 02 13:48:08 2018 +0200 1.2 +++ b/test/Makefile Mon Mar 11 15:50:26 2019 +0000 1.3 @@ -262,6 +262,8 @@ 1.4 # Default JTREG to run 1.5 JTREG = $(JT_HOME)/bin/jtreg 1.6 1.7 +# Use agent mode 1.8 +JTREG_BASIC_OPTIONS += -agentvm 1.9 # Only run automatic tests 1.10 JTREG_BASIC_OPTIONS += -a 1.11 # Report details on all failed or error tests, times too
2.1 --- a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java Tue Oct 02 13:48:08 2018 +0200 2.2 +++ b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java Mon Mar 11 15:50:26 2019 +0000 2.3 @@ -26,7 +26,7 @@ 2.4 * @bug 8042235 2.5 * @summary redefining method used by multiple MethodHandles crashes VM 2.6 * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java 2.7 - * @run main RedefineMethodUsedByMultipleMethodHandles 2.8 + * @run main/othervm RedefineMethodUsedByMultipleMethodHandles 2.9 */ 2.10 2.11 import java.io.*;
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/sanity/MismatchedWhiteBox/WhiteBox.java Mon Mar 11 15:50:26 2019 +0000 3.3 @@ -0,0 +1,58 @@ 3.4 +/* 3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/* 3.28 + * @test WhiteBox 3.29 + * @bug 8011675 3.30 + * @summary verify that whitebox can be used even if not all functions are declared in java-part 3.31 + * @author igor.ignatyev@oracle.com 3.32 + * @library /testlibrary 3.33 + * @compile WhiteBox.java 3.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox 3.35 + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox 3.36 + * @clean sun.hotspot.WhiteBox 3.37 + */ 3.38 + 3.39 +package sun.hotspot; 3.40 + 3.41 +public class WhiteBox { 3.42 + private static native void registerNatives(); 3.43 + static { registerNatives(); } 3.44 + public native int notExistedMethod(); 3.45 + public native int getHeapOopSize(); 3.46 + public static void main(String[] args) { 3.47 + WhiteBox wb = new WhiteBox(); 3.48 + if (wb.getHeapOopSize() < 0) { 3.49 + throw new Error("wb.getHeapOopSize() < 0"); 3.50 + } 3.51 + boolean catched = false; 3.52 + try { 3.53 + wb.notExistedMethod(); 3.54 + } catch (UnsatisfiedLinkError e) { 3.55 + catched = true; 3.56 + } 3.57 + if (!catched) { 3.58 + throw new Error("wb.notExistedMethod() was invoked"); 3.59 + } 3.60 + } 3.61 +}
4.1 --- a/test/sanity/WhiteBox.java Tue Oct 02 13:48:08 2018 +0200 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,58 +0,0 @@ 4.4 -/* 4.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 4.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 - * 4.8 - * This code is free software; you can redistribute it and/or modify it 4.9 - * under the terms of the GNU General Public License version 2 only, as 4.10 - * published by the Free Software Foundation. 4.11 - * 4.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 - * version 2 for more details (a copy is included in the LICENSE file that 4.16 - * accompanied this code). 4.17 - * 4.18 - * You should have received a copy of the GNU General Public License version 4.19 - * 2 along with this work; if not, write to the Free Software Foundation, 4.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 - * 4.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 - * or visit www.oracle.com if you need additional information or have any 4.24 - * questions. 4.25 - */ 4.26 - 4.27 -/* 4.28 - * @test WhiteBox 4.29 - * @bug 8011675 4.30 - * @summary verify that whitebox can be used even if not all functions are declared in java-part 4.31 - * @author igor.ignatyev@oracle.com 4.32 - * @library /testlibrary 4.33 - * @compile WhiteBox.java 4.34 - * @run main ClassFileInstaller sun.hotspot.WhiteBox 4.35 - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox 4.36 - * @clean sun.hotspot.WhiteBox 4.37 - */ 4.38 - 4.39 -package sun.hotspot; 4.40 - 4.41 -public class WhiteBox { 4.42 - private static native void registerNatives(); 4.43 - static { registerNatives(); } 4.44 - public native int notExistedMethod(); 4.45 - public native int getHeapOopSize(); 4.46 - public static void main(String[] args) { 4.47 - WhiteBox wb = new WhiteBox(); 4.48 - if (wb.getHeapOopSize() < 0) { 4.49 - throw new Error("wb.getHeapOopSize() < 0"); 4.50 - } 4.51 - boolean catched = false; 4.52 - try { 4.53 - wb.notExistedMethod(); 4.54 - } catch (UnsatisfiedLinkError e) { 4.55 - catched = true; 4.56 - } 4.57 - if (!catched) { 4.58 - throw new Error("wb.notExistedMethod() was invoked"); 4.59 - } 4.60 - } 4.61 -}
5.1 --- a/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Tue Oct 02 13:48:08 2018 +0200 5.2 +++ b/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Mon Mar 11 15:50:26 2019 +0000 5.3 @@ -152,6 +152,9 @@ 5.4 args.add(javapath); 5.5 Collections.addAll(args, getPlatformSpecificVMArgs()); 5.6 5.7 + args.add("-cp"); 5.8 + args.add(System.getProperty("java.class.path")); 5.9 + 5.10 if (addTestVmOptions) { 5.11 String vmopts = System.getProperty("test.vm.opts"); 5.12 if (vmopts != null && vmopts.length() > 0) {