1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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>
This commit is contained in:
Simon Marchi 2014-12-23 11:33:29 -05:00 committed by Marc Khouzam
parent dd4ae589c2
commit 65e13b7344
2 changed files with 26 additions and 5 deletions

View file

@ -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();
}
}

View file

@ -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();
}
}