1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Add test for top-level tool-chain

This commit is contained in:
Leo Treggiari 2005-07-03 03:55:29 +00:00
parent c488f8ca33
commit a9602f87cf
2 changed files with 169 additions and 6 deletions

View file

@ -3830,5 +3830,130 @@
</projectType> </projectType>
<!-- Test tool-chain defined at top level -->
<toolChain
id="TopTC.toolchain.base"
name="TopLevel Toolchain"
isAbstract="true"
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
<targetPlatform
id="TopTC.platform"
name="TopTC Platform"
binaryParser="org.eclipse.cdt.core.PE"/>
<builder
id="TopTC.managedbuilder"
name="TopTC Builder"/>
<tool
id="TopTC.tool.assembler"
superClass="cdt.managedbuild.tool.gnu.assembler"/>
</toolChain>
<toolChain
id="TopTC.toolchain.release"
name="TopTC Release Toolchain"
isAbstract="true"
superClass="TopTC.toolchain.base">
<tool
id="TopTC.c.compiler.release"
superClass="cdt.managedbuild.tool.gnu.c.compiler"
command="$(CC)">
<option
id="TopTC.c.compiler.release.option.optimization.level"
superClass="gnu.c.compiler.option.optimization.level"
defaultValue="gnu.c.optimization.level.most"/>
<option
id="TopTC.c.compiler.release.option.debugging.level"
superClass="gnu.c.compiler.option.debugging.level"
defaultValue="gnu.c.debugging.level.none"/>
</tool>
<tool
id="TopTC.tool.cpp.compiler.release"
superClass="cdt.managedbuild.tool.gnu.cpp.compiler"
command="$(CXX)">
<option
id="TopTC.cpp.compiler.release.option.optimization.level"
superClass="gnu.cpp.compiler.option.optimization.level"
defaultValue="gnu.cpp.compiler.optimization.level.most"/>
<option
id="TopTC.cpp.compiler.release.option.debugging.level"
superClass="gnu.cpp.compiler.option.debugging.level"
defaultValue="gnu.cpp.compiler.debugging.level.none"/>
</tool>
</toolChain>
<toolChain
id="TopTC.toolchain.debug"
name="TopTC Debug Toolchain"
isAbstract="true"
superClass="TopTC.toolchain.base">
<tool
id="TopTC.c.compiler.debug"
superClass="cdt.managedbuild.tool.gnu.c.compiler"
command="$(CC)">
<option
id="TopTC.c.compiler.debug.option.optimization.level"
superClass="gnu.c.compiler.option.optimization.level"
defaultValue="gnu.c.optimization.level.none"/>
<option
id="TopTC.c.compiler.debug.option.debugging.level"
superClass="gnu.c.compiler.option.debugging.level"
defaultValue="gnu.c.debugging.level.max"/>
</tool>
<tool
id="TopTC.cpp.compiler.debug"
superClass="cdt.managedbuild.tool.gnu.cpp.compiler"
command="$(CXX)">
<option
id="TopTC.cpp.compiler.debug.option.optimization.level"
superClass="gnu.cpp.compiler.option.optimization.level"
defaultValue="gnu.cpp.compiler.optimization.level.none"/>
<option
id="TopTC.cpp.compiler.debug.option.debugging.level"
superClass="gnu.cpp.compiler.option.debugging.level"
defaultValue="gnu.cpp.compiler.debugging.level.max"/>
</tool>
</toolChain>
<projectType
isAbstract="false"
isTest="true"
name="TopTC exe"
id="TopTC.target.exe">
<configuration
id="TopTC.config.exe.debug"
name="Debug"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
cleanCommand="rm -rf">
<toolChain
id="TopTC.toolchain.exe.debug"
superClass="TopTC.toolchain.debug">
<tool
id="TopTC..c.linker.exe.debug"
superClass="cdt.managedbuild.tool.gnu.c.linker"
command="$(CC)"/>
<tool
id="TopTC.cpp.linker.exe.debug"
superClass="cdt.managedbuild.tool.gnu.cpp.linker"
command="$(CXX)"/>
</toolChain>
</configuration>
<configuration
id="TopTC.config.exe.release"
name="Release"
errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
cleanCommand="rm -rf">
<toolChain
id="TopTC.toolchain.exe.release"
superClass="TopTC.toolchain.release">
<tool
id="TopTC..c.linker.exe.release"
superClass="cdt.managedbuild.tool.gnu.c.linker"
command="$(CC)"/>
<tool
id="TopTC..cpp.linker.exe.release"
superClass="cdt.managedbuild.tool.gnu.cpp.linker"
command="$(CXX)"/>
</toolChain>
</configuration>
</projectType>
</extension> </extension>
</plugin> </plugin>

View file

@ -18,6 +18,7 @@ package org.eclipse.cdt.managedbuilder.core.tests;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -26,11 +27,15 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput; import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
import org.eclipse.cdt.managedbuilder.core.IInputType; import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IOutputType; import org.eclipse.cdt.managedbuilder.core.IOutputType;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration; import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager; import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager;
import org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin; import org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin;
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper; import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
@ -71,18 +76,19 @@ public class ManagedProject30MakefileTests extends TestCase {
suite.addTest(new ManagedProject30MakefileTests("testResourceCustomBuildStep")); suite.addTest(new ManagedProject30MakefileTests("testResourceCustomBuildStep"));
suite.addTest(new ManagedProject30MakefileTests("test30_1")); suite.addTest(new ManagedProject30MakefileTests("test30_1"));
suite.addTest(new ManagedProject30MakefileTests("test30_2")); suite.addTest(new ManagedProject30MakefileTests("test30_2"));
suite.addTest(new ManagedProject30MakefileTests("testTopTC"));
return suite; return suite;
} }
private IProject[] createProject(String projName, IPath location, String projectTypeId, boolean containsZip){ private IProject[] createProject(String projName, IPath location, String projectTypeId, boolean containsZip){
File testDir = CTestPlugin.getFileInPlugin(new Path("resources/test30Projects/" + projName));
if(testDir == null) {
fail("Test project directory " + testDir.getName() + " is missing.");
return null;
}
ArrayList projectList = null; ArrayList projectList = null;
if (containsZip) { if (containsZip) {
File testDir = CTestPlugin.getFileInPlugin(new Path("resources/test30Projects/" + projName));
if(testDir == null) {
fail("Test project directory " + projName + " is missing.");
return null;
}
File projectZips[] = testDir.listFiles(new FileFilter(){ File projectZips[] = testDir.listFiles(new FileFilter(){
public boolean accept(File pathname){ public boolean accept(File pathname){
if(pathname.isDirectory()) if(pathname.isDirectory())
@ -504,4 +510,36 @@ public class ManagedProject30MakefileTests extends TestCase {
IProject[] projects = createProjects("test30_2", null, null, true); IProject[] projects = createProjects("test30_2", null, null, true);
buildProjects(projects, makefiles); buildProjects(projects, makefiles);
} }
/* (non-Javadoc)
* tests 3.0 top-level tool-chain definition
*/
public void testTopTC(){
IProject[] projects = createProjects("TopTC", null, "TopTC.target.exe", false);
// There should be only one project.
assertNotNull(projects);
assertEquals(1, projects.length);
IProject project = projects[0];
// Verify a number of other attributes
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
assertNotNull(info);
IManagedProject managedProj = info.getManagedProject();
assertNotNull(managedProj);
IConfiguration[] configs = managedProj.getConfigurations();
assertNotNull(configs);
assertEquals(2, configs.length);
// Make sure that each configuration has a tool-chain with all 5 tools
for (int i=0; i<configs.length; i++) {
IConfiguration config = configs[i];
ToolChain tc = (ToolChain)config.getToolChain();
Iterator iter = tc.getToolList().listIterator();
int j = 0;
while (iter.hasNext()) {
Tool toolChild = (Tool) iter.next();
j++;
}
assertEquals(5, j);
}
buildDegenerativeProjects(projects, null);
}
} }