Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marchi2014-12-23 16:33:29 +0000
committerMarc Khouzam2014-12-23 19:45:20 +0000
commit65e13b73449f43f0dd80848eca67f731a18e8c92 (patch)
tree1785e8c7d943d990493c03f20e0ba79020cb89ab
parentdd4ae589c25dd31bf4b2d447becc280b5f645de4 (diff)
downloadorg.eclipse.cdt-65e13b73449f43f0dd80848eca67f731a18e8c92.tar.gz
org.eclipse.cdt-65e13b73449f43f0dd80848eca67f731a18e8c92.tar.xz
org.eclipse.cdt-65e13b73449f43f0dd80848eca67f731a18e8c92.zip
debug tests: Adapt thread name test for platforms that don't support them
gdb only started reporting thread names at version 7.3. On Windows, they are never reported. If somebody wants to enhance the check for MAC OS X, feel free to do it! Change-Id: I9d028b24930b632678941682da65cd51da9e88dd Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca> Reviewed-on: https://git.eclipse.org/r/38728 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/GDBProcessesTest.java20
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java11
2 files changed, 26 insertions, 5 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 58772e108f..22eca349e6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Ericsson and others.
+ * Copyright (c) 2009, 2014 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Ericsson AB - Initial implementation of Test cases
+ * Simon Marchi (Ericsson) - Check for thread name support.
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests;
@@ -135,7 +136,16 @@ public class GDBProcessesTest extends BaseTestCase {
Assert.assertTrue("Process data should be executable name " + EXEC_NAME + "but we got " + processData.getName(),
processData.getName().contains(EXEC_NAME));
}
-
+
+ /*
+ * Return whether thread names are reported by the debugger.
+ *
+ * This defaults to false, and is overridden for specific versions of gdb.
+ */
+ protected boolean threadNamesSupported() {
+ return false;
+ }
+
/*
* getThreadData() for multiple threads
*/
@@ -175,9 +185,11 @@ public class GDBProcessesTest extends BaseTestCase {
Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); //$NON-NLS-1$
Matcher matcher = pattern.matcher(threadData.getId());
assertTrue("Thread ID is a series of number", matcher.find());
+
// Check thread name
- assertEquals("main thread's name is the name of the executable", EXEC_NAME, threadData.getName());
-
+ String expectedThreadName = threadNamesSupported() ? EXEC_NAME : "";
+ assertEquals("main thread's name is wrong", expectedThreadName, threadData.getName());
+
fWait.waitReset();
}
}
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java
index e05cfe101d..2135125cc5 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_3/GDBProcessesTest_7_3.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Ericsson and others.
+ * Copyright (c) 2011, 2014 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Ericsson AB - Initial implementation of Test cases
+ * Simon Marchi (Ericsson) - Check for thread name support.
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3;
@@ -21,4 +22,12 @@ public class GDBProcessesTest_7_3 extends GDBProcessesTest_7_2 {
protected void setGdbVersion() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_3);
}
+
+ /*
+ * Thread names are reported starting with gdb 7.3, except on Windows.
+ */
+ @Override
+ protected boolean threadNamesSupported() {
+ return !runningOnWindows();
+ }
} \ No newline at end of file

Back to the top