changeset 52103:4acfd9b6c2f9

8211931: [ppc][testbug] runtime/jni/terminatedThread/TestTerminatedThread.java fails as threads don't terminate immediately Reviewed-by: dholmes, mdoerr
author goetz
date Fri, 12 Oct 2018 08:33:18 +0200
parents 19f6b12df31a
children 331fbd2db6b5
files test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java	Fri Oct 12 10:35:24 2018 +0800
+++ b/test/hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java	Fri Oct 12 08:33:18 2018 +0200
@@ -85,10 +85,14 @@
             System.out.println("Calling getThreadCpuTime ...");
             long t1 = mbean.getThreadCpuTime(t.getId());
             if (t1 != -1) {
-                throw new RuntimeException("Invalid ThreadCpuTime returned = " +
-                                           t1 + " expected = -1");
+                // At least on PPC, we know threads can still be around a short
+                // instant. In some stress scenarios we seem to grab times of
+                // new threads started with the same thread id. In these cases
+                // we get here.
+                System.out.println("Unexpected: thread still reports CPU time: " + t1);
+            } else {
+                System.out.println("Okay: getThreadCpuTime() reported -1 as expected");
             }
-            System.out.println("Okay: getThreadCpuTime() reported -1 as expected");
         } else {
             System.out.println("Skipping Thread CPU time test as it's not supported");
         }
@@ -96,10 +100,14 @@
         System.out.println("Calling getThreadUserTime ...");
         long t1 = mbean.getThreadUserTime(t.getId());
         if (t1 != -1) {
-            throw new RuntimeException("Invalid ThreadUserTime returned = " +
-                                       t1 + " expected = -1");
+            // At least on PPC, we know threads can still be around a short
+            // instant. In some stress scenarios we seem to grab times of
+            // new threads started with the same thread id. In these cases
+            // we get here.
+            System.out.println("Unexpected: thread still reports User time: " + t1);
+        } else {
+            System.out.println("Okay: getThreadUserTime() reported -1 as expected");
         }
-        System.out.println("Okay: getThreadUserTime() reported -1 as expected");
 
         System.out.println("Calling getThreadInfo ...");
         ThreadInfo info = mbean.getThreadInfo(t.getId());