diff options
author | Doug Schaefer | 2017-10-05 00:47:32 +0000 |
---|---|---|
committer | Doug Schaefer | 2017-10-06 20:36:51 +0000 |
commit | 11dcec43f211e694b0c8f811be37f34868a4cdf0 (patch) | |
tree | 8193e40cdce02c23518368667008d99488d7bf02 /build | |
parent | cfd6e9867ede236878072ed630478685fd43cba0 (diff) | |
download | org.eclipse.cdt-11dcec43f211e694b0c8f811be37f34868a4cdf0.tar.gz org.eclipse.cdt-11dcec43f211e694b0c8f811be37f34868a4cdf0.tar.xz org.eclipse.cdt-11dcec43f211e694b0c8f811be37f34868a4cdf0.zip |
Add UI tests plugin for CMake. Fix a couple of bugs it found.
Also restructures the pom.xmls to put the modules in the top level
so we can order them to have the test plugins build after them.
Change-Id: I2f0e4ebd252791fb8844cdf0f635d574946207aa
Diffstat (limited to 'build')
15 files changed, 248 insertions, 30 deletions
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java index f5cd6b21b64..3ee7de0d1b6 100644 --- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java +++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java @@ -106,6 +106,8 @@ public class GCCToolChain extends PlatformObject implements IToolChain { idBuilder.append(pathToToolChain.toString()); this.id = idBuilder.toString(); + properties.put(ATTR_ARCH, arch); + IEnvironmentVariable pathVar = null; if (envVars != null) { for (IEnvironmentVariable envVar : envVars) { diff --git a/build/org.eclipse.cdt.cmake.ui.tests/.classpath b/build/org.eclipse.cdt.cmake.ui.tests/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.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.8"/> + <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.cmake.ui.tests/.project b/build/org.eclipse.cdt.cmake.ui.tests/.project new file mode 100644 index 00000000000..737f5d08009 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.cdt.cmake.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.cmake.ui.tests/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.cmake.ui.tests/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/build/org.eclipse.cdt.cmake.ui.tests/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.ui.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..8ae804036f2 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Tests +Bundle-SymbolicName: org.eclipse.cdt.cmake.ui.tests +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Eclipse CDT +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.swtbot.go;bundle-version="2.7.0", + org.eclipse.cdt.core;bundle-version="6.4.0", + org.eclipse.core.resources;bundle-version="3.12.0", + org.eclipse.cdt.cmake.core;bundle-version="1.2.0" diff --git a/build/org.eclipse.cdt.cmake.ui.tests/build.properties b/build/org.eclipse.cdt.cmake.ui.tests/build.properties new file mode 100644 index 00000000000..34d2e4d2dad --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/build/org.eclipse.cdt.cmake.ui.tests/pom.xml b/build/org.eclipse.cdt.cmake.ui.tests/pom.xml new file mode 100644 index 00000000000..cb4587258c3 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.cdt</groupId> + <artifactId>cdt-parent</artifactId> + <version>9.3.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + + <artifactId>org.eclipse.cdt.cmake.ui.tests</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-test-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>target-platform-configuration</artifactId> + <version>${tycho-version}</version> + <configuration> + <dependency-resolution> + <extraRequirements> + <requirement> + <type>p2-installable-unit</type> + <id>org.eclipse.cdt.feature.group</id> + <versionRange>0.0.0</versionRange> + </requirement> + <requirement> + <type>p2-installable-unit</type> + <id>org.eclipse.cdt.cmake.feature.group</id> + <versionRange>0.0.0</versionRange> + </requirement> + </extraRequirements> + </dependency-resolution> + </configuration> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/build/org.eclipse.cdt.cmake.ui.tests/src/org/eclipse/cdt/cmake/ui/internal/tests/AutomatedIntegrationSuite.java b/build/org.eclipse.cdt.cmake.ui.tests/src/org/eclipse/cdt/cmake/ui/internal/tests/AutomatedIntegrationSuite.java new file mode 100644 index 00000000000..698779e0eb8 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/src/org/eclipse/cdt/cmake/ui/internal/tests/AutomatedIntegrationSuite.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2017 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package org.eclipse.cdt.cmake.ui.internal.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ NewCMakeProjectTest.class }) +public class AutomatedIntegrationSuite { + +} diff --git a/build/org.eclipse.cdt.cmake.ui.tests/src/org/eclipse/cdt/cmake/ui/internal/tests/NewCMakeProjectTest.java b/build/org.eclipse.cdt.cmake.ui.tests/src/org/eclipse/cdt/cmake/ui/internal/tests/NewCMakeProjectTest.java new file mode 100644 index 00000000000..0f425bf2736 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/src/org/eclipse/cdt/cmake/ui/internal/tests/NewCMakeProjectTest.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2017 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package org.eclipse.cdt.cmake.ui.internal.tests; + +import static org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withPartName; +import static org.junit.Assert.assertTrue; + +import org.eclipse.cdt.cmake.core.CMakeNature; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.index.IIndexManager; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@SuppressWarnings("nls") +public class NewCMakeProjectTest { + + private static SWTWorkbenchBot bot; + + @BeforeClass + public static void beforeClass() { + SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; + SWTBotPreferences.TIMEOUT = 10000; + bot = new SWTWorkbenchBot(); + } + + @Before + public void before() { + bot.resetWorkbench(); + + for (SWTBotView view : bot.views(withPartName("Welcome"))) { + view.close(); + } + } + + @Test(timeout = 60000) + public void createCMakeProject() throws Exception { + // open C++ perspective + if (!"C/C++".equals(bot.activePerspective().getLabel())) { + bot.perspectiveByLabel("C/C++").activate(); + } + + // Activate C/C++ wizard + bot.menu("File").menu("New").menu("C/C++ Project").click(); + bot.shell("New C/C++ Project").activate(); + + // Double click on the template + SWTBotTable templateTable = bot.table(); + bot.getDisplay().syncExec(() -> { + for (int i = 0; i < templateTable.rowCount(); ++i) { + SWTBotTableItem item = templateTable.getTableItem(i); + if ("CMake Project".equals(item.widget.getData(SWTBotPreferences.DEFAULT_KEY))) { + item.doubleClick(); + break; + } + } + }); + + // Select the shell again since magic wizardry happened + bot.shell("New CMake Project").activate(); + + // Create the project + String projectName = "CMakeTestProj"; + bot.textWithLabel("Project name:").setText(projectName); + bot.button("Finish").click(); + + // Make sure it shows up in Project Explorer + bot.viewByPartName("Project Explorer").show(); + bot.tree().getTreeItem(projectName); + + // Make sure the project indexer completes. At that point we're stable. + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + ICProject cproject = CoreModel.getDefault().create(project); + IIndexManager indexManager = CCorePlugin.getIndexManager(); + while (!indexManager.isProjectContentSynced(cproject)) { + Thread.sleep(1000); + } + + // Make sure it has the right nature + assertTrue(project.hasNature(CMakeNature.ID)); + } + +} diff --git a/build/org.eclipse.cdt.cmake.ui.tests/swtbot-test-plugin.properties b/build/org.eclipse.cdt.cmake.ui.tests/swtbot-test-plugin.properties new file mode 100644 index 00000000000..338038b9345 --- /dev/null +++ b/build/org.eclipse.cdt.cmake.ui.tests/swtbot-test-plugin.properties @@ -0,0 +1 @@ +# This file tells the Maven build to use the settings for SWTBot test plugins diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java index 7778df8d84b..6cc9a02e012 100644 --- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java +++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/CMakeBuildTab.java @@ -1,3 +1,10 @@ +/******************************************************************************* + * Copyright (c) 2017 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package org.eclipse.cdt.cmake.ui.internal; import java.util.HashMap; diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java index cffd11d7158..50df2366fab 100644 --- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java +++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.java @@ -1,3 +1,10 @@ +/******************************************************************************* + * Copyright (c) 2017 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ package org.eclipse.cdt.cmake.ui.internal; import org.eclipse.osgi.util.NLS; @@ -15,9 +22,13 @@ public class Messages extends NLS { public static String CMakePropertyPage_FailedToStartCMakeGui_Title; public static String CMakePropertyPage_LaunchCMakeGui; + public static String NewCMakeProjectWizard_Description; + public static String NewCMakeProjectWizard_PageTitle; + public static String NewCMakeProjectWizard_WindowTitle; + static { // initialize resource bundle - NLS.initializeMessages(Messages.class.getName(), Messages.class); + NLS.initializeMessages("org.eclipse.cdt.cmake.ui.internal.messages", Messages.class); //$NON-NLS-1$ } private Messages() { diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java index ad732e9e859..39f9996fca6 100644 --- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java +++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java @@ -9,6 +9,7 @@ package org.eclipse.cdt.cmake.ui.internal; import org.eclipse.cdt.cmake.core.CMakeProjectGenerator; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.wizard.IWizardContainer; import org.eclipse.swt.widgets.Composite; import org.eclipse.tools.templates.core.IGenerator; import org.eclipse.tools.templates.ui.TemplateWizard; @@ -19,6 +20,12 @@ public class NewCMakeProjectWizard extends TemplateWizard { private WizardNewProjectCreationPage mainPage; @Override + public void setContainer(IWizardContainer wizardContainer) { + super.setContainer(wizardContainer); + setWindowTitle(Messages.NewCMakeProjectWizard_WindowTitle); + } + + @Override public void addPages() { mainPage = new WizardNewProjectCreationPage("basicNewProjectPage") { //$NON-NLS-1$ @Override @@ -29,8 +36,8 @@ public class NewCMakeProjectWizard extends TemplateWizard { Dialog.applyDialogFont(getControl()); } }; - mainPage.setTitle("New CMake Project"); //$NON-NLS-1$ - mainPage.setDescription("Specify properties of new CMake project."); //$NON-NLS-1$ + mainPage.setTitle(Messages.NewCMakeProjectWizard_PageTitle); + mainPage.setDescription(Messages.NewCMakeProjectWizard_Description); this.addPage(mainPage); } diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.properties b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties index e0e45fd3d9b..51b607823f3 100644 --- a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Messages.properties +++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties @@ -8,3 +8,6 @@ CMakeBuildTab_UnixMakefiles=Unix Makefiles CMakePropertyPage_FailedToStartCMakeGui_Body=Failed to run the CMake GUI: CMakePropertyPage_FailedToStartCMakeGui_Title=Failed to run CMake GUI CMakePropertyPage_LaunchCMakeGui=Launch CMake GUI... +NewCMakeProjectWizard_Description=Specify properties of new CMake project. +NewCMakeProjectWizard_PageTitle=New CMake Project +NewCMakeProjectWizard_WindowTitle=New CMake Project diff --git a/build/pom.xml b/build/pom.xml index 9964cdd85f0..1668c91e52d 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -10,33 +10,6 @@ <version>9.3.0-SNAPSHOT</version> </parent> - <modules> - <module>org.eclipse.cdt.build.gcc.core</module> - <module>org.eclipse.cdt.make.core</module> - <module>org.eclipse.cdt.make.ui</module> - <module>org.eclipse.cdt.managedbuilder.core</module> - <module>org.eclipse.cdt.managedbuilder.ui</module> - - <module>org.eclipse.cdt.managedbuilder.gnu.ui</module> - <module>org.eclipse.cdt.gnu.build-feature</module> - - <module>org.eclipse.cdt.managedbuilder.core.tests</module> - <module>org.eclipse.cdt.managedbuilder.ui.tests</module> - <module>org.eclipse.cdt.make.core.tests</module> - <module>org.eclipse.cdt.make.ui.tests</module> - - <module>org.eclipse.cdt.autotools.core</module> - <module>org.eclipse.cdt.autotools.docs</module> - <module>org.eclipse.cdt.autotools.tests</module> - <module>org.eclipse.cdt.autotools.ui</module> - <module>org.eclipse.cdt.autotools.ui.tests</module> - <module>org.eclipse.cdt.autotools-feature</module> - - <module>org.eclipse.cdt.cmake.core</module> - <module>org.eclipse.cdt.cmake.ui</module> - <module>org.eclipse.cdt.cmake-feature</module> - </modules> - <artifactId>org.eclipse.cdt.build-parent</artifactId> <packaging>pom</packaging> </project> |