diff options
author | Alexander Kurtakov | 2014-09-09 12:41:22 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2014-09-09 13:22:47 +0000 |
commit | 0171ab6fe52a56c5bc0b043160cb8724a786e790 (patch) | |
tree | 21659c1a46637cf4d83b1eb6c92ae838d096508a /gcov | |
parent | f1d871b101d21308285cec9e72edc04e40afe51f (diff) | |
download | org.eclipse.linuxtools-0171ab6fe52a56c5bc0b043160cb8724a786e790.tar.gz org.eclipse.linuxtools-0171ab6fe52a56c5bc0b043160cb8724a786e790.tar.xz org.eclipse.linuxtools-0171ab6fe52a56c5bc0b043160cb8724a786e790.zip |
gcov: Disable auto-build programatically.
The swtbot way is failing on hudson.
Change-Id: I5a951e4544249376c5ab532fae1cd3821e76d53d
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-on: https://git.eclipse.org/r/33106
Tested-by: Hudson CI
Diffstat (limited to 'gcov')
-rw-r--r-- | gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java | 82 |
1 files changed, 8 insertions, 74 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java index 57b625ad66..8652d44fa0 100644 --- a/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java +++ b/gcov/org.eclipse.linuxtools.gcov.test/src/org/eclipse/linuxtools/internal/gcov/test/GcovTest.java @@ -17,6 +17,8 @@ import java.util.TreeSet; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceDescription; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.FileLocator; @@ -39,8 +41,6 @@ import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory; import org.eclipse.swtbot.swt.finder.results.VoidResult; import org.eclipse.swtbot.swt.finder.waits.Conditions; import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; -import org.eclipse.swtbot.swt.finder.waits.ICondition; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; @@ -62,65 +62,6 @@ public abstract class GcovTest { private static String testProjectName; private static String testProjectType; - private static final class UnCheckTest implements ICondition { - SWTBotCheckBox checkBox; - - public UnCheckTest(SWTBotCheckBox bot) { - checkBox = bot; - } - - @Override - public boolean test() { - return !checkBox.isChecked(); - } - - @Override - public void init(SWTBot bot) { - } - - @Override - public String getFailureMessage() { - return null; - } - } - - private static class NodeAvailableAndSelect extends DefaultCondition { - - private SWTBotTree tree; - private String parent; - private String node; - - /** - * Wait for a tree node (with a known parent) to become visible, and select it - * when it does. Note that this wait condition should only be used after having - * made an attempt to reveal the node. - * @param tree The SWTBotTree that contains the node to select. - * @param parent The text of the parent node that contains the node to select. - * @param node The text of the node to select. - */ - NodeAvailableAndSelect(SWTBotTree tree, String parent, String node){ - this.tree = tree; - this.node = node; - this.parent = parent; - } - - @Override - public boolean test() { - try { - SWTBotTreeItem parentNode = tree.getTreeItem(parent); - parentNode.getNode(node).select(); - return true; - } catch (WidgetNotFoundException e) { - return false; - } - } - - @Override - public String getFailureMessage() { - return "Timed out waiting for " + node; //$NON-NLS-1$ - } - } - public static SWTWorkbenchBot init(String projectName, String projectType) throws Exception { bot = new SWTWorkbenchBot(); @@ -147,20 +88,13 @@ public abstract class GcovTest { bot.captureScreenshot(projectName + ".beforeClass.2.jpg"); // Turn off automatic building by default - SWTBotMenu windowsMenu = bot.menu("Window"); - windowsMenu.menu("Preferences").click(); - SWTBotShell shell = bot.shell("Preferences"); - shell.activate(); - bot.text().setText("Workspace"); - bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Workspace")); - SWTBotCheckBox buildAuto = bot.checkBox("Build automatically"); - if (buildAuto != null && buildAuto.isChecked()) { - buildAuto.click(); + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IWorkspaceDescription desc = workspace.getDescription(); + boolean isAutoBuilding = desc.isAutoBuilding(); + if (isAutoBuilding) { + desc.setAutoBuilding(false); + workspace.setDescription(desc); } - bot.waitUntil(new UnCheckTest(buildAuto)); - bot.button("Apply").click(); - bot.button("OK").click(); - bot.waitUntil(Conditions.shellCloses(shell)); // define & repopulate project explorer |