Update Test924 to filter for messages related to test thread am: 1989aa4b39
Original change: https://android-review.googlesource.com/c/platform/art/+/2257701
Change-Id: I3ed6ed400f4be25848af2df71b8c01b2fa919d29
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/test/924-threads/src/art/Test924.java b/test/924-threads/src/art/Test924.java
index e97c9c6..3555720 100644
--- a/test/924-threads/src/art/Test924.java
+++ b/test/924-threads/src/art/Test924.java
@@ -337,6 +337,19 @@
}
}
+ private static List<String> filterForThread(Object[] thread_messages, String thread_name) {
+ List<String> messageListForThread = new ArrayList<String>();
+
+ for (int i = 0; i < thread_messages.length; i++) {
+ String message = (String)thread_messages[i];
+ if (message.startsWith("Thread(" + thread_name + ")")) {
+ messageListForThread.add(message);
+ }
+ }
+
+ return messageListForThread;
+ }
+
private static void doTestEvents() throws Exception {
enableThreadEvents(true);
@@ -354,21 +367,24 @@
}
}
};
- Thread t = new Thread(r, "EventTestThread");
+ String thread_name = "EventTestThread";
+ Thread t = new Thread(r, thread_name);
System.out.println("Constructed thread");
Thread.yield();
Thread.sleep(100);
- System.out.println(Arrays.toString(getThreadEventMessages()));
+
+ // Check that there are no events related to EventTestThread that we just created.
+ System.out.println(filterForThread(getThreadEventMessages(), thread_name).toString());
t.start();
cdl1.await();
- System.out.println(Arrays.toString(getThreadEventMessages()));
+ System.out.println(filterForThread(getThreadEventMessages(), thread_name).toString());
cdl2.countDown();
t.join();
- System.out.println(Arrays.toString(getThreadEventMessages()));
+ System.out.println(filterForThread(getThreadEventMessages(), thread_name).toString());
System.out.println("Thread joined");