From 48de9319c6640f40362fea4d60de0fefc96a10a2 Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Sun, 4 Apr 2021 16:53:52 -0400 Subject: [PATCH] Bug 518689: Be lenient in cases where gdb provides extra info In some targets (such as the build machines @ Eclipse) gdb is returning thread names for remote debugging. No longer fail tests in this case as long as the provided name is empty or correct. Change-Id: I5f59f279a9d477e2c1ccb32098bbe1dad08cf334 --- .../cdt/tests/dsf/gdb/tests/GDBProcessesTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java index 796ec0f1f78..775d43a004e 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java @@ -146,8 +146,16 @@ public class GDBProcessesTest extends BaseParametrizedTestCase { for (int i = 1; i <= 6; i++) { IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); - String expectedName = threadNamesSupported() ? names[i - 1] : ""; - assertEquals("Thread name of thread " + i, expectedName, name); + if (threadNamesSupported()) { + assertEquals("Thread name of thread " + i, names[i - 1], name); + } else { + // Sometimes GDBserver does provide this info - it seems unreliable. So + // we allow an empty name, but if not empty when !threadNamesSupported + // we require it to be the correct name. See Bug 518689 + if (!"".equals(name)) { + assertEquals("Thread name of thread " + i, names[i - 1], name); + } + } } } }