1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

managed build tests from Sean Evoy

This commit is contained in:
Andrew Niefer 2004-03-16 22:29:55 +00:00
parent 4c9e632ce6
commit 49e276d0ac
3 changed files with 67 additions and 52 deletions

View file

@ -1,3 +1,12 @@
2004-03-12 Sean Evoy
Corrected a target definition in the plugin manifest that was flagged
as release when it should have been flagged as test. Also updated the
tests to save the build information after changes that make the build
information dirty.
* plugin.xml
* build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
2004-03-16 Alain Magloire 2004-03-16 Alain Magloire
Test from Thomas Fletcher for the Error Parser Test from Thomas Fletcher for the Error Parser

View file

@ -41,7 +41,6 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory; import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITarget; import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature; import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.core.OptionReference; import org.eclipse.cdt.managedbuilder.internal.core.OptionReference;
@ -176,6 +175,8 @@ public class ManagedBuildTests extends TestCase {
targets[0].resetMakeCommand(); targets[0].resetMakeCommand();
assertFalse(targets[0].hasOverridenMakeCommand()); assertFalse(targets[0].hasOverridenMakeCommand());
assertEquals(oldMakeCmd, targets[0].getMakeCommand()); assertEquals(oldMakeCmd, targets[0].getMakeCommand());
ManagedBuildManager.saveBuildInfo(project, false);
} }
@ -219,13 +220,15 @@ public class ManagedBuildTests extends TestCase {
for (int i = 0; i < baseConfigs.length; ++i) { for (int i = 0; i < baseConfigs.length; ++i) {
newTarget.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i); newTarget.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
} }
// Change the default configuration to the sub config // Change the default configuration to the sub config
IConfiguration[] configs = newTarget.getConfigurations(); IConfiguration[] configs = newTarget.getConfigurations();
assertEquals(4, configs.length); assertEquals(4, configs.length);
IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
buildInfo.setDefaultConfiguration(newTarget.getConfiguration(configs[0].getId())); buildInfo.setDefaultConfiguration(newTarget.getConfiguration(configs[0].getId()));
// Save the build info
ManagedBuildManager.saveBuildInfo(project, false);
// Use the plugin mechanism to discover the supplier of the path information // Use the plugin mechanism to discover the supplier of the path information
IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ScannerInfoProvider"); IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ScannerInfoProvider");
if (extensionPoint == null) { if (extensionPoint == null) {
@ -315,7 +318,7 @@ public class ManagedBuildTests extends TestCase {
// Open the test project // Open the test project
IProject project = createProject(projectName); IProject project = createProject(projectName);
// Make sure there is one and only one target with 2 configs // Make sure there is one and only one target with 3 configs
ITarget[] definedTargets = ManagedBuildManager.getTargets(project); ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
assertEquals(1, definedTargets.length); assertEquals(1, definedTargets.length);
ITarget rootTarget = definedTargets[0]; ITarget rootTarget = definedTargets[0];
@ -359,7 +362,7 @@ public class ManagedBuildTests extends TestCase {
ManagedBuildManager.setOption(newConfig, options[1], enumVal); ManagedBuildManager.setOption(newConfig, options[1], enumVal);
// Save, close, reopen and test again // Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project); ManagedBuildManager.saveBuildInfo(project, false);
project.close(null); project.close(null);
ManagedBuildManager.removeBuildInfo(project); ManagedBuildManager.removeBuildInfo(project);
project.open(null); project.open(null);
@ -378,6 +381,7 @@ public class ManagedBuildTests extends TestCase {
assertEquals(3, definedConfigs.length); assertEquals(3, definedConfigs.length);
assertEquals(definedConfigs[0].getName(), rootName); assertEquals(definedConfigs[0].getName(), rootName);
assertEquals(definedConfigs[1].getName(), overrideName); assertEquals(definedConfigs[1].getName(), overrideName);
ManagedBuildManager.saveBuildInfo(project, false);
} }
public void testConfigurationReset() { public void testConfigurationReset() {
@ -406,6 +410,7 @@ public class ManagedBuildTests extends TestCase {
// Reset the config and retest // Reset the config and retest
ManagedBuildManager.resetConfiguration(project, defaultConfig); ManagedBuildManager.resetConfiguration(project, defaultConfig);
ManagedBuildManager.saveBuildInfo(project, false);
try { try {
checkRootTarget(defaultTarget); checkRootTarget(defaultTarget);
} catch (BuildException e2) { } catch (BuildException e2) {
@ -474,7 +479,7 @@ public class ManagedBuildTests extends TestCase {
assertEquals("z", options[0].getStringValue()); assertEquals("z", options[0].getStringValue());
// Save, close, reopen and test again // Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project); ManagedBuildManager.saveBuildInfo(project, true);
try { try {
project.close(null); project.close(null);
} catch (CoreException e) { } catch (CoreException e) {
@ -1202,7 +1207,7 @@ public class ManagedBuildTests extends TestCase {
rootTarget.setArtifactName(name); rootTarget.setArtifactName(name);
// Save, close, reopen and test again // Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project); ManagedBuildManager.saveBuildInfo(project, false);
project.close(null); project.close(null);
ManagedBuildManager.removeBuildInfo(project); ManagedBuildManager.removeBuildInfo(project);
project.open(null); project.open(null);

View file

@ -33,12 +33,12 @@
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo"> point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
<tool <tool
natureFilter="both" natureFilter="both"
name="Target Independent Tool"
sources="rc" sources="rc"
name="Target Independent Tool"
headerExtensions="h" headerExtensions="h"
outputFlag="/fo" outputFlag="/fo"
command="RC.EXE"
outputs="free" outputs="free"
command="RC.EXE"
id="target.independent.tool"> id="target.independent.tool">
<optionCategory <optionCategory
owner="target.independent.tool" owner="target.independent.tool"
@ -49,8 +49,8 @@
defaultValue="Live free or die" defaultValue="Live free or die"
name="String in Free" name="String in Free"
category="indy.cat.free" category="indy.cat.free"
valueType="string" id="org.eclipse.cdt.core.tests.option1"
id="org.eclipse.cdt.core.tests.option1"> valueType="string">
</option> </option>
<optionCategory <optionCategory
owner="indy.cat.free" owner="indy.cat.free"
@ -61,8 +61,8 @@
defaultValue="false" defaultValue="false"
name="Boolean in Chained" name="Boolean in Chained"
category="indy.cat.chained" category="indy.cat.chained"
valueType="boolean" id="org.eclipse.cdt.core.tests.option2"
id="org.eclipse.cdt.core.tests.option2"> valueType="boolean">
</option> </option>
</tool> </tool>
<target <target
@ -73,17 +73,17 @@
defaultExtension="toor" defaultExtension="toor"
isAbstract="false" isAbstract="false"
makeCommand="make" makeCommand="make"
binaryParser="org.eclipse.cdt.core.PE"
makeFlags="-k" makeFlags="-k"
binaryParser="org.eclipse.cdt.core.PE"
osList="win32"> osList="win32">
<tool <tool
natureFilter="cnature" natureFilter="cnature"
sources="foo,bar"
name="Root Tool" name="Root Tool"
sources="foo,bar"
headerExtensions="baz" headerExtensions="baz"
outputFlag="-r" outputFlag="-r"
outputs="toor"
command="doIt" command="doIt"
outputs="toor"
id="root.tool"> id="root.tool">
<optionCategory <optionCategory
owner="root.tool" owner="root.tool"
@ -93,39 +93,39 @@
<option <option
name="List Option in Top" name="List Option in Top"
command="-L" command="-L"
valueType="stringList" id="list.option"
id="list.option"> valueType="stringList">
<listOptionValue <listOptionValue
value="a"> value="a">
</listOptionValue> </listOptionValue>
<listOptionValue <listOptionValue
value="b" builtIn="false"
builtIn="false"> value="b">
</listOptionValue> </listOptionValue>
<listOptionValue <listOptionValue
value="c" builtIn="true"
builtIn="true"> value="c">
</listOptionValue> </listOptionValue>
</option> </option>
<option <option
defaultValue="false" defaultValue="false"
name="Boolean Option in Top" name="Boolean Option in Top"
command="-b" command="-b"
valueType="boolean" id="boolean.option"
id="boolean.option"> valueType="boolean">
</option> </option>
<option <option
defaultValue="x" defaultValue="x"
name="String Option in Category" name="String Option in Category"
category="category" category="category"
valueType="string" id="string.option"
id="string.option"> valueType="string">
</option> </option>
<option <option
name="Enumerated Option in Category" name="Enumerated Option in Category"
category="category" category="category"
valueType="enumerated" id="enumerated.option"
id="enumerated.option"> valueType="enumerated">
<enumeratedOptionValue <enumeratedOptionValue
name="Default Enum" name="Default Enum"
isDefault="true" isDefault="true"
@ -198,17 +198,17 @@
</configuration> </configuration>
<tool <tool
natureFilter="both" natureFilter="both"
sources="yarf"
name="Sub Tool" name="Sub Tool"
sources="yarf"
headerExtensions="arf,barf" headerExtensions="arf,barf"
outputs="bus"
outputPrefix="lib" outputPrefix="lib"
outputs="bus"
id="tool.sub"> id="tool.sub">
<option <option
name="Include Paths" name="Include Paths"
command="-I" command="-I"
valueType="includePath" id="sub.tool.opt.inc.paths"
id="sub.tool.opt.inc.paths"> valueType="includePath">
<listOptionValue <listOptionValue
value="/usr/include"> value="/usr/include">
</listOptionValue> </listOptionValue>
@ -216,45 +216,45 @@
value="/opt/gnome/include"> value="/opt/gnome/include">
</listOptionValue> </listOptionValue>
<listOptionValue <listOptionValue
value="/usr/gnu/include" builtIn="true"
builtIn="true"> value="/usr/gnu/include">
</listOptionValue> </listOptionValue>
</option> </option>
<option <option
name="Defined Symbols" name="Defined Symbols"
command="-D" command="-D"
valueType="definedSymbols" id="sub.tool.opt.def.symbols"
id="sub.tool.opt.def.symbols"> valueType="definedSymbols">
<listOptionValue <listOptionValue
value="BUILTIN" builtIn="true"
builtIn="true"> value="BUILTIN">
</listOptionValue> </listOptionValue>
</option> </option>
<option <option
name="More Includes" name="More Includes"
command="-I" command="-I"
valueType="includePath" id="sub.tool.opts.inc.paths.more"
id="sub.tool.opts.inc.paths.more"> valueType="includePath">
<listOptionValue <listOptionValue
value="C:\home\tester/include" builtIn="false"
builtIn="false"> value="C:\home\tester/include">
</listOptionValue> </listOptionValue>
<listOptionValue <listOptionValue
value="&quot;../includes&quot;" builtIn="false"
builtIn="false"> value="&quot;../includes&quot;">
</listOptionValue> </listOptionValue>
</option> </option>
<option <option
name="User Objects" name="User Objects"
valueType="userObjs" id="sub.tool.opt.objs"
id="sub.tool.opt.objs"> valueType="userObjs">
<listOptionValue <listOptionValue
value="obj1.o" builtIn="false"
builtIn="false"> value="obj1.o">
</listOptionValue> </listOptionValue>
<listOptionValue <listOptionValue
value="obj2.o" builtIn="false"
builtIn="false"> value="obj2.o">
</listOptionValue> </listOptionValue>
</option> </option>
</tool> </tool>
@ -262,8 +262,8 @@
<target <target
isTest="true" isTest="true"
name="Test Sub Sub" name="Test Sub Sub"
parent="test.sub"
binaryParser="org.eclipse.cdt.core.ELF" binaryParser="org.eclipse.cdt.core.ELF"
parent="test.sub"
defaultExtension="tss" defaultExtension="tss"
makeCommand="nmake" makeCommand="nmake"
id="test.sub.sub"> id="test.sub.sub">
@ -272,9 +272,10 @@
</toolReference> </toolReference>
</target> </target>
<target <target
isTest="true"
name="Forward Grandchild" name="Forward Grandchild"
parent="test.forward.child.target"
binaryParser="org.eclipse.cdt.core.tests.target1" binaryParser="org.eclipse.cdt.core.tests.target1"
parent="test.forward.child.target"
id="test.forward.grandchild.target"> id="test.forward.grandchild.target">
<toolReference <toolReference
command="newcommand" command="newcommand"
@ -285,8 +286,8 @@
isTest="true" isTest="true"
osList="win32,solaris,linux" osList="win32,solaris,linux"
name="Forward Child" name="Forward Child"
binaryParser="org.eclipse.cdt.core.tests.target2"
parent="test.forward.parent.target" parent="test.forward.parent.target"
binaryParser="org.eclipse.cdt.core.tests.target2"
id="test.forward.child.target"> id="test.forward.child.target">
<toolReference <toolReference
id="test.forward.tool"> id="test.forward.tool">