Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2012-03-12 00:39:05 -0400
committerMarc-Andre Laperle2012-03-12 00:39:05 -0400
commit863ac9d61ba4066699b49a5a46a077036a26c2b6 (patch)
treefd629faff74e74de32a92acf018161cd13f8add0 /build/org.eclipse.cdt.autotools.ui.tests
parent4be0276d23c95deaaedb7ac41e57b8f8c322b7be (diff)
downloadorg.eclipse.cdt-863ac9d61ba4066699b49a5a46a077036a26c2b6.tar.gz
org.eclipse.cdt-863ac9d61ba4066699b49a5a46a077036a26c2b6.tar.xz
org.eclipse.cdt-863ac9d61ba4066699b49a5a46a077036a26c2b6.zip
Bug 368069 - RFE: Contribute Autotools plug-ins to the CDT
Diffstat (limited to 'build/org.eclipse.cdt.autotools.ui.tests')
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/.classpath7
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/.gitignore4
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/.project28
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/ChangeLog99
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/META-INF/MANIFEST.MF30
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/about.html22
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/build.properties7
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/plugin.properties12
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/Activator.java60
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AllTests.java25
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java551
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java234
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java184
-rw-r--r--build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java997
15 files changed, 2268 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/.classpath b/build/org.eclipse.cdt.autotools.ui.tests/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/.gitignore b/build/org.eclipse.cdt.autotools.ui.tests/.gitignore
new file mode 100644
index 0000000000..50c1b30a80
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/.gitignore
@@ -0,0 +1,4 @@
+bin
+@dot
+javaCompiler...args
+build.xml
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/.project b/build/org.eclipse.cdt.autotools.ui.tests/.project
new file mode 100644
index 0000000000..de2af813e3
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.autotools.ui.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.autotools.ui.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..7dd8708156
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Thu Mar 25 17:32:29 EDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/ChangeLog b/build/org.eclipse.cdt.autotools.ui.tests/ChangeLog
new file mode 100644
index 0000000000..ad5bb9cac4
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/ChangeLog
@@ -0,0 +1,99 @@
+2012-01-03 Jeff Johnston <jjohnstn@redhat.com>
+
+ Refactor to org.eclipse.cdt.autotools.ui.tests.
+
+2011-10-18 Jeff Johnston <jjohnstn@redhat.com>
+
+ * build.properties: Remove src.includes references to remove warnings.
+
+2010-06-22 Jeff Johnston <jjohnstn@redhat.com>
+
+ Tests: #317345
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestToolActions.java (canSeeTools): New test.
+ (canAccessAclocal2): Ditto.
+ (canAccessAutoconf2): Ditto.
+ (canAccessAutomake2): Ditto.
+ (canAccessLibtoolize2): Ditto.
+ (canAccessAutoheader2): Ditto.
+ (canAccessAutoreconf2): Ditto.
+ (canReconfigureProject2): Ditto.
+ (canSetTools): Ditto.
+ (canResetTools): Ditto.
+
+2010-06-04 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/SetConfigurationParameter.java (canBuildWithConfigParm): Add a check
+ for the Configure console showing a warning about the unknown option.
+
+2010-05-21 Jeff Johnston <jjohnstn@redhat.com>
+
+ Tests: #313754
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestMakeTargets.java: New file.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/AllTests.java: Add TestMakeTargets.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestEnvironmentVars.java (setEnvVarOnCommandLine): Add extra
+ environment variables that follow the command.
+
+2010-05-13 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/AllTests.java:
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestToolActions.java (sleep): Don't exit Eclipse since this
+ is no longer the last test in the list.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestEnvironmentVars.java: New file.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/SetConfigurationParameter.java (canBuildWithConfigParm): Add
+ test for bug #308261.
+
+2010-05-05 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/SetConfigurationParameter.java (canBuildWithConfigParm): Wait until
+ a.out is created before looking at config.status as we could end up looking at config.status while it is being created.
+ (newConfigCopiesParms): Don't assume that active configuration will be set in configuration list.
+
+2010-04-29 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/SetConfigurationParameter.java (canBuildWithConfigParm): Add
+ waiting period before testing existence of created file to ensure action has run on a slower system.
+ (newConfigCopiesParms): Ditto.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestToolActions.java (canAccessAutoconf): Ditto.
+ (canAccessAutomake): Ditto.
+ (canReconfigureProject): Ditto.
+ (canAccessAutoreconf): Ditto.
+ (canAccessAclocal): Ditto.
+ * plugin.properties: Change provider to Eclipse instead of Eclipse.org.
+ * META-INF/MANIFEST.MF: Add BundleLocalization statement so plugin.properties gets
+ used.
+
+2010-04-22 Jeff Johnston <jjohnstn@redhat.com>
+
+ * plugin.properties: New file.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/AllTests.java: New file.
+ * build.properties: Make plugin.properties part of binary build.
+ * META-INF/MANIFEST.MF: Change Java requirement to 1.5.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/Activator.java: Add copyright notice.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/SetConfigurationParameter.java (beforeClass): Close
+ Welcome view optionally if it exists. Also hard-wire keyboard to EN_US.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestToolActions.java (beforeClass): Ditto.
+ (sleep): Close Eclipse.
+
+2010-04-19 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestToolActions.java (canAccessAutoheader): New test.
+ (canAccessAutomake): Ditto.
+ (canReconfigureProject): Ditto.
+ (canAccessLibtoolize): Ditto.
+ (canAccessAutoreconf): Ditto.
+
+2010-04-15 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/TestToolActions.java: New file.
+ (canAccessAutomake): New test.
+
+2010-04-12 Jeff Johnston <jjohnstn@redhat.com>
+
+ Initial check-in.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/Activator.java: New file.
+ * src/org/eclipse/linuxtools/cdt/autotools/ui/tests/SetConfigurationParameter.java: New file.
+ * build.properties: New file.
+ * .project: New file.
+ * .classpath: New file.
+ * .settings: New file.
+ * META-INF/MANIFEST.MF: New file. \ No newline at end of file
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.autotools.ui.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..95e5d38ebb
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %bundleName
+Bundle-SymbolicName: org.eclipse.cdt.autotools.ui.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.autotools.ui.tests.Activator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
+ org.hamcrest;bundle-version="1.1.0",
+ org.junit4;bundle-version="4.5.0",
+ org.apache.log4j;bundle-version="1.2.13",
+ org.eclipse.core.resources;bundle-version="3.5.1",
+ org.eclipse.cdt.autotools.core;bundle-version="1.0.0",
+ org.eclipse.cdt.autotools.ui;bundle-version="1.0.0",
+ org.eclipse.cdt.core;bundle-version="5.1.1",
+ org.eclipse.cdt.launch;bundle-version="6.0.0",
+ org.eclipse.cdt.make.core;bundle-version="6.0.0",
+ org.eclipse.cdt.make.ui;bundle-version="6.0.1",
+ org.eclipse.cdt.managedbuilder.core;bundle-version="6.0.0",
+ org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="5.0.100",
+ org.eclipse.cdt.managedbuilder.ui;bundle-version="5.1.0",
+ org.eclipse.cdt.ui;bundle-version="5.1.1"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %provider
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/about.html b/build/org.eclipse.cdt.autotools.ui.tests/about.html
new file mode 100644
index 0000000000..fcbffcd8b6
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/about.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 23, 2005</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/build.properties b/build/org.eclipse.cdt.autotools.ui.tests/build.properties
new file mode 100644
index 0000000000..d9dac0dd8b
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html
+individualSourceBundles=true
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/plugin.properties b/build/org.eclipse.cdt.autotools.ui.tests/plugin.properties
new file mode 100644
index 0000000000..f5e37efb92
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2010 Red Hat, Inc.
+# 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
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Red Hat Incorporated - initial API and implementation
+#################################################################################
+bundleName=Autotools UI Tests Plug-in
+provider=Eclipse CDT \ No newline at end of file
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/Activator.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/Activator.java
new file mode 100644
index 0000000000..5386a4ed2e
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/Activator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.autotools.ui.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.cdt.autotools.ui.tests";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AllTests.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AllTests.java
new file mode 100644
index 0000000000..8ffac6185c
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AllTests.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.autotools.ui.tests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ SetConfigurationParameter.class,
+ TestToolActions.class,
+ TestEnvironmentVars.class,
+ TestMakeTargets.class,
+})
+public class AllTests {
+ // needed for this class to compile
+}
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java
new file mode 100644
index 0000000000..fb51504974
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java
@@ -0,0 +1,551 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.autotools.ui.tests;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withRegex;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.cdt.ui.newui.UIMessages;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.bindings.keys.KeyStroke;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class SetConfigurationParameter {
+
+ private static SWTWorkbenchBot bot;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
+ bot = new SWTWorkbenchBot();
+ // Close the Welcome view if it exists
+ try {
+ bot.viewByTitle("Welcome").close();
+ // Turn off automatic building by default
+ } catch (Exception e) {
+ // do nothing
+ }
+ // Turn off automatic building by default
+ bot.menu("Window").menu("Preferences").click();
+ SWTBotShell shell = bot.shell("Preferences");
+ shell.activate();
+ bot.tree().expandNode("General").select("Workspace");
+ SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
+ if (buildAuto != null && buildAuto.isChecked())
+ buildAuto.click();
+ bot.button("Apply").click();
+ // Ensure that the C/C++ perspective is chosen automatically
+ // and doesn't require user intervention
+ bot.tree().expandNode("General").select("Perspectives");
+ SWTBotRadio radio = bot.radio("Always open");
+ if (radio != null && !radio.isSelected())
+ radio.click();
+ bot.button("OK").click();
+ }
+
+ @Test
+ // Verify we can create a sample Autotools project using the New C Project UI
+ public void canCreateANewAutotoolsProject() throws Exception {
+ bot.menu("File").menu("New").menu("Project...").click();
+
+ SWTBotShell shell = bot.shell("New Project");
+ shell.activate();
+ bot.tree().expandNode("C/C++").select("C Project");
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Project name:").setText("GnuProject0");
+ bot.tree().expandNode("GNU Autotools").select("Hello World ANSI C Autotools Project");
+
+ bot.button("Finish").click();
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject0");
+ assertTrue(project != null);
+ IProjectNature nature = project.getNature("org.eclipse.cdt.autotools.core.autotoolsNatureV2");
+ assertTrue(nature != null);
+ }
+
+ @Test
+ // Verify we can set a configuration parameter and that it is recorded in
+ // the .autotools file for the project
+ public void canSetConfigParm() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ // Set the configure parameters to be --enable-jeff via user-defined options
+ SWTBotText text = bot.textWithLabel("Additional command-line options");
+ text.typeText("--enable-jeff");
+ bot.button("OK").click();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject0");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ path = path.append(".autotools");
+ File f = new File(path.toOSString());
+ assertTrue(f.exists());
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document d = db.parse(f);
+ Element e = d.getDocumentElement();
+ // Get the stored configuration data
+ NodeList cfgs = e.getElementsByTagName("configuration"); // $NON-NLS-1$
+ assertEquals(1, cfgs.getLength());
+ Node n = cfgs.item(0);
+ NodeList l = n.getChildNodes();
+ // Verify user field in .autotools file is set to --enable-jeff
+ boolean foundUser = false;
+ for (int y = 0; y < l.getLength(); ++y) {
+ Node child = l.item(y);
+ if (child.getNodeName().equals("option")) { // $NON-NLS-1$
+ NamedNodeMap optionAttrs = child.getAttributes();
+ Node idNode = optionAttrs.getNamedItem("id"); // $NON-NLS-1$
+ Node valueNode = optionAttrs.getNamedItem("value"); // $NON-NLS-1$
+ assertTrue(idNode != null);
+ assertTrue(valueNode != null);
+ String id = idNode.getNodeValue();
+ String value = valueNode.getNodeValue();
+ if (id.equals("user")) {
+ foundUser = true;
+ assertEquals(value, "--enable-jeff");
+ }
+ }
+ }
+ assertTrue(foundUser);
+ }
+
+ @Test
+ // Verify we can build the project with a configuration parameter and that
+ // the configuration parameter can be found in the config.status file.
+ public void canBuildWithConfigParm() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Build Project").click();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject0");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // We need to wait until the a.out file is created so
+ // sleep a bit and look for it...give up after 120 seconds
+ for (int i = 0; i < 240; ++i) {
+ bot.sleep(500);
+ File f = new File(path.append("src/a.out").toOSString());
+ if (f.exists())
+ break;
+ }
+ File f = new File(path.append("config.status").toOSString());
+ assertTrue(f.exists());
+ BufferedReader r = new BufferedReader(new FileReader(f));
+ int ch;
+ boolean optionFound = false;
+ // Read config.status and look for the string --enable-jeff
+ // which is a simple verification that the option was used in the
+ // configure step.
+ while ((ch = r.read()) != -1) {
+ if (ch == '-') {
+ char[] buf = new char[12];
+ r.mark(100);
+ int count = r.read(buf);
+ if (count < 12)
+ break;
+ String s = new String(buf);
+ if (s.equals("-enable-jeff")) {
+ optionFound = true;
+ break;
+ } else {
+ r.reset();
+ }
+ }
+ }
+ assertTrue(optionFound);
+ view = bot.viewByTitle("Console");
+ view.setFocus();
+ SWTBotToolbarDropDownButton b = bot.toolbarDropDownButtonWithTooltip("Display Selected Console");
+ org.hamcrest.Matcher<MenuItem> withRegex = withRegex(".*Configure.*");
+ b.menuItem(withRegex).click();
+ b.pressShortcut(KeyStroke.getInstance("ESC"));
+ String output = view.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*WARNING:.*unrecognized.*--enable-jeff.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // Verify that if we build again, we don't reconfigure.
+ // Verifies fix for bug: #308261
+ long oldDate = f.lastModified();
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Build Project").click();
+ path = project.getLocation();
+ // We need to wait until the a.out file is created so
+ // sleep a bit and look for it...give up after 120 seconds
+ for (int i = 0; i < 240; ++i) {
+ bot.sleep(500);
+ File tmp = new File(path.append("src/a.out").toOSString());
+ if (tmp.exists())
+ break;
+ }
+ f = new File(path.append("config.status").toOSString());
+ assertTrue(f.exists());
+ long newDate = f.lastModified();
+ assertEquals(newDate, oldDate);
+ }
+
+ @Test
+ // Verify a new configuration will copy the configuration parameters
+ // of its base configuration.
+ public void newConfigCopiesParms() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Build Configurations").menu("Manage...").click();
+ SWTBotShell shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.button("New...").click();
+ shell = bot.shell("Create New Configuration");
+ shell.activate();
+ SWTBotText t = bot.textWithLabel("Name:");
+ t.typeText("debug");
+ SWTBotRadio radio = bot.radio("Existing configuration");
+ if (!radio.isSelected())
+ radio.click();
+ bot.button("OK").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.button("New...").click();
+ shell = bot.shell("Create New Configuration");
+ shell.activate();
+ t = bot.textWithLabel("Name:");
+ t.typeText("default");
+ radio = bot.radio("Default configuration");
+ if (!radio.isSelected())
+ radio.click();
+ bot.button("OK").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ SWTBotTable table = bot.table();
+ assertTrue(table.containsItem("debug"));
+ table.getTableItem("debug").select();
+ bot.button("Set Active").click();
+ bot.button("OK").click();
+ // Verify the debug configuration is active and has a user parameter: --enable-jeff
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Properties").click();
+ shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ SWTBotCombo configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ configs.setFocus();
+ String[] items = configs.items();
+ for (int i = 0; i < items.length; ++i) {
+ if (items[i].contains("debug") && items[i].contains("Active"))
+ configs.setSelection(i);
+ }
+ assertTrue(configs.getText().contains("debug"));
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ SWTBotText text = bot.textWithLabel("Additional command-line options");
+ String val = text.getText();
+ assertEquals(val, "--enable-jeff");
+ // Verify that the build directory for the new configuration has been
+ // switched to build-debug
+ bot.tree().expandNode("C/C++ Build").select();
+ String buildDir = bot.textWithLabel("Build directory:").getText();
+ assertTrue(buildDir.endsWith("build-debug"));
+ // Verify the default configuration has no user setting
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ configs.setSelection("default");
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ val = text.getText();
+ assertEquals(val, "");
+ bot.button("OK").click();
+ // Build the project again and verify we get a build-debug directory
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Build Project").click();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject0");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // We need to wait until the config.status file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ File f = new File(path.append("build-debug/src/a.out").toOSString());
+ if (f.exists())
+ break;
+ }
+ File f = new File(path.append("build-debug/config.status").toOSString());
+ assertTrue(f.exists());
+ BufferedReader r = new BufferedReader(new FileReader(f));
+ int ch;
+ boolean optionFound = false;
+ // Read config.status and look for the string --enable-jeff
+ // which is a simple verification that the option was used in the
+ // configure step.
+ while ((ch = r.read()) != -1) {
+ if (ch == '-') {
+ char[] buf = new char[12];
+ r.mark(100);
+ int count = r.read(buf);
+ if (count < 12)
+ break;
+ String s = new String(buf);
+ if (s.equals("-enable-jeff")) {
+ optionFound = true;
+ break;
+ } else {
+ r.reset();
+ }
+ }
+ }
+ assertTrue(optionFound);
+ // Verify we cleaned out the top-level build directory (i.e. that there
+ // is no config.status there anymore).
+ path = project.getLocation().append("config.status");
+ f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ path = project.getLocation().append(".autotools");
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document d = db.parse(f);
+ Element e = d.getDocumentElement();
+ // Get the stored configuration data
+ NodeList cfgs = e.getElementsByTagName("configuration"); // $NON-NLS-1$
+ assertEquals(3, cfgs.getLength());
+ int foundUser = 0;
+ for (int x = 0; x < cfgs.getLength(); ++x) {
+ Node n = cfgs.item(x);
+ NodeList l = n.getChildNodes();
+ // Verify two of the user fields in .autotools file are set to --enable-jeff
+ for (int y = 0; y < l.getLength(); ++y) {
+ Node child = l.item(y);
+ if (child.getNodeName().equals("option")) { // $NON-NLS-1$
+ NamedNodeMap optionAttrs = child.getAttributes();
+ Node idNode = optionAttrs.getNamedItem("id"); // $NON-NLS-1$
+ Node valueNode = optionAttrs.getNamedItem("value"); // $NON-NLS-1$
+ assertTrue(idNode != null);
+ assertTrue(valueNode != null);
+ String id = idNode.getNodeValue();
+ String value = valueNode.getNodeValue();
+ if (id.equals("user")) {
+ if (value.equals("--enable-jeff"))
+ ++foundUser;
+ }
+ }
+ }
+ }
+ assertEquals(foundUser, 2);
+ }
+
+ @Test
+ // Verify we can do a double rename of configurations, renaming one configuration to
+ // another and then cancel without changing configuration settings.
+ public void doubleRenameCancel() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ SWTBotCombo configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ assertTrue(configs.getText().contains("debug"));
+ bot.button("Manage Configurations...").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.table().select("debug");
+ // Rename "debug" to "release" and rename "default" to "debug".
+ // The settings should follow the rename operation.
+ bot.button("Rename...").click();
+ shell = bot.shell("Rename Configuration");
+ shell.activate();
+ SWTBotText text = bot.textWithLabel("Name:");
+ text.setText("");
+ text.typeText("release");
+ bot.button("OK").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.table().select("default");
+ bot.button("Rename...").click();
+ shell = bot.shell("Rename Configuration");
+ shell.activate();
+ text = bot.textWithLabel("Name:");
+ text.setText("");
+ text.typeText("debug");
+ bot.button("OK").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.button("OK").click();
+ // Verify that "release" has --enable-jeff set and that
+ // the new "debug" configuration has no user setting.
+ shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ String setting = text.getText();
+ assertEquals("--enable-jeff", setting);
+ configs.setFocus();
+ configs.setSelection("debug");
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ setting = text.getText();
+ assertEquals("", setting);
+ bot.button("Cancel").click();
+ // Cancel and then verify that "debug" is back to normal with
+ // --enable-jeff set and that "default" is back to normal with
+ // no user setting.
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Properties").click();
+ shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ assertTrue(configs.getText().contains("debug"));
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ setting = text.getText();
+ assertEquals("--enable-jeff", setting);
+ configs.setFocus();
+ configs.setSelection("default");
+ assertTrue(configs.getText().contains("default"));
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ setting = text.getText();
+ assertEquals("", setting);
+ bot.button("OK").click();
+ }
+
+ @Test
+ // Verify we can do a double rename of configurations, renaming one configuration to
+ // another and inheriting the settings properly.
+ public void doubleRenameOk() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ SWTBotCombo configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ assertTrue(configs.getText().contains("debug"));
+ bot.button("Manage Configurations...").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.table().select("debug");
+ // Rename "debug" to "release" and rename "default" to "debug".
+ // The settings should follow the rename operation.
+ bot.button("Rename...").click();
+ shell = bot.shell("Rename Configuration");
+ shell.activate();
+ SWTBotText text = bot.textWithLabel("Name:");
+ text.setText("");
+ text.typeText("release");
+ bot.button("OK").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.table().select("default");
+ bot.button("Rename...").click();
+ shell = bot.shell("Rename Configuration");
+ shell.activate();
+ text = bot.textWithLabel("Name:");
+ text.setText("");
+ text.typeText("debug");
+ bot.button("OK").click();
+ shell = bot.shell("GnuProject0: Manage Configurations");
+ shell.activate();
+ bot.button("OK").click();
+ shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.button("OK").click();
+ // Verify changes have taken effect permanently
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject0");
+ bot.menu("Project", 1).menu("Properties").click();
+ shell = bot.shell("Properties for GnuProject0");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ configs = bot.comboBoxWithLabel(UIMessages.getString("AbstractPage.6"));
+ assertTrue(configs.getText().contains("release"));
+ assertTrue(configs.getText().contains("Active"));
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ String setting = text.getText();
+ assertEquals("--enable-jeff", setting);
+ configs.setFocus();
+ configs.setSelection("debug");
+ assertTrue(configs.getText().contains("debug"));
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ text = bot.textWithLabel("Additional command-line options");
+ setting = text.getText();
+ assertEquals("", setting);
+ bot.button("OK").click();
+ }
+
+ @AfterClass
+ public static void sleep() {
+ bot.sleep(4000);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java
new file mode 100644
index 0000000000..01b6a9479c
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.autotools.ui.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class TestEnvironmentVars {
+ private static SWTWorkbenchBot bot;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
+ bot = new SWTWorkbenchBot();
+ // Close the Welcome view if it exists
+ try {
+ bot.viewByTitle("Welcome").close();
+ // Turn off automatic building by default
+ } catch (Exception e) {
+ // do nothing
+ }
+ bot.menu("Window").menu("Preferences").click();
+ SWTBotShell shell = bot.shell("Preferences");
+ shell.activate();
+ bot.tree().expandNode("General").select("Workspace");
+ SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
+ if (buildAuto != null && buildAuto.isChecked())
+ buildAuto.click();
+ bot.button("Apply").click();
+ // Ensure that the C/C++ perspective is chosen automatically
+ // and doesn't require user intervention
+ bot.tree().expandNode("General").select("Perspectives");
+ SWTBotRadio radio = bot.radio("Always open");
+ if (radio != null && !radio.isSelected())
+ radio.click();
+ bot.button("OK").click();
+ bot.menu("File").menu("New").menu("Project...").click();
+
+ shell = bot.shell("New Project");
+ shell.activate();
+ bot.tree().expandNode("C/C++").select("C Project");
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Project name:").setText("GnuProject2");
+ bot.tree().expandNode("GNU Autotools").select("Hello World ANSI C Autotools Project");
+
+ bot.button("Finish").click();
+ }
+
+ @Test
+ // Verify we can pass an unknown env var in configure options and it will be nulled out
+ // Verifies fix for Bug: #303616
+ public void referenceUnknownEnvVar() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject2");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject2");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ bot.treeWithLabel("Configure Settings").expandNode("configure").select("Advanced");
+ // Set the configure parameters to be --enable-jeff via user-defined options
+ SWTBotText text = bot.textWithLabel("Additional command-line options");
+ text.typeText("${some_var}");
+ bot.button("OK").click();
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject2");
+ bot.menu("Project", 1).menu("Reconfigure Project").click();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject2");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ File f = null;
+ // We need to wait until the config.status file is created so
+ // sleep a bit and look for it...give up after 40 seconds
+ for (int i = 0; i < 80; ++i) {
+ bot.sleep(500);
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ break;
+ }
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ Pattern p = Pattern.compile(".*some_var.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ // We shouldn't see some_var anywhere in the console
+ assertTrue(!m.matches());
+ }
+
+ @Test
+ // Verify we can set an environment variable and use it as a configure parameter
+ // Verifies fix for Bug: #303616
+ public void setEnvVar() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject2");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject2");
+ shell.activate();
+ bot.tree().expandNode("C/C++ Build").select("Environment");
+ bot.button("Add...").click();
+ shell = bot.shell("New variable");
+ shell.activate();
+ SWTBotText text = bot.textWithLabel("Name:");
+ text.typeText("some_var");
+ text = bot.textWithLabel("Value:");
+ text.typeText("--enable-somevar");
+ bot.button("OK").click();
+ shell = bot.shell("Properties for GnuProject2");
+ shell.activate();
+ bot.button("OK").click();
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject2");
+ bot.menu("Project", 1).menu("Reconfigure Project").click();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject2");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ File f = null;
+ // We need to wait until the config.status file is created so
+ // sleep a bit and look for it...give up after 40 seconds
+ for (int i = 0; i < 80; ++i) {
+ bot.sleep(500);
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ break;
+ }
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ Pattern p = Pattern.compile(".*--enable-somevar.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ // We should see the expanded some_var variable in the console
+ assertTrue(m.matches());
+ }
+
+ @Test
+ // Verify we can set an environment variable prior to the configuration command and
+ // it will be seen by the configure script
+ public void setEnvVarOnCommandLine() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject2");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Create a fake configure script which prints out the values of
+ // envvars some_var1, some_var2, and some_var3
+ File f = new File(path.append("fake_configure").toOSString());
+ BufferedWriter w = new BufferedWriter(new FileWriter(f));
+ w.append("echo VAR1 is ${some_var1}");
+ w.newLine();
+ w.append("echo VAR2 is ${some_var2}");
+ w.newLine();
+ w.append("echo VAR3 is ${some_var3}");
+ w.newLine();
+ w.append("echo VAR4 is ${some_var4}");
+ w.newLine();
+ w.append("echo VAR5 is ${some_var5}");
+ w.newLine();
+ w.append("echo VAR6 is ${some_var6}");
+ w.newLine();
+ w.close();
+ // Now change the configure script command to be the fake configure script
+ // and set the three envvars on the command itself
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject2");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject2");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("Configure Settings");
+ bot.treeWithLabel("Configure Settings").select("configure");
+ bot.textWithLabel("Command").setText("");
+ // Choose three different forms, some using quotes to allow blanks in them
+ bot.textWithLabel("Command").typeText("some_var1=\"a boat\" some_var2='a train' some_var3=car fake_configure some_var4=\"a wagon\" some_var5='a plane' some_var6=skates");
+ bot.button("OK").click();
+ // Reconfigure the project and make sure the env variables are seen in the script
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject2");
+ bot.menu("Project", 1).menu("Reconfigure Project").click();
+ bot.sleep(3000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ Pattern p = Pattern.compile(".*VAR1 is a boat.*VAR2 is a train.*VAR3 is car.*VAR4 is a wagon.*VAR5 is a plane.*VAR6 is skates.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ }
+
+ @AfterClass
+ public static void sleep() {
+ bot.sleep(2000);
+ }
+} \ No newline at end of file
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java
new file mode 100644
index 0000000000..3d3bd1f785
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.autotools.ui.tests;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.finders.ContextMenuFinder;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+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;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class TestMakeTargets {
+
+ private static SWTWorkbenchBot bot;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
+ bot = new SWTWorkbenchBot();
+ // Close the Welcome view if it exists
+ try {
+ bot.viewByTitle("Welcome").close();
+ // Turn off automatic building by default
+ } catch (Exception e) {
+ // do nothing
+ }
+ bot.menu("Window").menu("Preferences").click();
+ SWTBotShell shell = bot.shell("Preferences");
+ shell.activate();
+ bot.tree().expandNode("General").select("Workspace");
+ SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
+ if (buildAuto != null && buildAuto.isChecked())
+ buildAuto.click();
+ bot.button("Apply").click();
+ // Ensure that the C/C++ perspective is chosen automatically
+ // and doesn't require user intervention
+ bot.tree().expandNode("General").select("Perspectives");
+ SWTBotRadio radio = bot.radio("Always open");
+ if (radio != null && !radio.isSelected())
+ radio.click();
+ bot.button("OK").click();
+ bot.menu("File").menu("New").menu("Project...").click();
+
+ shell = bot.shell("New Project");
+ shell.activate();
+ bot.tree().expandNode("C/C++").select("C Project");
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Project name:").setText("GnuProject3");
+ bot.tree().expandNode("GNU Autotools").select("Hello World ANSI C Autotools Project");
+
+ bot.button("Finish").click();
+ }
+
+ @Test
+ // Verify we can build and run the info MakeTarget tool
+ public void canBuildAndAccessInfoTarget() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject3");
+ bot.menu("Project", 1).menu("Build Project").click();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject3");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ path = path.append("config.status");
+ // We need to wait until the config.status file is created so
+ // sleep a bit and look for it...give up after 120 seconds
+ for (int i = 0; i < 240; ++i) {
+ bot.sleep(500);
+ File f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ File f = new File(path.toOSString());
+ assertTrue(f.exists());
+ view = bot.viewByTitle("Project Explorer");
+ // FIXME: there is a problem with the CDT adding multiple MakeTargets
+ // so the Autotools plugin adds them into the saved data all at
+ // once. The targets aren't refreshed until the project is reopened.
+ // We do this by manually closing and opening the project. This
+ // will not be needed as of CDT 7.0.0.
+ SWTBotTreeItem node = view.bot().tree().getTreeItem("GnuProject3");
+ node.setFocus();
+ node.select().contextMenu("Close Project").click();
+ node.setFocus();
+ node.select().contextMenu("Open Project").click();
+ view.bot().tree().select("GnuProject3");
+ bot.menu("Project", 1).menu("Make Target").menu("Build...").click();
+ SWTBotShell shell = bot.shell("Make Targets");
+ shell.activate();
+ bot.table().getTableItem("info").setFocus();
+ bot.table().getTableItem("info").select();
+ bot.button("Build").click();
+ bot.sleep(3000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ Pattern p = Pattern.compile(".*make info.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ view = bot.viewByTitle("Project Explorer");
+ view.setFocus();
+ node = view.bot().tree().getTreeItem("GnuProject3");
+ node.setFocus();
+ node.select();
+ // FIXME: when context menus work properly, add test to try out
+ // Make Targets using right-click on project.
+// node.contextMenu("Make Targets").contextMenu("Build...").click();
+// org.hamcrest.Matcher<MenuItem> withMnemonic = withMnemonic("Make Targets");
+// final org.hamcrest.Matcher<MenuItem> matcher = allOf(widgetOfType(MenuItem.class));
+// final ContextMenuFinder menuFinder = new ContextMenuFinder((Control)view.bot().tree().widget);
+// new SWTBot().waitUntil(new DefaultCondition() {
+// public String getFailureMessage() {
+// return "Could not find context menu with text: Make Targets"; //$NON-NLS-1$
+// }
+//
+// public boolean test() throws Exception {
+// return !menuFinder.findMenus(matcher).isEmpty();
+// }
+// });
+// List<MenuItem> list = menuFinder.findMenus(matcher);
+// bot.sleep(23000);
+// // Following does not work but should
+// SWTBotMenu menu = node.select().contextMenu("Make Targets");
+// bot.sleep(4000);
+// shell = bot.shell("Make Targets");
+// shell.activate();
+// bot.table().getTableItem("check").setFocus();
+// bot.table().getTableItem("check").select();
+// bot.button("Build").click();
+// bot.sleep(3000);
+// consoleView = bot.viewByTitle("Console");
+// consoleView.setFocus();
+// output = consoleView.bot().styledText().getText();
+// p = Pattern.compile(".*make check.*Making check in src.*", Pattern.DOTALL);
+// m = p.matcher(output);
+// assertTrue(m.matches());
+ }
+
+ @AfterClass
+ public static void sleep() {
+ bot.sleep(4000);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java
new file mode 100644
index 0000000000..9b35752c11
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java
@@ -0,0 +1,997 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.autotools.ui.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class TestToolActions {
+ private static SWTWorkbenchBot bot;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
+ bot = new SWTWorkbenchBot();
+ // Close the Welcome view if it exists
+ try {
+ bot.viewByTitle("Welcome").close();
+ // Turn off automatic building by default
+ } catch (Exception e) {
+ // do nothing
+ }
+ bot.menu("Window").menu("Preferences").click();
+ SWTBotShell shell = bot.shell("Preferences");
+ shell.activate();
+ bot.tree().expandNode("General").select("Workspace");
+ SWTBotCheckBox buildAuto = bot.checkBox("Build automatically");
+ if (buildAuto != null && buildAuto.isChecked())
+ buildAuto.click();
+ bot.button("Apply").click();
+ // Ensure that the C/C++ perspective is chosen automatically
+ // and doesn't require user intervention
+ bot.tree().expandNode("General").select("Perspectives");
+ SWTBotRadio radio = bot.radio("Always open");
+ if (radio != null && !radio.isSelected())
+ radio.click();
+ bot.button("OK").click();
+ bot.menu("File").menu("New").menu("Project...").click();
+
+ shell = bot.shell("New Project");
+ shell.activate();
+ bot.tree().expandNode("C/C++").select("C Project");
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Project name:").setText("GnuProject1");
+ bot.tree().expandNode("GNU Autotools").select("Hello World ANSI C Autotools Project");
+
+ bot.button("Finish").click();
+ }
+
+ @Test
+ // Verify we can set the tools via the Autotools Tools page
+ public void canSeeTools() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject1");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("General");
+ bot.tabItem("Tools Settings").activate();
+ String aclocalName = bot.textWithLabel("aclocal").getText();
+ assertTrue(aclocalName.equals("aclocal"));
+ String autoconfName = bot.textWithLabel("autoconf").getText();
+ assertTrue(autoconfName.equals("autoconf"));
+ String automakeName = bot.textWithLabel("automake").getText();
+ assertTrue(automakeName.equals("automake"));
+ String autoheaderName = bot.textWithLabel("autoheader").getText();
+ assertTrue(autoheaderName.equals("autoheader"));
+ String autoreconfName = bot.textWithLabel("autoreconf").getText();
+ assertTrue(autoreconfName.equals("autoreconf"));
+ String libtoolizeName = bot.textWithLabel("libtoolize").getText();
+ assertTrue(libtoolizeName.equals("libtoolize"));
+ bot.button("Cancel").click();
+ }
+
+ @Test
+ // Verify we can access the aclocal tool
+ public void canAccessAclocal() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Verify configure does not exist initially
+ path = path.append("aclocal.m4");
+ File f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Aclocal").click();
+ SWTBotShell shell = bot.shell("Aclocal Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking aclocal in.*GnuProject1.*aclocal --help.*Usage: aclocal.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // Verify we still don't have an aclocal.m4 file yet
+ f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ // Now lets run aclocal for our hello world project which hasn't had any
+ // autotool files generated yet.
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Aclocal").click();
+ shell = bot.shell("Aclocal Options");
+ shell.activate();
+ bot.button("OK").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ p = Pattern.compile(".*Invoking aclocal in.*GnuProject1.*aclocal.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the aclocal.m4 file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify we now have an aclocal.m4 file created
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can access the autoconf tool
+ public void canAccessAutoconf() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Verify configure does not exist initially
+ path = path.append("configure");
+ File f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoconf").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking autoconf in.*GnuProject1.*autoconf.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the configure file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify we now have a configure script
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ // Now lets delete the configure file and run autoconf from the project explorer
+ // menu directly from the configure.ac file.
+ assertTrue(f.delete());
+ view = bot.viewByTitle("Project Explorer");
+ SWTBotTreeItem node = view.bot().tree().expandNode("GnuProject1").getNode("configure.ac");
+ node.setFocus();
+ node.select().contextMenu("Invoke Autoconf").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ p = Pattern.compile(".*Invoking autoconf in.*GnuProject1.*autoconf.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the configure file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify we now have a configure script again
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can access the automake tool
+ public void canAccessAutomake() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Verify configure does not exist initially
+ IPath path2 = path.append("src/Makefile.in");
+ path = path.append("Makefile.in");
+ File f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ File f2 = new File(path2.toOSString());
+ assertTrue(!f2.exists());
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Automake").click();
+ SWTBotShell shell = bot.shell("Automake Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking automake in.*GnuProject1.*automake --help.*Usage:.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // Verify we still don't have Makefile.in files yet
+ f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ f2 = new File(path2.toOSString());
+ assertTrue(!f2.exists());
+ // Now lets run automake for our hello world project which hasn't had any
+ // Makefile.in files generated yet.
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Automake").click();
+ shell = bot.shell("Automake Options");
+ shell.activate();
+ bot.text(0).typeText("--add-missing"); // need this to successfully run here
+ bot.text(1).typeText("Makefile src/Makefile");
+ bot.button("OK").click();
+ bot.sleep(2000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ p = Pattern.compile(".*Invoking automake in.*GnuProject1.*automake --add-missing Makefile src/Makefile.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the Makefile.in files are created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ f2 = new File(path2.toOSString());
+ if (f.exists() && f2.exists())
+ break;
+ }
+ // Verify we now have Makefile.in files created
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ f2 = new File(path2.toOSString());
+ assertTrue(f2.exists());
+ }
+
+ @Test
+ // Verify we can access the libtoolize tool
+ public void canAccessLibtoolize() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Libtoolize").click();
+ SWTBotShell shell = bot.shell("Libtoolize Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking libtoolize in.*GnuProject1.*libtoolize --help.*Usage: libtoolize.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ }
+
+ @Test
+ // Verify we can access the libtoolize tool
+ public void canAccessAutoheader() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoheader").click();
+ SWTBotShell shell = bot.shell("Autoheader Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking autoheader in.*GnuProject1.*autoheader --help.*Usage:.*autoheader.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ }
+
+ @Test
+ // Verify we can access the autoreconf tool
+ public void canAccessAutoreconf() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Remove a number of generated files
+ File f = new File(path.append("src/Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("configure").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.sub").toOSString());
+ if (f.exists())
+ f.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoreconf").click();
+ SWTBotShell shell = bot.shell("Autoreconf Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking autoreconf in.*GnuProject1.*autoreconf --help.*Usage: .*autoreconf.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoreconf").click();
+ shell = bot.shell("Autoreconf Options");
+ shell.activate();
+ bot.text(0).typeText("-i");
+ bot.button("OK").click();
+ // We need to wait until the Makefile.in file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.append("Makefile.in").toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify a number of generated files now exist
+ f = new File(path.append("src/Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("configure").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("config.status").toOSString());
+ assertTrue(!f.exists()); //shouldn't have run configure
+ f = new File(path.append("config.sub").toOSString());
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can access the autoreconf tool
+ public void canReconfigureProject() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Remove a number of generated files
+ File f = new File(path.append("src/Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("configure").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.sub").toOSString());
+ if (f.exists())
+ f.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Reconfigure Project").click();
+ // We need to wait until the config.status file is created so
+ // sleep a bit and look for it...give up after 40 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify a number of generated files now exist
+ f = new File(path.append("src/Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("configure").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("config.status").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("config.sub").toOSString());
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can set and reset the tools via the Autotools Tools page
+ // Verifies bug #317345
+ public void canResetTools() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject1");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("General");
+ bot.tabItem("Tools Settings").activate();
+ bot.textWithLabel("aclocal").setText("");
+ bot.textWithLabel("aclocal").typeText("automake");
+ bot.textWithLabel("automake").setText("");
+ bot.textWithLabel("automake").typeText("autoconf");
+ bot.textWithLabel("autoconf").setText("");
+ bot.textWithLabel("autoconf").typeText("autoheader");
+ bot.textWithLabel("autoheader").setText("");
+ bot.textWithLabel("autoheader").typeText("autoreconf");
+ bot.textWithLabel("autoreconf").setText("");
+ bot.textWithLabel("autoreconf").typeText("libtoolize");
+ bot.textWithLabel("libtoolize").setText("");
+ bot.textWithLabel("libtoolize").typeText("aclocal");
+ bot.button("Apply").click();
+ String aclocalName = bot.textWithLabel("aclocal").getText();
+ assertTrue(aclocalName.equals("automake"));
+ String autoconfName = bot.textWithLabel("autoconf").getText();
+ assertTrue(autoconfName.equals("autoheader"));
+ String automakeName = bot.textWithLabel("automake").getText();
+ assertTrue(automakeName.equals("autoconf"));
+ String autoheaderName = bot.textWithLabel("autoheader").getText();
+ assertTrue(autoheaderName.equals("autoreconf"));
+ String autoreconfName = bot.textWithLabel("autoreconf").getText();
+ assertTrue(autoreconfName.equals("libtoolize"));
+ String libtoolizeName = bot.textWithLabel("libtoolize").getText();
+ assertTrue(libtoolizeName.equals("aclocal"));
+ bot.button("Restore Defaults").click();
+ aclocalName = bot.textWithLabel("aclocal").getText();
+ assertTrue(aclocalName.equals("aclocal"));
+ autoconfName = bot.textWithLabel("autoconf").getText();
+ assertTrue(autoconfName.equals("autoconf"));
+ automakeName = bot.textWithLabel("automake").getText();
+ assertTrue(automakeName.equals("automake"));
+ autoheaderName = bot.textWithLabel("autoheader").getText();
+ assertTrue(autoheaderName.equals("autoheader"));
+ autoreconfName = bot.textWithLabel("autoreconf").getText();
+ assertTrue(autoreconfName.equals("autoreconf"));
+ libtoolizeName = bot.textWithLabel("libtoolize").getText();
+ assertTrue(libtoolizeName.equals("libtoolize"));
+ bot.button("OK").click();
+ }
+
+ @Test
+ // Verify we can access the aclocal tool
+ public void canAccessAclocal2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Verify configure does not exist initially
+ path = path.append("aclocal.m4");
+ File f = new File(path.toOSString());
+ f.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Aclocal").click();
+ SWTBotShell shell = bot.shell("Aclocal Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking aclocal in.*GnuProject1.*aclocal --help.*Usage: aclocal.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // Verify we still don't have an aclocal.m4 file yet
+ f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ // Now lets run aclocal for our hello world project which hasn't had any
+ // autotool files generated yet.
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Aclocal").click();
+ shell = bot.shell("Aclocal Options");
+ shell.activate();
+ bot.button("OK").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ p = Pattern.compile(".*Invoking aclocal in.*GnuProject1.*aclocal.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the aclocal.m4 file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify we now have an aclocal.m4 file created
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can access the autoconf tool
+ public void canAccessAutoconf2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Verify configure does not exist initially
+ path = path.append("configure");
+ File f = new File(path.toOSString());
+ f.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoconf").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking autoconf in.*GnuProject1.*autoconf.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the configure file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify we now have a configure script
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ // Now lets delete the configure file and run autoconf from the project explorer
+ // menu directly from the configure.ac file.
+ assertTrue(f.delete());
+ view = bot.viewByTitle("Project Explorer");
+ SWTBotTreeItem node = view.bot().tree().expandNode("GnuProject1").getNode("configure.ac");
+ node.setFocus();
+ node.select().contextMenu("Invoke Autoconf").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ p = Pattern.compile(".*Invoking autoconf in.*GnuProject1.*autoconf.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the configure file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify we now have a configure script again
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can access the automake tool
+ public void canAccessAutomake2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Verify configure does not exist initially
+ IPath path2 = path.append("src/Makefile.in");
+ path = path.append("Makefile.in");
+ File f = new File(path.toOSString());
+ f.delete();
+ File f2 = new File(path2.toOSString());
+ f2.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Automake").click();
+ SWTBotShell shell = bot.shell("Automake Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking automake in.*GnuProject1.*automake --help.*Usage:.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ // Verify we still don't have Makefile.in files yet
+ f = new File(path.toOSString());
+ assertTrue(!f.exists());
+ f2 = new File(path2.toOSString());
+ assertTrue(!f2.exists());
+ // Now lets run automake for our hello world project which hasn't had any
+ // Makefile.in files generated yet.
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Automake").click();
+ shell = bot.shell("Automake Options");
+ shell.activate();
+ bot.text(0).typeText("--add-missing"); // need this to successfully run here
+ bot.text(1).typeText("Makefile src/Makefile");
+ bot.button("OK").click();
+ bot.sleep(2000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ p = Pattern.compile(".*Invoking automake in.*GnuProject1.*automake --add-missing Makefile src/Makefile.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ // We need to wait until the Makefile.in files are created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.toOSString());
+ f2 = new File(path2.toOSString());
+ if (f.exists() && f2.exists())
+ break;
+ }
+ // Verify we now have Makefile.in files created
+ f = new File(path.toOSString());
+ assertTrue(f.exists());
+ f2 = new File(path2.toOSString());
+ assertTrue(f2.exists());
+ }
+
+ @Test
+ // Verify we can access the libtoolize tool
+ public void canAccessLibtoolize2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Libtoolize").click();
+ SWTBotShell shell = bot.shell("Libtoolize Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking libtoolize in.*GnuProject1.*libtoolize --help.*Usage: libtoolize.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ }
+
+ @Test
+ // Verify we can access the libtoolize tool
+ public void canAccessAutoheader2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoheader").click();
+ SWTBotShell shell = bot.shell("Autoheader Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking autoheader in.*GnuProject1.*autoheader --help.*Usage:.*autoheader.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ }
+
+ @Test
+ // Verify we can access the autoreconf tool
+ public void canAccessAutoreconf2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Remove a number of generated files
+ File f = new File(path.append("src/Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("configure").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.sub").toOSString());
+ if (f.exists())
+ f.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoreconf").click();
+ SWTBotShell shell = bot.shell("Autoreconf Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking autoreconf in.*GnuProject1.*autoreconf --help.*Usage: .*autoreconf.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoreconf").click();
+ shell = bot.shell("Autoreconf Options");
+ shell.activate();
+ bot.text(0).typeText("-i");
+ bot.button("OK").click();
+ // We need to wait until the Makefile.in file is created so
+ // sleep a bit and look for it...give up after 20 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.append("Makefile.in").toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify a number of generated files now exist
+ f = new File(path.append("src/Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("configure").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("config.status").toOSString());
+ assertTrue(!f.exists()); //shouldn't have run configure
+ f = new File(path.append("config.sub").toOSString());
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can access the autoreconf tool
+ public void canReconfigureProject2() throws Exception {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ assertTrue(workspace != null);
+ IWorkspaceRoot root = workspace.getRoot();
+ assertTrue(root != null);
+ IProject project = root.getProject("GnuProject1");
+ assertTrue(project != null);
+ IPath path = project.getLocation();
+ // Remove a number of generated files
+ File f = new File(path.append("src/Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("Makefile.in").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("configure").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ f.delete();
+ f = new File(path.append("config.sub").toOSString());
+ if (f.exists())
+ f.delete();
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Reconfigure Project").click();
+ // We need to wait until the config.status file is created so
+ // sleep a bit and look for it...give up after 40 seconds
+ for (int i = 0; i < 40; ++i) {
+ bot.sleep(500);
+ f = new File(path.append("config.status").toOSString());
+ if (f.exists())
+ break;
+ }
+ // Verify a number of generated files now exist
+ f = new File(path.append("src/Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("Makefile.in").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("configure").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("config.status").toOSString());
+ assertTrue(f.exists());
+ f = new File(path.append("config.sub").toOSString());
+ assertTrue(f.exists());
+ }
+
+ @Test
+ // Verify we can set the tools via the Autotools Tools page
+ public void canSetTools() throws Exception {
+ SWTBotView view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Properties").click();
+ SWTBotShell shell = bot.shell("Properties for GnuProject1");
+ shell.activate();
+ bot.tree().expandNode("Autotools").select("General");
+ bot.tabItem("Tools Settings").activate();
+ bot.textWithLabel("aclocal").setText("");
+ bot.textWithLabel("aclocal").typeText("automake");
+ bot.textWithLabel("automake").setText("");
+ bot.textWithLabel("automake").typeText("autoconf");
+ bot.textWithLabel("autoconf").setText("");
+ bot.textWithLabel("autoconf").typeText("autoheader");
+ bot.textWithLabel("autoheader").setText("");
+ bot.textWithLabel("autoheader").typeText("autoreconf");
+ bot.textWithLabel("autoreconf").setText("");
+ bot.textWithLabel("autoreconf").typeText("libtoolize");
+ bot.textWithLabel("libtoolize").setText("");
+ bot.textWithLabel("libtoolize").typeText("aclocal");
+ bot.button("OK").click();
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Aclocal").click();
+ shell = bot.shell("Aclocal Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ SWTBotView consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ String output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ Pattern p = Pattern.compile(".*Invoking aclocal in.*GnuProject1.*automake --help.*Usage:.*automake.*", Pattern.DOTALL);
+ Matcher m = p.matcher(output);
+ assertTrue(m.matches());
+
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Automake").click();
+ shell = bot.shell("Automake Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ p = Pattern.compile(".*Invoking automake in.*GnuProject1.*autoconf --help.*Usage:.*autoconf.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoheader").click();
+ shell = bot.shell("Autoheader Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ p = Pattern.compile(".*Invoking autoheader in.*GnuProject1.*autoreconf --help.*Usage:.*autoreconf.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Autoreconf").click();
+ shell = bot.shell("Autoreconf Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ p = Pattern.compile(".*Invoking autoreconf in.*GnuProject1.*libtoolize --help.*Usage:.*libtoolize.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ view = bot.viewByTitle("Project Explorer");
+ view.bot().tree().select("GnuProject1");
+ bot.menu("Project", 1).menu("Invoke Autotools").menu("Invoke Libtoolize").click();
+ shell = bot.shell("Libtoolize Options");
+ shell.activate();
+ bot.text(0).typeText("--help");
+ bot.button("OK").click();
+ bot.sleep(1000);
+ consoleView = bot.viewByTitle("Console");
+ consoleView.setFocus();
+ output = consoleView.bot().styledText().getText();
+ // Verify we got some help output to the console
+ p = Pattern.compile(".*Invoking libtoolize in.*GnuProject1.*aclocal --help.*Usage:.*aclocal.*", Pattern.DOTALL);
+ m = p.matcher(output);
+ assertTrue(m.matches());
+ }
+
+ @AfterClass
+ public static void sleep() {
+ bot.sleep(2000);
+ }
+
+}

Back to the top