diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml index 59bf46f0abe..22d788617a7 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml @@ -1,6018 +1,6119 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc2/test1DepCalc2.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc2/test1DepCalc2.zip new file mode 100755 index 00000000000..501e3f3c075 Binary files /dev/null and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc2/test1DepCalc2.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc3/test1DepCalc3.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc3/test1DepCalc3.zip new file mode 100755 index 00000000000..a797dcff31b Binary files /dev/null and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalc3/test1DepCalc3.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalcPreBuild/test1DepCalcPreBuild.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalcPreBuild/test1DepCalcPreBuild.zip new file mode 100755 index 00000000000..8563fada3c6 Binary files /dev/null and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/depCalcProjects/test1DepCalcPreBuild/test1DepCalcPreBuild.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip index 62345aa2949..b74ccd7c984 100644 Binary files a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip index a29b009efcc..c890dfacbd4 100644 Binary files a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1/test21.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1/test21.zip index e667da1c81c..2f9f1716de4 100644 Binary files a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1/test21.zip and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1/test21.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1CPP/Test21CXX.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1CPP/Test21CXX.zip index 51ca87b51b5..2421cc43103 100644 Binary files a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1CPP/Test21CXX.zip and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.1CPP/Test21CXX.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/test with spaces/test with spaces.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/test with spaces/test with spaces.zip index 26e7e67f662..1c12a4fbd77 100644 Binary files a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/test with spaces/test with spaces.zip and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/test with spaces/test with spaces.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/testFileWithNoExtension/testFileWithNoExtension.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/testFileWithNoExtension/testFileWithNoExtension.zip index 4009a747542..8af4f6c6f21 100644 Binary files a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/testFileWithNoExtension/testFileWithNoExtension.zip and b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/testFileWithNoExtension/testFileWithNoExtension.zip differ diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java index df36c031221..b8193aee547 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java @@ -1,65 +1,67 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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 - * - * Contributors: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.tests.suite; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests20; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests_SharedToolOptions; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildEnvironmentTests; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildMacrosTests; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildTCSupportedTest; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedCommandLineGeneratorTest; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject21MakefileTests; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject30MakefileTests; -import org.eclipse.cdt.managedbuilder.core.tests.ManagedProjectUpdateTests; -import org.eclipse.cdt.managedbuilder.core.tests.MultiVersionSupportTests; -import org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests; -import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests; - -/** - * - */ -public class AllManagedBuildTests { - public static void main(String[] args) { - CCorePlugin.getDefault().getCoreModel().getIndexManager().reset(); - junit.textui.TestRunner.run(AllManagedBuildTests.suite()); - } - public static Test suite() { - // May/2005 Turning off all indexing for now because the "original" indexer causes hangs... - CCorePlugin.getDefault().getPluginPreferences().setValue(CCorePlugin.PREF_INDEXER, CCorePlugin.NULL_INDEXER_UNIQUE_ID); - // We could enable this later... - //CCorePlugin.getDefault().getPluginPreferences().setValue(CCorePlugin.PREF_INDEXER, "org.eclipse.cdt.core.domsourceindexer"); - - TestSuite suite = new TestSuite( - "Test for org.eclipse.cdt.managedbuild.core.tests"); - //$JUnit-BEGIN$ -// TODO uncoment this - suite.addTest(ManagedBuildCoreTests20.suite()); - suite.addTest(ManagedBuildCoreTests.suite()); - suite.addTest(ManagedProjectUpdateTests.suite()); - suite.addTest(ManagedCommandLineGeneratorTest.suite()); - suite.addTest(ResourceBuildCoreTests.suite()); - suite.addTest(ManagedProject21MakefileTests.suite()); - suite.addTest(ManagedProject30MakefileTests.suite()); - suite.addTest(ManagedBuildCoreTests_SharedToolOptions.suite()); - suite.addTest(ManagedBuildEnvironmentTests.suite()); - suite.addTest(ManagedBuildMacrosTests.suite()); - suite.addTest(ManagedBuildTCSupportedTest.suite()); - suite.addTest(MultiVersionSupportTests.suite()); - suite.addTest(OptionEnablementTests.suite()); - //$JUnit-END$ - return suite; - } -} +/******************************************************************************* + * Copyright (c) 2004, 2005 IBM Corporation 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 + * + * Contributors: + * IBM - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.tests.suite; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests20; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildCoreTests_SharedToolOptions; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildEnvironmentTests; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildMacrosTests; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildDependencyCalculatorTests; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedBuildTCSupportedTest; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedCommandLineGeneratorTest; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject21MakefileTests; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedProject30MakefileTests; +import org.eclipse.cdt.managedbuilder.core.tests.ManagedProjectUpdateTests; +import org.eclipse.cdt.managedbuilder.core.tests.MultiVersionSupportTests; +import org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests; +import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests; + +/** + * + */ +public class AllManagedBuildTests { + public static void main(String[] args) { + CCorePlugin.getDefault().getCoreModel().getIndexManager().reset(); + junit.textui.TestRunner.run(AllManagedBuildTests.suite()); + } + public static Test suite() { + // May/2005 Turning off all indexing for now because the "original" indexer causes hangs... + CCorePlugin.getDefault().getPluginPreferences().setValue(CCorePlugin.PREF_INDEXER, CCorePlugin.NULL_INDEXER_UNIQUE_ID); + // We could enable this later... + //CCorePlugin.getDefault().getPluginPreferences().setValue(CCorePlugin.PREF_INDEXER, "org.eclipse.cdt.core.domsourceindexer"); + + TestSuite suite = new TestSuite( + "Test for org.eclipse.cdt.managedbuild.core.tests"); + //$JUnit-BEGIN$ +// TODO uncoment this + suite.addTest(ManagedBuildCoreTests20.suite()); + suite.addTest(ManagedBuildCoreTests.suite()); + suite.addTest(ManagedProjectUpdateTests.suite()); + suite.addTest(ManagedCommandLineGeneratorTest.suite()); + suite.addTest(ResourceBuildCoreTests.suite()); + suite.addTest(ManagedProject21MakefileTests.suite()); + suite.addTest(ManagedProject30MakefileTests.suite()); + suite.addTest(ManagedBuildCoreTests_SharedToolOptions.suite()); + suite.addTest(ManagedBuildEnvironmentTests.suite()); + suite.addTest(ManagedBuildMacrosTests.suite()); + suite.addTest(ManagedBuildTCSupportedTest.suite()); + suite.addTest(MultiVersionSupportTests.suite()); + suite.addTest(OptionEnablementTests.suite()); + suite.addTest(ManagedBuildDependencyCalculatorTests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java new file mode 100755 index 00000000000..9dca2b35ef4 --- /dev/null +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildDependencyCalculatorTests.java @@ -0,0 +1,240 @@ +/******************************************************************************* + * Copyright (c) 2006 Intel Corporation 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 + * + * Contributors: + * Intel Corporation - Initial API and implementation + *******************************************************************************/ + +/********************************************************************** + * These tests are for the default dependency calculators + **********************************************************************/ + +package org.eclipse.cdt.managedbuilder.core.tests; + +import java.io.File; +import java.io.FileFilter; +import java.util.ArrayList; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager; +import org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin; +import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.ui.dialogs.IOverwriteQuery; + +public class ManagedBuildDependencyCalculatorTests extends TestCase { + + public ManagedBuildDependencyCalculatorTests(String name) { + super(name); + } + + public static Test suite() { + TestSuite suite = new TestSuite(ManagedBuildDependencyCalculatorTests.class.getName()); + + suite.addTest(new ManagedBuildDependencyCalculatorTests("test1DepCalc2")); + suite.addTest(new ManagedBuildDependencyCalculatorTests("test1DepCalc3")); + suite.addTest(new ManagedBuildDependencyCalculatorTests("test1DepCalcPreBuild")); + return suite; + } + + private IProject[] createProject(String projName, IPath location, String projectTypeId, boolean containsZip){ + ArrayList projectList = null; + if (containsZip) { + File testDir = CTestPlugin.getFileInPlugin(new Path("resources/depCalcProjects/" + projName)); + if(testDir == null) { + fail("Test project directory " + projName + " is missing."); + return null; + } + + File projectZips[] = testDir.listFiles(new FileFilter(){ + public boolean accept(File pathname){ + if(pathname.isDirectory()) + return false; + return true; + } + }); + + projectList = new ArrayList(projectZips.length); + for(int i = 0; i < projectZips.length; i++){ + try{ + String projectName = projectZips[i].getName(); + if(!projectName.endsWith(".zip")) + continue; + + projectName = projectName.substring(0,projectName.length()-".zip".length()); + if(projectName.length() == 0) + continue; + IProject project = ManagedBuildTestHelper.createProject(projectName, projectZips[i], location, projectTypeId); + if(project != null) + projectList.add(project); + } + catch(Exception e){ + } + } + if(projectList.size() == 0) { + fail("No projects found in test project directory " + testDir.getName() + ". The .zip file may be missing or corrupt."); + return null; + } + } else { + try{ + IProject project = ManagedBuildTestHelper.createProject(projName, null, location, projectTypeId); + if(project != null) + projectList = new ArrayList(1); + projectList.add(project); + } catch(Exception e){} + } + + return (IProject[])projectList.toArray(new IProject[projectList.size()]); + } + + private IProject[] createProjects(String projName, IPath location, String projectTypeId, boolean containsZip) { + + // In case the projects need to be updated... + IOverwriteQuery queryALL = new IOverwriteQuery(){ + public String queryOverwrite(String file) { + return ALL; + }}; + IOverwriteQuery queryNOALL = new IOverwriteQuery(){ + public String queryOverwrite(String file) { + return NO_ALL; + }}; + + UpdateManagedProjectManager.setBackupFileOverwriteQuery(queryALL); + UpdateManagedProjectManager.setUpdateProjectQuery(queryALL); + + IProject projects[] = createProject(projName, location, projectTypeId, containsZip); + return projects; + } + + private void buildProjectsWorker(IProject projects[], IPath[] files, boolean compareBenchmark) { + if(projects == null || projects.length == 0) + return; + + boolean succeeded = true; + for (int i = 0; i < projects.length; i++){ + IProject curProject = projects[i]; + + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(curProject); + + //check whether the managed build info is converted + boolean isCompatible = UpdateManagedProjectManager.isCompatibleProject(info); + assertTrue(isCompatible); + + if (isCompatible){ + // Build the project in order to generate the makefiles + try{ + curProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD,null); + } + catch(CoreException e){ + fail(e.getStatus().getMessage()); + } + catch(OperationCanceledException e){ + fail("the project \"" + curProject.getName() + "\" build was cancelled, exception message: " + e.getMessage()); + } + + //compare the generated makefiles to their benchmarks + if (files != null && files.length > 0) { + if (i == 0) { + String configName = info.getDefaultConfiguration().getName(); + IPath buildDir = Path.fromOSString(configName); + if (compareBenchmark) + succeeded = ManagedBuildTestHelper.compareBenchmarks(curProject, buildDir, files); + else + succeeded = ManagedBuildTestHelper.verifyFilesDoNotExist(curProject, buildDir, files); + } + } + } + } + + if (succeeded) { // Otherwise leave the projects around for comparison + for (int i = 0; i < projects.length; i++) + ManagedBuildTestHelper.removeProject(projects[i].getName()); + } + } + + // Build projects and compare benchmarks + private void buildProjects(IProject projects[], IPath[] files) { + buildProjectsWorker(projects, files, true); + } + + + /* (non-Javadoc) + * test for dependency calculation as a side-effect of compilation + */ + public void test1DepCalc2(){ + IPath[] makefiles = { + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), + Path.fromOSString("subdir.mk"), + // This file is different using Cygwin vs GCC + //Path.fromOSString("main.d"), + Path.fromOSString("Sources/subdir.mk"), + Path.fromOSString("Sources/func1.d"), + Path.fromOSString("Sources/func2.d"), + Path.fromOSString("Sources/func4.d"), + Path.fromOSString("Sources/sub sources/func 3.d"), + Path.fromOSString("Sources/sub sources/subdir.mk")}; + IProject[] projects = createProjects("test1DepCalc2", null, null, true); + buildProjects(projects, makefiles); + } + + + /* (non-Javadoc) + * test for dependency calculation using Echo, a 2nd conmpilation step, and post-processing + */ + public void test1DepCalc3(){ + IPath[] makefiles = { + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), + Path.fromOSString("subdir.mk"), + // This file is different using Cygwin vs GCC + //Path.fromOSString("main.d"), + Path.fromOSString("Sources/subdir.mk"), + Path.fromOSString("Sources/func1.d"), + Path.fromOSString("Sources/func2.d"), + Path.fromOSString("Sources/func4.d"), + Path.fromOSString("Sources/sub sources/func 3.d"), + Path.fromOSString("Sources/sub sources/subdir.mk")}; + IProject[] projects = createProjects("test1DepCalc3", null, null, true); + buildProjects(projects, makefiles); + } + + + /* (non-Javadoc) + * test for dependency calculation that uses a separate, pre-build, step to generate dependency files + */ + public void test1DepCalcPreBuild(){ + IPath[] makefiles = { + Path.fromOSString("makefile"), + Path.fromOSString("objects.mk"), + Path.fromOSString("sources.mk"), + Path.fromOSString("subdir.mk"), + // This file is different using Cygwin vs GCC + //Path.fromOSString("main.d"), + Path.fromOSString("Sources/subdir.mk"), + Path.fromOSString("Sources/func1.d"), + Path.fromOSString("Sources/func2.d"), + Path.fromOSString("Sources/func4.d"), + Path.fromOSString("Sources/sub sources/func 3.d"), + Path.fromOSString("Sources/sub sources/subdir.mk")}; + IProject[] projects = createProjects("test1DepCalcPreBuild", null, null, true); + buildProjects(projects, makefiles); + } + +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java index 84e4a7eb15a..76a39889f96 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java @@ -614,7 +614,10 @@ public class ManagedProject30MakefileTests extends TestCase { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"), Path.fromOSString("sources.mk"), - Path.fromOSString("subdir.mk")}; + Path.fromOSString("subdir.mk"), + Path.fromOSString("main with spaces.d"), + Path.fromOSString("sub folder with spaces/subdir.mk"), + Path.fromOSString("sub folder with spaces/foo with spaces.d")}; IProject[] projects = createProjects("test with spaces", null, null, true); buildProjects(projects, makefiles); }