mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +02:00
Patch for Sean Evoy
Tool inheritance test.
This commit is contained in:
parent
440660c80b
commit
d6a96dd12e
3 changed files with 1589 additions and 1483 deletions
File diff suppressed because it is too large
Load diff
|
@ -895,6 +895,19 @@ public class ManagedBuildTests extends TestCase {
|
||||||
* @param testSubSub
|
* @param testSubSub
|
||||||
*/
|
*/
|
||||||
private void checkSubSubTarget(ITarget target) {
|
private void checkSubSubTarget(ITarget target) {
|
||||||
|
final String indyToolName = "Target Independent Tool";
|
||||||
|
final String indyToolCommand = "RC.EXE";
|
||||||
|
final String indyToolInputExt = "rc";
|
||||||
|
final String indyToolOutputExt = "free";
|
||||||
|
final String indyToolOutFlag = "/fo";
|
||||||
|
final String indyToolHeader = "h";
|
||||||
|
final String indyToolHeaderNot = "j";
|
||||||
|
final String indyCatOne = "Free";
|
||||||
|
final String indyCatTwo = "Chained";
|
||||||
|
final String freeOptName = "String in Free";
|
||||||
|
final String chainedOptName = "Boolean in Chained";
|
||||||
|
final String freeOptValue = "Live free or die";
|
||||||
|
|
||||||
// Check the inherited clean command
|
// Check the inherited clean command
|
||||||
assertEquals("rm -yourworld", target.getCleanCommand());
|
assertEquals("rm -yourworld", target.getCleanCommand());
|
||||||
// Check that the make command is overridden from parent
|
// Check that the make command is overridden from parent
|
||||||
|
@ -904,6 +917,53 @@ public class ManagedBuildTests extends TestCase {
|
||||||
// Make sure the list is inherited
|
// Make sure the list is inherited
|
||||||
String[] expectedOSList = {"win32","linux","solaris"};
|
String[] expectedOSList = {"win32","linux","solaris"};
|
||||||
assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
|
assertTrue(Arrays.equals(expectedOSList, target.getTargetOSList()));
|
||||||
|
|
||||||
|
// Get the 4 configurations
|
||||||
|
IConfiguration[] configs = target.getConfigurations();
|
||||||
|
assertEquals(4, configs.length);
|
||||||
|
|
||||||
|
// Check the tools. We should have 3 (1 from each parent and the one referenced).
|
||||||
|
ITool[] tools = target.getTools();
|
||||||
|
assertEquals(3, tools.length);
|
||||||
|
// Make sure we get all the tool settings
|
||||||
|
assertEquals(tools[2].getName(), indyToolName);
|
||||||
|
assertEquals(tools[2].getToolCommand(), indyToolCommand);
|
||||||
|
assertTrue(tools[2].buildsFileType(indyToolInputExt));
|
||||||
|
assertEquals(tools[2].getOutputExtension(indyToolInputExt), indyToolOutputExt);
|
||||||
|
assertEquals(tools[2].getOutputFlag(), indyToolOutFlag);
|
||||||
|
assertTrue(tools[2].isHeaderFile(indyToolHeader));
|
||||||
|
assertFalse(tools[2].isHeaderFile(indyToolHeaderNot));
|
||||||
|
assertEquals(tools[2].getNatureFilter(), ITool.FILTER_BOTH);
|
||||||
|
// Check out the referenced tool and make sure we get all option categories
|
||||||
|
IOptionCategory topCategory = tools[2].getTopOptionCategory();
|
||||||
|
IOptionCategory[] categories = topCategory.getChildCategories();
|
||||||
|
assertEquals(1, categories.length);
|
||||||
|
assertEquals(categories[0].getName(), indyCatOne);
|
||||||
|
IOptionCategory[] subCategories = categories[0].getChildCategories();
|
||||||
|
// Is the chained category a subcategory
|
||||||
|
assertEquals(1, subCategories.length);
|
||||||
|
assertEquals(subCategories[0].getName(), indyCatTwo);
|
||||||
|
// Make sure the option in the top category is correct
|
||||||
|
IOption[] optsInCat = categories[0].getOptions(null);
|
||||||
|
assertEquals(1, optsInCat.length);
|
||||||
|
assertEquals(freeOptName, optsInCat[0].getName());
|
||||||
|
assertEquals(IOption.STRING, optsInCat[0].getValueType());
|
||||||
|
try {
|
||||||
|
assertEquals(freeOptValue, optsInCat[0].getStringValue());
|
||||||
|
} catch (BuildException e1) {
|
||||||
|
fail("Failed getting string value in subsubtarget :" + e1.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do the same for the options in the child cat
|
||||||
|
IOption[] optsInSubCat = subCategories[0].getOptions(null);
|
||||||
|
assertEquals(1, optsInSubCat.length);
|
||||||
|
assertEquals(chainedOptName, optsInSubCat[0].getName());
|
||||||
|
assertEquals(IOption.BOOLEAN, optsInSubCat[0].getValueType());
|
||||||
|
try {
|
||||||
|
assertFalse(optsInSubCat[0].getBooleanValue());
|
||||||
|
} catch (BuildException e) {
|
||||||
|
fail("Failure getting boolean value in subsubtarget: " + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -31,6 +31,40 @@
|
||||||
id="buildTest"
|
id="buildTest"
|
||||||
name="Tools for Build Test"
|
name="Tools for Build Test"
|
||||||
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
|
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
|
||||||
|
<tool
|
||||||
|
natureFilter="both"
|
||||||
|
name="Target Independent Tool"
|
||||||
|
sources="rc"
|
||||||
|
headerExtensions="h"
|
||||||
|
outputFlag="/fo"
|
||||||
|
command="RC.EXE"
|
||||||
|
outputs="free"
|
||||||
|
id="target.independent.tool">
|
||||||
|
<optionCategory
|
||||||
|
owner="target.independent.tool"
|
||||||
|
name="Free"
|
||||||
|
id="indy.cat.free">
|
||||||
|
</optionCategory>
|
||||||
|
<option
|
||||||
|
defaultValue="Live free or die"
|
||||||
|
name="String in Free"
|
||||||
|
category="indy.cat.free"
|
||||||
|
valueType="string"
|
||||||
|
id="org.eclipse.cdt.core.tests.option1">
|
||||||
|
</option>
|
||||||
|
<optionCategory
|
||||||
|
owner="indy.cat.free"
|
||||||
|
name="Chained"
|
||||||
|
id="indy.cat.chained">
|
||||||
|
</optionCategory>
|
||||||
|
<option
|
||||||
|
defaultValue="false"
|
||||||
|
name="Boolean in Chained"
|
||||||
|
category="indy.cat.chained"
|
||||||
|
valueType="boolean"
|
||||||
|
id="org.eclipse.cdt.core.tests.option2">
|
||||||
|
</option>
|
||||||
|
</tool>
|
||||||
<target
|
<target
|
||||||
name="Test Root"
|
name="Test Root"
|
||||||
id="test.root"
|
id="test.root"
|
||||||
|
@ -233,6 +267,9 @@
|
||||||
defaultExtension="tss"
|
defaultExtension="tss"
|
||||||
makeCommand="nmake"
|
makeCommand="nmake"
|
||||||
id="test.sub.sub">
|
id="test.sub.sub">
|
||||||
|
<toolReference
|
||||||
|
id="target.independent.tool">
|
||||||
|
</toolReference>
|
||||||
</target>
|
</target>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
@ -244,22 +281,23 @@
|
||||||
</run>
|
</run>
|
||||||
</application>
|
</application>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="TestProject"
|
id="TestProject"
|
||||||
name="C/C++ Test Project"
|
name="C/C++ Test Project"
|
||||||
point="org.eclipse.cdt.core.CProject">
|
point="org.eclipse.cdt.core.CProject">
|
||||||
<cproject
|
<cproject
|
||||||
class="org.eclipse.cdt.testplugin.TestProject">
|
class="org.eclipse.cdt.testplugin.TestProject">
|
||||||
</cproject>
|
</cproject>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="TestScanner"
|
id="TestScanner"
|
||||||
name="C/C++ Test Scanner"
|
name="C/C++ Test Scanner"
|
||||||
point="org.eclipse.cdt.core.ScannerInfoProvider">
|
point="org.eclipse.cdt.core.ScannerInfoProvider">
|
||||||
<cextension>
|
<cextension>
|
||||||
<run
|
<run
|
||||||
class="org.eclipse.cdt.testplugin.TestScannerProvider">
|
class="org.eclipse.cdt.testplugin.TestScannerProvider">
|
||||||
</run>
|
</run>
|
||||||
</cextension>
|
</cextension>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
Loading…
Add table
Reference in a new issue