1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Redirect all output from DSF-GDB's JUnit tests to gdb traces.

Change-Id: I6f7c85879fbc51d15fe77dc265c9b3d1b50ec19d
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2014-07-30 08:30:27 -04:00
parent 59d01f3ecd
commit 2698a9ca99

View file

@ -230,10 +230,12 @@ public class BaseTestCase {
protected void doLaunch() throws Exception { protected void doLaunch() throws Exception {
boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); boolean remote = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE).equals(IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE);
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n"); if (GdbDebugOptions.DEBUG) {
System.out.println(String.format("%s \"%s\" launching %s %s", GdbDebugOptions.trace("===============================================================================================\n");
GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : "")); GdbDebugOptions.trace(String.format("%s \"%s\" launching %s %s\n",
if(GdbDebugOptions.DEBUG) GdbDebugOptions.trace("===============================================================================================\n"); GdbPlugin.getDebugTime(), testName.getMethodName(), launchAttributes.get(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME), remote ? "with gdbserver" : ""));
GdbDebugOptions.trace("===============================================================================================\n");
}
boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE) boolean postMortemLaunch = launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE)
.equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE); .equals(ICDTLaunchConfigurationConstants.DEBUGGER_MODE_CORE);
@ -317,7 +319,7 @@ public class BaseTestCase {
private void launchGdbServer() { private void launchGdbServer() {
// First check if we should not launch gdbserver even for a remote session // First check if we should not launch gdbserver even for a remote session
if (launchAttributes.get(ITestConstants.LAUNCH_GDB_SERVER).equals(false)) { if (launchAttributes.get(ITestConstants.LAUNCH_GDB_SERVER).equals(false)) {
System.out.println("Forcing to not start gdbserver for this test"); if (GdbDebugOptions.DEBUG) GdbDebugOptions.trace("Forcing to not start gdbserver for this test\n");
return; return;
} }
@ -329,7 +331,7 @@ public class BaseTestCase {
String program = (String)launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME); String program = (String)launchAttributes.get(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME);
String commandLine = server + " :" + port + " " + program; String commandLine = server + " :" + port + " " + program;
try { try {
System.out.println("Staring gdbserver with command: " + commandLine); if (GdbDebugOptions.DEBUG) GdbDebugOptions.trace("Staring gdbserver with command: " + commandLine + "\n");
gdbserverProc = ProcessFactory.getFactory().exec(commandLine); gdbserverProc = ProcessFactory.getFactory().exec(commandLine);
Reader r = new InputStreamReader(gdbserverProc.getErrorStream()); Reader r = new InputStreamReader(gdbserverProc.getErrorStream());
@ -343,7 +345,7 @@ public class BaseTestCase {
} }
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println("Error while launching command: " + commandLine); GdbDebugOptions.trace("Error while launching command: " + commandLine + "\n");
e.printStackTrace(); e.printStackTrace();
assert false; assert false;
} }