Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Updated tests for C14


Hi all,
I committed the work to make it possible to inherit a tool defined outside of a target via a tool reference. Unfortunately, I still have to send the test part to the patch list to be committed. Could someone do that for me?

Tested on Linux and Win32.

Thanks,

Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
Index: ChangeLog
===================================================================
retrieving revision 1.198
diff -u -r1.198 ChangeLog
--- ChangeLog	26 Feb 2004 17:31:45 -0000	1.198
+++ ChangeLog	26 Feb 2004 20:50:58 -0000
@@ -1,3 +1,11 @@
+2004-02-26
+	Work to test the ability to inherit a tool description via a tool 
+	reference. Updated the testSubSubTarget to check inheritted tool 
+	and updated the plugin manifest to add a tool and add a reference 
+	in the subSubTarget.
+	* plugin.xml
+	* build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
+
 2004-02-26 Alain Magloire
 	Update the cpathtest
 
Index: plugin.xml
===================================================================
retrieving revision 1.23
diff -u -r1.23 plugin.xml
--- plugin.xml	19 Jan 2004 20:02:53 -0000	1.23
+++ plugin.xml	26 Feb 2004 20:50:58 -0000
@@ -31,6 +31,40 @@
          id="buildTest"
          name="Tools for Build Test"
          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
             name="Test Root"
             id="test.root"
@@ -233,6 +267,9 @@
             defaultExtension="tss"
             makeCommand="nmake"
             id="test.sub.sub">
+         <toolReference
+               id="target.independent.tool">
+         </toolReference>
       </target>
    </extension>
    <extension
@@ -244,22 +281,23 @@
          </run>
       </application>
    </extension>
-	<extension
+   <extension
          id="TestProject"
          name="C/C++ Test Project"
          point="org.eclipse.cdt.core.CProject">
       <cproject
             class="org.eclipse.cdt.testplugin.TestProject">
       </cproject>
-    </extension>
-    <extension
-    	id="TestScanner"
-    	name="C/C++ Test Scanner"
-    	point="org.eclipse.cdt.core.ScannerInfoProvider">
-    	<cextension>
-        	 <run
-            	   class="org.eclipse.cdt.testplugin.TestScannerProvider">
-    	     </run>
-	     </cextension>
-      </extension>
+   </extension>
+   <extension
+         id="TestScanner"
+         name="C/C++ Test Scanner"
+         point="org.eclipse.cdt.core.ScannerInfoProvider">
+      <cextension>
+         <run
+               class="org.eclipse.cdt.testplugin.TestScannerProvider">
+         </run>
+      </cextension>
+   </extension>
+
 </plugin>
Index: build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
===================================================================
retrieving revision 1.18
diff -u -r1.18 ManagedBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java	17 Feb 2004 15:31:25 -0000	1.18
+++ build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java	26 Feb 2004 20:50:59 -0000
@@ -895,6 +895,19 @@
 	 * @param testSubSub
 	 */
 	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
 		assertEquals("rm -yourworld", target.getCleanCommand());
 		// Check that the make command is overridden from parent
@@ -904,6 +917,53 @@
 		// Make sure the list is inherited
 		String[] expectedOSList = {"win32","linux","solaris"};
 		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());
+		}
 	}
 
 	/*

Back to the top