8222667: vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002/TestDescription.java failed with "event IS NOT a breakpoint"
authordtitov
Mon, 06 May 2019 09:58:14 -0700
changeset 54719 4f2fd02922b1
parent 54718 ca251ef47e0b
child 54720 c48f141e7c5b
8222667: vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002/TestDescription.java failed with "event IS NOT a breakpoint" Reviewed-by: gadams, sspitsyn, jcbeyler, cjplummer
test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002.java
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002.java	Mon May 06 08:54:19 2019 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadStartRequest/addThreadFilter/addthreadfilter002.java	Mon May 06 09:58:14 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -479,12 +479,25 @@
                  throws JDITestRuntimeException {
 
         log2("breakpointForCommunication");
-        getEventSet();
-
-        if (eventIterator.nextEvent() instanceof BreakpointEvent)
-            return;
-
-        throw new JDITestRuntimeException("** event IS NOT a breakpoint **");
+        while (true) {
+            getEventSet();
+            while (eventIterator.hasNext()) {
+                Event event = eventIterator.nextEvent();
+                if (event instanceof BreakpointEvent) {
+                    return;
+                } else if (event instanceof ThreadStartEvent) {
+                    // It might be the case that while the thread start request was enabled
+                    // some threads not related to the test ( e.g. JVMCI threads) were started
+                    // and generated thread start events. We ignore these thread start events
+                    // and keep waiting for a breakpoint event.
+                    ThreadStartEvent tse = (ThreadStartEvent) event;
+                    log2("ThreadStartEvent is received while waiting for a breakpoint" +
+                            " event, thread: : " + tse.thread().name());
+                    continue;
+                }
+                throw new JDITestRuntimeException("** event IS NOT a breakpoint or a thread start **");
+            }
+        }
     }
 
 }