1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Add logging to Stand-alone debugger test

This will help give a clue where is hangs when running on Hudson

Change-Id: If72db5e9d4ac387328074071ab3eacf33d81ca9c
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
Marc-Andre Laperle 2016-06-05 19:42:57 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent 941c435544
commit 50ce6beede

View file

@ -10,6 +10,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.application.tests; package org.eclipse.cdt.debug.application.tests;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.SWTBot;
@ -18,6 +21,7 @@ import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass;
public abstract class StandaloneTest { public abstract class StandaloneTest {
@ -27,11 +31,15 @@ public abstract class StandaloneTest {
protected static String projectName; protected static String projectName;
protected static SWTBotShell mainShell; protected static SWTBotShell mainShell;
protected static SWTBotView projectExplorer; protected static SWTBotView projectExplorer;
private static final Logger fLogger = Logger.getRootLogger();
public static void init(String projectName) throws Exception { public static void init(String projectName) throws Exception {
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.TIMEOUT = 20000;
fLogger.removeAllAppenders();
fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT));
bot = new SWTBot(); bot = new SWTBot();
Utilities.getDefault().buildProject(projectName); Utilities.getDefault().buildProject(projectName);
final IPath executablePath = Utilities.getDefault().getProjectPath(projectName).append("a.out"); //$NON-NLS-1$ final IPath executablePath = Utilities.getDefault().getProjectPath(projectName).append("a.out"); //$NON-NLS-1$
@ -71,6 +79,14 @@ public abstract class StandaloneTest {
// mainShell.activate(); // mainShell.activate();
} }
/**
* Test class tear down method.
*/
@AfterClass
public static void tearDown() {
fLogger.removeAllAppenders();
}
private static final class WaitForFileCondition extends DefaultCondition { private static final class WaitForFileCondition extends DefaultCondition {
private final IPath executablePath; private final IPath executablePath;