changeset 26687:eb6c5d0d1d6b

8055145: [TESTBUG] runtime/7158988/FieldMonitor.java fails with VMDisconnectedException Summary: Exclude this test on JPRT and make it trivially pass if it gets a disconnected exception (which seems rare) Reviewed-by: gtriantafill, sspitsyn, ctornqvi
author coleenp
date Thu, 11 Sep 2014 10:46:32 -0400
parents d7bc560b0ee9
children bb0cdd873e51
files hotspot/test/TEST.groups hotspot/test/runtime/7158988/FieldMonitor.java
diffstat 2 files changed, 35 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/test/TEST.groups	Thu Sep 11 03:13:29 2014 -0700
+++ b/hotspot/test/TEST.groups	Thu Sep 11 10:46:32 2014 -0400
@@ -342,7 +342,8 @@
  -runtime/Unsafe/RangeCheck.java \
  -runtime/SharedArchiveFile/CdsSameObjectAlignment.java \
  -runtime/SharedArchiveFile/DefaultUseWithClient.java \
- -runtime/Thread/CancellableThreadTest.java
+ -runtime/Thread/CancellableThreadTest.java \
+ -runtime/runtime/7158988/FieldMonitor.java
 
 hotspot_runtime_closed = \
   sanity/ExecuteInternalVMTests.java
--- a/hotspot/test/runtime/7158988/FieldMonitor.java	Thu Sep 11 03:13:29 2014 -0700
+++ b/hotspot/test/runtime/7158988/FieldMonitor.java	Thu Sep 11 10:46:32 2014 -0400
@@ -26,7 +26,6 @@
  * @bug 7158988
  * @key regression
  * @summary verify jvm does not crash while debugging
- * @ignore 8055145
  * @run compile TestPostFieldModification.java
  * @run main/othervm FieldMonitor
  * @author axel.siebenborn@sap.com
@@ -91,35 +90,41 @@
     boolean connected = true;
     int watched = 0;
     while (connected) {
-      EventSet eventSet = eventQueue.remove();
-      for (Event event : eventSet) {
-        System.out.println("FieldMonitor-main receives: "+event);
-        if (event instanceof VMStartEvent) {
-          addClassWatch(vm);
-        } else if (event instanceof VMDeathEvent
-            || event instanceof VMDisconnectEvent) {
-          // exit
-          connected = false;
-        } else if (event instanceof ClassPrepareEvent) {
-          // watch field on loaded class
-          System.out.println("ClassPrepareEvent");
-          ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event;
-          ReferenceType refType = classPrepEvent
-              .referenceType();
-          addFieldWatch(vm, refType);
-        } else if (event instanceof ModificationWatchpointEvent) {
-          watched++;
-          System.out.println("sleep for 500 ms");
-          Thread.sleep(500);
+        try {
+            EventSet eventSet = eventQueue.remove();
+            for (Event event : eventSet) {
+              System.out.println("FieldMonitor-main receives: "+event);
+              if (event instanceof VMStartEvent) {
+                addClassWatch(vm);
+              } else if (event instanceof VMDeathEvent
+                  || event instanceof VMDisconnectEvent) {
+                // exit
+                connected = false;
+              } else if (event instanceof ClassPrepareEvent) {
+                // watch field on loaded class
+                System.out.println("ClassPrepareEvent");
+                ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event;
+                ReferenceType refType = classPrepEvent
+                    .referenceType();
+                addFieldWatch(vm, refType);
+              } else if (event instanceof ModificationWatchpointEvent) {
+                watched++;
+                System.out.println("sleep for 500 ms");
+                Thread.sleep(500);
 
-          ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event;
-          System.out.println("old="
-              + modEvent.valueCurrent());
-          System.out.println("new=" + modEvent.valueToBe());
+                ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event;
+                System.out.println("old="
+                    + modEvent.valueCurrent());
+                System.out.println("new=" + modEvent.valueToBe());
+              }
+            }
+            System.out.println("resume...");
+            eventSet.resume();
+        } catch (com.sun.jdi.VMDisconnectedException exc) {
+            // Guess this means it's not connected anymore,
+            // sometimes this happens and everything else hangs, just return.
+            return;
         }
-      }
-      System.out.println("resume...");
-      eventSet.resume();
     }
     // Shutdown begins when event thread terminates
     try {