RFR 8u backport: 8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode

Stuart Monteith stuart.monteith at linaro.org
Fri Jun 16 14:31:59 UTC 2017


With the following patches, I get the following results (comparing
-othervm without the patches against -agentvm with the patches.

Comparing the results, before and after, I get:

0: JTwork-otherwithout  pass: 720; fail: 4; error: 2; not run: 5
1: JTwork-agentwithnew  pass: 721; fail: 4; error: 2; not run: 4

0      1      Test
---    pass   sanity/MismatchedWhiteBox/WhiteBox.java

1 differences


# HG changeset patch
# User iignatyev
# Date 1397746449 -14400
#      Thu Apr 17 18:54:09 2014 +0400
# Node ID 17b08aa75d401874f200fcb3347d485b65d32d3f
# Parent  68758c5ab0c1ef01e89bea8a9b799714831a177f
8039260: c.o.j.t.ProcessTools::createJavaProcessBuilder(boolean,
String... ) must also take TestJavaOptions
Reviewed-by: kvn, iignatyev
Contributed-by: lev.priima at oracle.com

diff -r 68758c5ab0c1 -r 17b08aa75d40
test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
--- a/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
Sun Jun 11 07:45:07 2017 -0700
+++ b/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
Thu Apr 17 18:54:09 2014 +0400
@@ -145,18 +145,15 @@
     return createJavaProcessBuilder(false, command);
   }

-  public static ProcessBuilder createJavaProcessBuilder(boolean
addTestVmOptions, String... command) throws Exception {
+  public static ProcessBuilder createJavaProcessBuilder(boolean
addTestVmAndJavaOptions, String... command) throws Exception {
     String javapath = JDKToolFinder.getJDKTool("java");

     ArrayList<String> args = new ArrayList<>();
     args.add(javapath);
     Collections.addAll(args, getPlatformSpecificVMArgs());

-    if (addTestVmOptions) {
-      String vmopts = System.getProperty("test.vm.opts");
-      if (vmopts != null && vmopts.length() > 0) {
-        Collections.addAll(args, vmopts.split("\\s"));
-      }
+    if (addTestVmAndJavaOptions) {
+      Collections.addAll(args, Utils.getTestJavaOpts());
     }

     Collections.addAll(args, command);


# HG changeset patch
# User ctornqvi
# Date 1429312336 25200
#      Fri Apr 17 16:12:16 2015 -0700
# Node ID 7be2e2cd1390df9e13b76925398d152c96585b47
# Parent  17b08aa75d401874f200fcb3347d485b65d32d3f
8077608: [TESTBUG] Enable Hotspot jtreg tests to run in agentvm mode
Reviewed-by: sla, gtriantafill

diff -r 17b08aa75d40 -r 7be2e2cd1390 test/Makefile
--- a/test/Makefile Thu Apr 17 18:54:09 2014 +0400
+++ b/test/Makefile Fri Apr 17 16:12:16 2015 -0700
@@ -262,6 +262,8 @@
 # Default JTREG to run
 JTREG = $(JT_HOME)/bin/jtreg

+# Use agent mode
+JTREG_BASIC_OPTIONS += -agentvm
 # Only run automatic tests
 JTREG_BASIC_OPTIONS += -a
 # Report details on all failed or error tests, times too
diff -r 17b08aa75d40 -r 7be2e2cd1390
test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
--- a/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
Thu Apr 17 18:54:09 2014 +0400
+++ b/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
Fri Apr 17 16:12:16 2015 -0700
@@ -26,7 +26,7 @@
  * @bug 8042235
  * @summary redefining method used by multiple MethodHandles crashes VM
  * @compile -XDignore.symbol.file
RedefineMethodUsedByMultipleMethodHandles.java
- * @run main RedefineMethodUsedByMultipleMethodHandles
+ * @run main/othervm RedefineMethodUsedByMultipleMethodHandles
  */

 import java.io.*;
diff -r 17b08aa75d40 -r 7be2e2cd1390
test/sanity/MismatchedWhiteBox/WhiteBox.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sanity/MismatchedWhiteBox/WhiteBox.java Fri Apr 17 16:12:16
2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, 2014, 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 WhiteBox
+ * @bug 8011675
+ * @summary verify that whitebox can be used even if not all
functions are declared in java-part
+ * @author igor.ignatyev at oracle.com
+ * @library /testlibrary
+ * @compile WhiteBox.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:.
-XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
+ */
+
+package sun.hotspot;
+
+public class WhiteBox {
+    private static native void registerNatives();
+    static { registerNatives(); }
+    public native int notExistedMethod();
+    public native int getHeapOopSize();
+    public static void main(String[] args) {
+        WhiteBox wb = new WhiteBox();
+        if (wb.getHeapOopSize() < 0) {
+            throw new Error("wb.getHeapOopSize() < 0");
+        }
+        boolean catched = false;
+        try {
+            wb.notExistedMethod();
+        } catch (UnsatisfiedLinkError e) {
+            catched = true;
+        }
+        if (!catched) {
+            throw new Error("wb.notExistedMethod() was invoked");
+        }
+    }
+}
diff -r 17b08aa75d40 -r 7be2e2cd1390 test/sanity/WhiteBox.java
--- a/test/sanity/WhiteBox.java Thu Apr 17 18:54:09 2014 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2013, 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 WhiteBox
- * @bug 8011675
- * @summary verify that whitebox can be used even if not all
functions are declared in java-part
- * @author igor.ignatyev at oracle.com
- * @library /testlibrary
- * @compile WhiteBox.java
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:.
-XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox
- * @clean sun.hotspot.WhiteBox
- */
-
-package sun.hotspot;
-
-public class WhiteBox {
-    private static native void registerNatives();
-    static { registerNatives(); }
-    public native int notExistedMethod();
-    public native int getHeapOopSize();
-    public static void main(String[] args) {
-        WhiteBox wb = new WhiteBox();
-        if (wb.getHeapOopSize() < 0) {
-            throw new Error("wb.getHeapOopSize() < 0");
-        }
-        boolean catched = false;
-        try {
-            wb.notExistedMethod();
-        } catch (UnsatisfiedLinkError e) {
-            catched = true;
-        }
-        if (!catched) {
-            throw new Error("wb.notExistedMethod() was invoked");
-        }
-    }
-}
diff -r 17b08aa75d40 -r 7be2e2cd1390
test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
--- a/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
Thu Apr 17 18:54:09 2014 +0400
+++ b/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
Fri Apr 17 16:12:16 2015 -0700
@@ -152,6 +152,9 @@
     args.add(javapath);
     Collections.addAll(args, getPlatformSpecificVMArgs());

+    args.add("-cp");
+    args.add(System.getProperty("java.class.path"));
+
     if (addTestVmAndJavaOptions) {
       Collections.addAll(args, Utils.getTestJavaOpts());
     }


On 2 June 2017 at 14:55, Stuart Monteith <stuart.monteith at linaro.org> wrote:
> Hi David,
>    Good point - runtime/os/AvailableProcessors.java does some custom
> execution that misses out the classpath. It is easy enough to fix, but
> there might be follow on patches to backport.
> compiler/rtm/locking/TestRTMLockingThreshold.java might also have some
> trouble.
>
> I'm investigating further.
>
>
> Thanks,
>   Stuart
>
> On 2 June 2017 at 10:30, David Holmes <david.holmes at oracle.com> wrote:
>> On 2/06/2017 7:17 PM, Stuart Monteith wrote:
>>>
>>> Hi David,
>>>     Yes, I was being a bit unclear. The patch includes a fix to allow
>>> the tests that fail under -agentvm to pass successfully. Under
>>> agentvm, tests that spawn their own processes don't inherit a working
>>> classpath, so the patch changes ProcessTools to pass this on. The
>>> results I presented before show how the failing tests will then pass
>>> with agentvm once the patch is applied.
>>
>>
>> Ah I see. Thanks I missed the significance of the ProcessTools change.
>>
>>>>> 1: JTwork-with  pass: 718; fail: 6; error: 2; not run: 5
>>
>> So out of those 8 non-passing tests are any of the failures specifically
>> related to using agentvm?
>>
>> Thanks,
>> David
>>
>>
>>> Thanks,
>>>      Stuart
>>>
>>>
>>> On 2 June 2017 at 02:36, David Holmes <david.holmes at oracle.com> wrote:
>>>>
>>>> Hi Stuart,
>>>>
>>>> On 1/06/2017 11:26 PM, Stuart Monteith wrote:
>>>>>
>>>>>
>>>>> Hello,
>>>>>      I tested this on x86 and aarch64. Muneer's bug is an accurate
>>>>> description of the failing tests. I'm not sure what you mean by
>>>>> "8180904 has to be fixed before this backport", as the backport is the
>>>>> fix for the issue Muneer presented. JDK9 doesn't exhibit these
>>>>> failures as it has the fix to be backported.
>>>>
>>>>
>>>>
>>>> As I understood it, 8180904 reports that a whole bunch of tests fail if
>>>> run
>>>> in agentvm mode. The current backport would enable agentvm mode and hence
>>>> all those tests would start to fail.
>>>>
>>>> Did I misunderstand something?
>>>>
>>>> Thanks,
>>>> David
>>>>
>>>>
>>>>
>>>>> Comparing the runs without and with the patch - this is on x86 - I get
>>>>> essentially the same on aarch64:
>>>>>
>>>>> 0: JTwork-without  pass: 680; fail: 44; error: 3; not run: 4
>>>>> 1: JTwork-with  pass: 718; fail: 6; error: 2; not run: 5
>>>>>
>>>>> 0      1      Test
>>>>> fail   pass   compiler/jsr292/PollutedTrapCounts.java
>>>>> fail   pass
>>>>> compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java#id0
>>>>> fail   pass   compiler/loopopts/UseCountedLoopSafepoints.java
>>>>> pass   fail   compiler/rtm/locking/TestRTMLockingThreshold.java#id0
>>>>> fail   pass   compiler/types/correctness/OffTest.java#id0
>>>>> fail   pass   gc/TestVerifySilently.java
>>>>> fail   pass   gc/TestVerifySubSet.java
>>>>> fail   pass   gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java
>>>>> fail   pass   gc/class_unloading/TestG1ClassUnloadingHWM.java
>>>>> fail   pass   gc/ergonomics/TestDynamicNumberOfGCThreads.java
>>>>> fail   pass   gc/g1/TestEagerReclaimHumongousRegions.java
>>>>> fail   pass   gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java
>>>>> fail   pass   gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java
>>>>> fail   pass   gc/g1/TestG1TraceEagerReclaimHumongousObjects.java
>>>>> fail   pass   gc/g1/TestGCLogMessages.java
>>>>> fail   pass   gc/g1/TestHumongousAllocInitialMark.java
>>>>> fail   pass   gc/g1/TestPrintGCDetails.java
>>>>> fail   pass   gc/g1/TestPrintRegionRememberedSetInfo.java
>>>>> fail   pass   gc/g1/TestShrinkAuxiliaryData00.java
>>>>> fail   pass   gc/g1/TestShrinkAuxiliaryData05.java
>>>>> fail   pass   gc/g1/TestShrinkAuxiliaryData10.java
>>>>> fail   pass   gc/g1/TestShrinkAuxiliaryData15.java
>>>>> fail   pass   gc/g1/TestShrinkAuxiliaryData20.java
>>>>> fail   pass   gc/g1/TestShrinkAuxiliaryData25.java
>>>>> fail   pass   gc/g1/TestShrinkDefragmentedHeap.java#id0
>>>>> fail   pass   gc/g1/TestStringDeduplicationAgeThreshold.java
>>>>> fail   pass   gc/g1/TestStringDeduplicationFullGC.java
>>>>> fail   pass   gc/g1/TestStringDeduplicationInterned.java
>>>>> fail   pass   gc/g1/TestStringDeduplicationPrintOptions.java
>>>>> fail   pass   gc/g1/TestStringDeduplicationTableRehash.java
>>>>> fail   pass   gc/g1/TestStringDeduplicationTableResize.java
>>>>> fail   pass   gc/g1/TestStringDeduplicationYoungGC.java
>>>>> fail   pass   gc/g1/TestStringSymbolTableStats.java
>>>>> fail   pass   gc/logging/TestGCId.java
>>>>> fail   pass   gc/whitebox/TestWBGC.java
>>>>> fail   pass   runtime/ErrorHandling/TestOnOutOfMemoryError.java#id0
>>>>> fail   pass   runtime/NMT/JcmdWithNMTDisabled.java
>>>>> fail   pass   runtime/memory/ReserveMemory.java
>>>>> pass   ---    sanity/WhiteBox.java
>>>>> fail   pass   serviceability/attach/AttachWithStalePidFile.java
>>>>> fail   pass   serviceability/jvmti/TestRedefineWithUnresolvedClass.java
>>>>> error  pass
>>>>> serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java#id0
>>>>>
>>>>>
>>>>> I find that compiler/rtm/locking/TestRTMLockingThreshold.java produces
>>>>> inconsistent results on my machine, regardless of whether or not the
>>>>> patch is applied.
>>>>>
>>>>> BR
>>>>>     Stuart
>>>>>
>>>>>
>>>>> On 1 June 2017 at 06:39, David Holmes <david.holmes at oracle.com> wrote:
>>>>>>
>>>>>>
>>>>>> Thanks for that information Muneer, that is an unpleasant surprise.
>>>>>>
>>>>>> Stuart: I think 8180904 has to be fixed before this backport can take
>>>>>> place.
>>>>>>
>>>>>> Thanks,
>>>>>> David
>>>>>> -----
>>>>>>
>>>>>>
>>>>>> On 1/06/2017 2:31 PM, Muneer Kolarkunnu wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hi David and Stuart,
>>>>>>>
>>>>>>> I recently reported one bug[1] for the same issue and listed which all
>>>>>>> test cases are failing with agentvm.
>>>>>>> I tested in Oracle.Linux.7.0 x64.
>>>>>>>
>>>>>>> [1] https://bugs.openjdk.java.net/browse/JDK-8180904
>>>>>>>
>>>>>>> Regards,
>>>>>>> Muneer
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: David Holmes
>>>>>>> Sent: Thursday, June 01, 2017 7:04 AM
>>>>>>> To: Stuart Monteith; hotspot-dev Source Developers
>>>>>>> Subject: Re: RFR 8u backport: 8077608: [TESTBUG] Enable Hotspot jtreg
>>>>>>> tests to run in agentvm mode
>>>>>>>
>>>>>>> Hi Stuart,
>>>>>>>
>>>>>>> This looks like an accurate backport of the change.
>>>>>>>
>>>>>>> My only minor concern is if there may be tests in 8u that are no
>>>>>>> longer
>>>>>>> in
>>>>>>> 9 which may not work with agentvm mode.
>>>>>>>
>>>>>>> What platforms have you tested this on?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> David
>>>>>>>
>>>>>>> On 31/05/2017 11:19 PM, Stuart Monteith wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>       Currently the jdk8u codebase fails some JTreg Hotspot tests
>>>>>>>> when
>>>>>>>> running in the -agentvm mode. This is because the ProcessTools class
>>>>>>>> is not passing the classpath. There are substantial time savings to
>>>>>>>> be
>>>>>>>> gained using -agentvm over -othervm.
>>>>>>>>
>>>>>>>> Fortunately, there was a fix for jdk9 (8077608) that has not been
>>>>>>>> backported to jdk8u.  The details are as follows:
>>>>>>>>
>>>>>>>>
>>>>>>>> http://mail.openjdk.java.net/pipermail/hotspot-dev/2015-April/017937.h
>>>>>>>> tml
>>>>>>>> https://bugs.openjdk.java.net/browse/JDK-8077608
>>>>>>>> http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/af2a1e9f08f3
>>>>>>>>
>>>>>>>> The patch just needed a slight change, to remove the change to the
>>>>>>>> file "test/compiler/uncommontrap/TestUnstableIfTrap.java" as that
>>>>>>>> test
>>>>>>>> doesn't exist on jdk8u.
>>>>>>>>
>>>>>>>> My colleague Ningsheng has kindly hosted the change here:
>>>>>>>>
>>>>>>>>         http://cr.openjdk.java.net/~njian/8077608/webrev.00
>>>>>>>>
>>>>>>>>
>>>>>>>> BR,
>>>>>>>>        Stuart
>>>>>>>>
>>>>>>
>>>>
>>


More information about the hotspot-dev mailing list