From 934dd607b6dcd3ff8f85f424e8c5121de23300e8 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 3 Oct 2008 12:25:31 +0000 Subject: [PATCH] Further test improvement by James Blackburn, bug 196118 --- .../cdt/core/cdescriptor/tests/CDescriptorTests.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/cdescriptor/tests/CDescriptorTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/cdescriptor/tests/CDescriptorTests.java index b6d544e3af8..126e0da9936 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/cdescriptor/tests/CDescriptorTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/cdescriptor/tests/CDescriptorTests.java @@ -182,7 +182,7 @@ public class CDescriptorTests extends TestCase { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=193503 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=196118 public void testConcurrentDescriptorCreation2() throws Exception { - int numElements = 0; + int lastLength = 0; for (int i=0; i<200; ++i) { final int indexi = i; PDOMManager pdomMgr= (PDOMManager)CCorePlugin.getIndexManager(); @@ -191,7 +191,8 @@ public class CDescriptorTests extends TestCase { fProject.open(null); pdomMgr.startup().schedule(); ICDescriptor desc= CCorePlugin.getDefault().getCProjectDescription(fProject, true); - int lengthBefore= countChildElements(desc.getProjectData("testElement")); + if (lastLength == 0) + lastLength = countChildElements(desc.getProjectData("testElement")); final Throwable[] exception= new Throwable[10]; Thread[] threads= new Thread[10]; for (int j = 0; j < 10; j++) { @@ -235,7 +236,8 @@ public class CDescriptorTests extends TestCase { } desc= CCorePlugin.getDefault().getCProjectDescription(fProject, true); int lengthAfter = countChildElements(desc.getProjectData("testElement")); - assertEquals("Iteration count: " + i, threads.length, lengthAfter - lengthBefore); + lastLength += threads.length; // Update last lengths to what we expect + assertEquals("Iteration count: " + i, lastLength, lengthAfter); fLastEvent = null; }