Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Could someone please commit this update to the JUnit tests for managed build?


On Friday I sent out a patch that updates the JUnit tests for managed build. So far, it does not look like it was applied. I was wondering if someone with commit privileges on that package would please commit this patch for me? Thanks,

Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada

Index: ChangeLog
===================================================================
retrieving revision 1.206
diff -u -r1.206 ChangeLog
--- ChangeLog	12 Mar 2004 15:49:07 -0000	1.206
+++ ChangeLog	15 Mar 2004 15:42:09 -0000
@@ -1,3 +1,9 @@
+2004-03-12 Sean Evoy
+	Commit for Jeremiah Lott. 
+	Allows the managed build system to resolve "forward references" within its 
+	extensions. In practice this is necessary to allow references between 
+	extensions in different plugins.
+
 2004-03-12 Andrew Niefer
 	added CompleteParseASTTest.testBug54639
 
Index: plugin.xml
===================================================================
retrieving revision 1.24
diff -u -r1.24 plugin.xml
--- plugin.xml	27 Feb 2004 15:59:47 -0000	1.24
+++ plugin.xml	15 Mar 2004 15:42:10 -0000
@@ -271,6 +271,56 @@
                id="target.independent.tool">
          </toolReference>
       </target>
+      <target
+            name="Forward Grandchild"
+            parent="test.forward.child.target"
+            binaryParser="org.eclipse.cdt.core.tests.target1"
+            id="test.forward.grandchild.target">
+         <toolReference
+               command="newcommand"
+               id="test.forward.tool">
+         </toolReference>
+      </target>
+      <target
+            isTest="true"
+            osList="win32,solaris,linux"
+            name="Forward Child"
+            binaryParser="org.eclipse.cdt.core.tests.target2"
+            parent="test.forward.parent.target"
+            id="test.forward.child.target">
+         <toolReference
+               id="test.forward.tool">
+            <optionReference
+                  id="test.forward.option">
+            </optionReference>
+         </toolReference>
+      </target>
+      <target
+            isTest="true"
+            name="Forward Parent"
+            binaryParser="org.eclipse.cdt.core.tests.target3"
+            id="test.forward.parent.target">
+         <tool
+               natureFilter="both"
+               name="Forward Parent Tool"
+               id="test.forward.tool">
+            <option
+                  name="Test Forward Option"
+                  category="test.forward.child.category"
+                  id="test.forward.option">
+            </option>
+            <optionCategory
+                  owner="test.forward.parent.category"
+                  name="Forward Child Category"
+                  id="test.forward.child.category">
+            </optionCategory>
+            <optionCategory
+                  owner="test.forward.tool"
+                  name="Forward Parent Category"
+                  id="test.forward.parent.category">
+            </optionCategory>
+         </tool>
+      </target>
    </extension>
    <extension
          id="runTests"
Index: build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java
===================================================================
retrieving revision 1.20
diff -u -r1.20 ManagedBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java	2 Mar 2004 16:10:37 -0000	1.20
+++ build/org/eclipse/cdt/core/build/managed/tests/ManagedBuildTests.java	15 Mar 2004 15:42:11 -0000
@@ -41,6 +41,7 @@
 import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
 import org.eclipse.cdt.managedbuilder.core.ITarget;
 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.ManagedCProjectNature;
 import org.eclipse.cdt.managedbuilder.internal.core.OptionReference;
@@ -101,6 +102,9 @@
 		ITarget testRoot = null;
 		ITarget testSub = null;
 		ITarget testSubSub = null;
+		ITarget testForwardChild = null;
+		ITarget testForwardParent = null;
+		ITarget testForwardGrandchild = null;
 		
 		// Note secret null parameter which means just extensions
 		ITarget[] targets = ManagedBuildManager.getDefinedTargets(null);
@@ -117,8 +121,20 @@
 			} else if (target.getName().equals("Test Sub Sub")) {
 				testSubSub = target;
 				checkSubSubTarget(testSubSub);
+			} else if (target.getName().equals("Forward Child")) {
+				testForwardChild = target;
+			} else if (target.getName().equals("Forward Parent")) {
+				testForwardParent = target;
+			} else if (target.getName().equals("Forward Grandchild")) {
+				testForwardGrandchild = target;
 			}
 		}
+		// check that the forward references are properly resolved.
+		assertNotNull(testForwardChild);
+		assertNotNull(testForwardParent);
+		assertNotNull(testForwardGrandchild);
+		checkForwardTargets(testForwardParent, testForwardChild, testForwardGrandchild);
+		
 		// All these targets are defines in the plugin files, so none
 		// of them should be null at this point
 		assertNotNull(testRoot);
@@ -208,7 +224,7 @@
 		IConfiguration[] configs = newTarget.getConfigurations();
 		assertEquals(4, configs.length);
 		IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
-		buildInfo.setDefaultConfiguration(newTarget.getConfiguration(configs[3].getId()));
+		buildInfo.setDefaultConfiguration(newTarget.getConfiguration(configs[0].getId()));
 
 		// Use the plugin mechanism to discover the supplier of the path information
 		IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ScannerInfoProvider");
@@ -1063,13 +1079,56 @@
 		// Get the configs for this target; it should inherit all the configs defined for the parent
 		IConfiguration[] configs = target.getConfigurations();
 		assertEquals(4, configs.length);
-		IConfiguration rootConfig = configs[0];
-		assertEquals("Root Config", rootConfig.getName());
-		assertEquals("Root Override Config", configs[1].getName());
-		assertEquals("Complete Override Config", configs[2].getName());
-		assertEquals("Sub Config", configs[3].getName());
+		assertEquals("Sub Config", configs[0].getName());
+		assertEquals("Root Config", configs[1].getName());
+		assertEquals("Root Override Config", configs[2].getName());
+		assertEquals("Complete Override Config", configs[3].getName());
 	}
 
+	private void checkForwardTargets(ITarget parent, ITarget child, ITarget grandchild) {
+		// check that the target parent reference has been resolved.
+		assertEquals(parent, child.getParent());
+		assertEquals(child, grandchild.getParent());
+		
+		// get the parent tool
+		ITool[] parentTools = parent.getTools();
+		assertEquals(1, parentTools.length);
+		ITool parentTool = parentTools[0];
+		assertNotNull(parentTool);
+
+		// check option categories
+		IOption option = parentTool.getOption("test.forward.option");
+		assertNotNull(option);
+		IOptionCategory[] firstLevel = parentTool.getTopOptionCategory()
+			.getChildCategories();
+		assertEquals(1, firstLevel.length);
+		IOptionCategory[] secondLevel = firstLevel[0].getChildCategories();
+		assertEquals(1, secondLevel.length);
+		assertEquals(0, secondLevel[0].getChildCategories().length);
+		IOption[] optList = secondLevel[0].getOptions(null);
+		assertEquals(1, optList.length);
+		assertEquals(option, optList[0]);
+		
+		// get the tool reference from the child
+		ITool[] childTools = child.getTools();
+		assertEquals(2, childTools.length);
+		ToolReference childToolRef = (ToolReference)childTools[1];
+		assertEquals(parentTool, childToolRef.getTool());
+		
+		// get and check the option reference
+		OptionReference optRef = (OptionReference)
+			childToolRef.getOption("test.forward.option");
+		assertEquals(option, optRef.getOption());
+		
+		// get the tool reference from the grandchild
+		ITool[] grandTools = grandchild.getTools();
+		assertEquals(3, grandTools.length);
+		ToolReference grandToolRef = (ToolReference)grandTools[2];
+		assertEquals(parentTool, grandToolRef.getTool());
+		
+	}
+	
 	/**
 	 * Remove all the project information associated with the project used during test.
 	 */

Back to the top