mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
Fix JUnit tests.
This commit is contained in:
parent
5cf3cf47c2
commit
4bec9af75d
4 changed files with 21 additions and 14 deletions
|
@ -15,7 +15,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||||
import org.eclipse.cdt.core.index.IIndexManager;
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
|
@ -64,15 +63,4 @@ public class IndexTestBase extends BaseTestCase {
|
||||||
return TestSourceReader.getContentsForTest(
|
return TestSourceReader.getContentsForTest(
|
||||||
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
CTestPlugin.getDefault().getBundle(), "parser", getClass(), getName(), blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void waitForIndexer(ICProject project) throws InterruptedException {
|
|
||||||
final IIndexManager indexManager = CCorePlugin.getIndexManager();
|
|
||||||
assertTrue(indexManager.joinIndexer(INDEXER_WAIT_TIME, NPM));
|
|
||||||
long waitms= 1;
|
|
||||||
while (waitms < 2000 && indexManager.isIndexerSetupPostponed(project)) {
|
|
||||||
Thread.sleep(waitms);
|
|
||||||
waitms *= 2;
|
|
||||||
}
|
|
||||||
assertTrue(indexManager.joinIndexer(INDEXER_WAIT_TIME, NPM));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,12 @@ import junit.framework.TestSuite;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
import org.eclipse.cdt.core.model.ElementChangedEvent;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IElementChangedListener;
|
import org.eclipse.cdt.core.model.IElementChangedListener;
|
||||||
import org.eclipse.cdt.core.testplugin.TestScannerProvider;
|
import org.eclipse.cdt.core.testplugin.TestScannerProvider;
|
||||||
|
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTNameBase;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMManager;
|
||||||
import org.eclipse.core.resources.IResourceStatus;
|
import org.eclipse.core.resources.IResourceStatus;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.ILogListener;
|
import org.eclipse.core.runtime.ILogListener;
|
||||||
|
@ -85,8 +88,8 @@ public class BaseTestCase extends TestCase {
|
||||||
Class superClass= clazz;
|
Class superClass= clazz;
|
||||||
while (Test.class.isAssignableFrom(superClass) && !TestCase.class.equals(superClass)) {
|
while (Test.class.isAssignableFrom(superClass) && !TestCase.class.equals(superClass)) {
|
||||||
Method[] methods= superClass.getDeclaredMethods();
|
Method[] methods= superClass.getDeclaredMethods();
|
||||||
for (int i= 0; i < methods.length; i++) {
|
for (Method method : methods) {
|
||||||
addFailingMethod(suite, methods[i], names, clazz, prefix);
|
addFailingMethod(suite, method, names, clazz, prefix);
|
||||||
}
|
}
|
||||||
superClass= superClass.getSuperclass();
|
superClass= superClass.getSuperclass();
|
||||||
}
|
}
|
||||||
|
@ -275,4 +278,15 @@ public class BaseTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void waitForIndexer(ICProject project) throws InterruptedException {
|
||||||
|
final PDOMManager indexManager = CCoreInternals.getPDOMManager();
|
||||||
|
assertTrue(indexManager.joinIndexer(10000, NPM));
|
||||||
|
long waitms= 1;
|
||||||
|
while (waitms < 2000 && !indexManager.isProjectRegistered(project)) {
|
||||||
|
Thread.sleep(waitms);
|
||||||
|
waitms *= 2;
|
||||||
|
}
|
||||||
|
assertTrue(indexManager.joinIndexer(10000, NPM));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -203,6 +203,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Job startup() {
|
public Job startup() {
|
||||||
|
fInShutDown= false;
|
||||||
Job postStartupJob= new Job(CCorePlugin.getResourceString("CCorePlugin.startupJob")) { //$NON-NLS-1$
|
Job postStartupJob= new Job(CCorePlugin.getResourceString("CCorePlugin.startupJob")) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
|
|
@ -96,6 +96,10 @@ public class WaitForRefreshJobs extends IndexerSetupParticipant {
|
||||||
for (Job j : refreshJobs) {
|
for (Job j : refreshJobs) {
|
||||||
if (fRefreshJobs.add(j)) {
|
if (fRefreshJobs.add(j)) {
|
||||||
j.addJobChangeListener(fJobListener);
|
j.addJobChangeListener(fJobListener);
|
||||||
|
// In case the job has finished in the meantime
|
||||||
|
if (j.getState() == Job.NONE) {
|
||||||
|
fRefreshJobs.remove(j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue