8208251: serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCCMSTest.java fails intermittently on Linux-X64
authorjcbeyler
Thu, 26 Jul 2018 11:53:59 -0700
changeset 51254 448cd909c9e2
parent 51253 35ca229c7f6f
child 51255 65fc31d1042b
8208251: serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCCMSTest.java fails intermittently on Linux-X64 Summary: Lower the interval rate and check GC objects too Reviewed-by: dcubed, sspitsyn Contributed-by: jcbeyler@google.com
test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCTest.java
--- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCTest.java	Thu Jul 26 11:31:15 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorGCTest.java	Thu Jul 26 11:53:59 2018 -0700
@@ -43,13 +43,17 @@
       throw new RuntimeException("Statistics should be null to begin with.");
     }
 
+    // Put sampling rate to 100k to ensure samples are collected.
+    HeapMonitor.setSamplingInterval(100 * 1024);
+
     HeapMonitor.enableSamplingEvents();
 
     List<Frame> frameList = HeapMonitor.allocate();
-    frameList.add(new Frame("main", "([Ljava/lang/String;)V", "HeapMonitorGCTest.java", 48));
+    frameList.add(new Frame("main", "([Ljava/lang/String;)V", "HeapMonitorGCTest.java", 51));
     Frame[] frames = frameList.toArray(new Frame[0]);
 
-    if (!HeapMonitor.obtainedEvents(frames)) {
+    if (!HeapMonitor.obtainedEvents(frames)
+        && !HeapMonitor.garbageContains(frames)) {
       throw new RuntimeException("No expected events were found.");
     }