mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
238842: cyclic includes causes infinite loop in PDOMManager.areSynchronized
This commit is contained in:
parent
eb8598c083
commit
0a836d8009
7 changed files with 109 additions and 104 deletions
|
@ -54,21 +54,27 @@ import org.osgi.framework.Bundle;
|
||||||
* Tests the GeneratePDOMApplication
|
* Tests the GeneratePDOMApplication
|
||||||
*/
|
*/
|
||||||
public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
|
private static final URI BASEURI= URI.create("file:///base/"); // unimportant what the value is
|
||||||
private static final String SDK_VERSION = "com.acme.sdk.version";
|
private static final String SDK_VERSION = "com.acme.sdk.version";
|
||||||
private static final String ACME_SDK_ID= "com.acme.sdk.4.0.1";
|
private static final String ACME_SDK_ID= "com.acme.sdk.4.0.1";
|
||||||
|
private static final String LOC_TSTPRJ1= "resources/pdomtests/generatePDOMTests/project1";
|
||||||
|
private static final String LOC_TSTPRJ2= "resources/pdomtests/generatePDOMTests/project2";
|
||||||
|
private static final String LOC_TSTPRJ3= "resources/pdomtests/generatePDOMTests/project3";
|
||||||
|
private static final String LOC_CYCINC1= "resources/pdomtests/generatePDOMTests/cyclicIncludes1";
|
||||||
|
private static final String LOC_CYCINC2= "resources/pdomtests/generatePDOMTests/cyclicIncludes2";
|
||||||
|
|
||||||
private static List toDeleteOnTearDown= new ArrayList();
|
private static List toDeleteOnTearDown= new ArrayList();
|
||||||
private final static String locProject1= "resources/pdomtests/generatePDOMTests/project1";
|
|
||||||
private final static String locProject2= "resources/pdomtests/generatePDOMTests/project2";
|
|
||||||
private final static String locProject3= "resources/pdomtests/generatePDOMTests/project3";
|
|
||||||
private URI baseURI;
|
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
return suite(GeneratePDOMApplicationTest.class);
|
return suite(GeneratePDOMApplicationTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected File target; // the location of the generated PDOM
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
toDeleteOnTearDown.clear();
|
toDeleteOnTearDown.clear();
|
||||||
baseURI= new URI("file:///base/"); // unimportant what the value is
|
target= File.createTempFile("test", "pdom");
|
||||||
|
target.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
@ -80,7 +86,6 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
|
|
||||||
public void testBrokenExportProjectProvider1() throws Exception {
|
public void testBrokenExportProjectProvider1() throws Exception {
|
||||||
setExpectedNumberOfLoggedNonOKStatusObjects(1); // IExportProjectProvider implementation returns null for createProject
|
setExpectedNumberOfLoggedNonOKStatusObjects(1); // IExportProjectProvider implementation returns null for createProject
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
doGenerate(new String[] {
|
doGenerate(new String[] {
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider1.class.getName()
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider1.class.getName()
|
||||||
|
@ -89,7 +94,6 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
|
|
||||||
public void testBrokenExportProjectProvider2() throws Exception {
|
public void testBrokenExportProjectProvider2() throws Exception {
|
||||||
setExpectedNumberOfLoggedNonOKStatusObjects(1); // IExportProjectProvider implementation returns null for getLocationConverter
|
setExpectedNumberOfLoggedNonOKStatusObjects(1); // IExportProjectProvider implementation returns null for getLocationConverter
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
doGenerate(new String[] {
|
doGenerate(new String[] {
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider2.class.getName()
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider2.class.getName()
|
||||||
|
@ -97,13 +101,12 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleExportProjectProvider1() throws Exception {
|
public void testSimpleExportProjectProvider1() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
doGenerate(new String[] {
|
doGenerate(new String[] {
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider3.class.getName()
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider3.class.getName()
|
||||||
});
|
});
|
||||||
assertTrue(target.exists());
|
assertTrue(target.exists());
|
||||||
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(baseURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(BASEURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
verifyProject1Content(wpdom);
|
verifyProject1Content(wpdom);
|
||||||
|
|
||||||
String fid;
|
String fid;
|
||||||
|
@ -118,13 +121,12 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleExportProjectProvider2() throws Exception {
|
public void testSimpleExportProjectProvider2() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
doGenerate(new String[] {
|
doGenerate(new String[] {
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider4.class.getName()
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider4.class.getName()
|
||||||
});
|
});
|
||||||
assertTrue(target.exists());
|
assertTrue(target.exists());
|
||||||
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(baseURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(BASEURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
verifyProject1Content(wpdom);
|
verifyProject1Content(wpdom);
|
||||||
|
|
||||||
wpdom.acquireReadLock();
|
wpdom.acquireReadLock();
|
||||||
|
@ -141,19 +143,16 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalExportProjectProvider_BadCmdLine1() throws Exception {
|
public void testExternalExportProjectProvider_BadCmdLine1() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
|
|
||||||
setExpectedNumberOfLoggedNonOKStatusObjects(1); // Expected failure: -source must be specified
|
setExpectedNumberOfLoggedNonOKStatusObjects(1); // Expected failure: -source must be specified
|
||||||
|
|
||||||
doGenerate(new String[] {
|
doGenerate(new String[] {
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName()
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName()
|
||||||
});
|
});
|
||||||
assertTrue(target.exists());
|
assertFalse(target.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalExportProjectProvider_BadCmdLine2() throws Exception {
|
public void testExternalExportProjectProvider_BadCmdLine2() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
TestProjectProvider4 tpp4= new TestProjectProvider4();
|
TestProjectProvider4 tpp4= new TestProjectProvider4();
|
||||||
ICProject cproject= tpp4.createProject();
|
ICProject cproject= tpp4.createProject();
|
||||||
|
|
||||||
|
@ -164,11 +163,10 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName(),
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName(),
|
||||||
ExternalExportProjectProvider.OPT_SOURCE, cproject.getProject().getLocation().toFile().getAbsolutePath()
|
ExternalExportProjectProvider.OPT_SOURCE, cproject.getProject().getLocation().toFile().getAbsolutePath()
|
||||||
});
|
});
|
||||||
assertTrue(target.exists());
|
assertFalse(target.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalExportProjectProvider_BadCmdLine3() throws Exception {
|
public void testExternalExportProjectProvider_BadCmdLine3() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
TestProjectProvider4 tpp4= new TestProjectProvider4();
|
TestProjectProvider4 tpp4= new TestProjectProvider4();
|
||||||
ICProject cproject= tpp4.createProject();
|
ICProject cproject= tpp4.createProject();
|
||||||
|
|
||||||
|
@ -177,86 +175,43 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName(),
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName(),
|
||||||
ExternalExportProjectProvider.OPT_SOURCE, cproject.getProject().getLocation().toFile().getAbsolutePath()
|
ExternalExportProjectProvider.OPT_SOURCE, cproject.getProject().getLocation().toFile().getAbsolutePath()
|
||||||
});
|
});
|
||||||
assertTrue(target.exists());
|
assertFalse(target.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalExportProjectProvider() throws Exception {
|
public void testExternalExportProjectProvider() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
|
||||||
|
|
||||||
final int[] stateCount= new int[1];
|
final int[] stateCount= new int[1];
|
||||||
IIndexerStateListener listener= new IIndexerStateListener() {
|
WritablePDOM wpdom= generatePDOM(LOC_TSTPRJ1, ExternalExportProjectProvider.class, stateCount);
|
||||||
public void indexChanged(IIndexerStateEvent event) {
|
|
||||||
stateCount[0]++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
CCorePlugin.getIndexManager().joinIndexer(8000, new NullProgressMonitor());
|
|
||||||
CCorePlugin.getIndexManager().addIndexerStateListener(listener);
|
|
||||||
|
|
||||||
URL url= FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path(locProject1), null);
|
|
||||||
String baseDir= FileLocator.toFileURL(url).getFile();
|
|
||||||
|
|
||||||
doGenerate(new String[] {
|
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName(),
|
|
||||||
ExternalExportProjectProvider.OPT_SOURCE, baseDir,
|
|
||||||
ExternalExportProjectProvider.OPT_FRAGMENT_ID, "hello.world"
|
|
||||||
});
|
|
||||||
assertTrue(target.exists());
|
|
||||||
|
|
||||||
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(baseURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
|
||||||
verifyProject1Content(wpdom);
|
verifyProject1Content(wpdom);
|
||||||
|
|
||||||
wpdom.acquireReadLock();
|
wpdom.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
String fid = wpdom.getProperty(IIndexFragment.PROPERTY_FRAGMENT_ID);
|
String fid = wpdom.getProperty(IIndexFragment.PROPERTY_FRAGMENT_ID);
|
||||||
assertNotNull(fid);
|
assertNotNull(fid);
|
||||||
assertEquals("hello.world", fid); // check for id passed on command-line
|
assertEquals("generate.pdom.tests.id."+getName(), fid); // check for id passed on command-line
|
||||||
} finally {
|
} finally {
|
||||||
wpdom.releaseReadLock();
|
wpdom.releaseReadLock();
|
||||||
}
|
}
|
||||||
// depending on the timing the index of the temporary project is changed once or twice.
|
// depending on the timing the index of the temporary project is changed once or twice.
|
||||||
assertTrue(stateCount[0] == 2 || stateCount[0] == 4);
|
assertTrue("state is "+ stateCount[0], stateCount[0] == 2 || stateCount[0] == 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExternalExportProjectProvider_SysIncludes() throws Exception {
|
public void testExternalExportProjectProvider_SysIncludes() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
WritablePDOM wpdom= generatePDOM(LOC_TSTPRJ2, ExternalExportProjectProvider.class, null);
|
||||||
|
|
||||||
final int[] stateCount = new int[1];
|
|
||||||
IIndexerStateListener listener= new IIndexerStateListener() {
|
|
||||||
public void indexChanged(IIndexerStateEvent event) {
|
|
||||||
stateCount[0]++;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
CCorePlugin.getIndexManager().addIndexerStateListener(listener);
|
|
||||||
|
|
||||||
URL url= FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path(locProject2), null);
|
|
||||||
String baseDir= FileLocator.toFileURL(url).getFile();
|
|
||||||
|
|
||||||
doGenerate(new String[] {
|
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, ExternalExportProjectProvider.class.getName(),
|
|
||||||
ExternalExportProjectProvider.OPT_SOURCE, baseDir,
|
|
||||||
ExternalExportProjectProvider.OPT_FRAGMENT_ID, "hello.world"
|
|
||||||
});
|
|
||||||
assertTrue(target.exists());
|
|
||||||
|
|
||||||
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(baseURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
|
||||||
verifyProject2Content(wpdom);
|
verifyProject2Content(wpdom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGenerateOnCyclicIncludes1() throws Exception {
|
||||||
|
// testing for zero NON-OK status objects (see BaseTestCase.setExpectedNumberOfLoggedNonOKStatusObjects)
|
||||||
|
WritablePDOM wpdom= generatePDOM(LOC_CYCINC1, ExternalExportProjectProvider.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGenerateOnCyclicIncludes2() throws Exception {
|
||||||
|
// testing for zero NON-OK status objects (see BaseTestCase.setExpectedNumberOfLoggedNonOKStatusObjects)
|
||||||
|
WritablePDOM wpdom= generatePDOM(LOC_CYCINC2, ExternalExportProjectProvider.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
public void testExternalExportProjectProvider_CLinkage() throws Exception {
|
public void testExternalExportProjectProvider_CLinkage() throws Exception {
|
||||||
File target= File.createTempFile("test", "pdom");
|
WritablePDOM wpdom= generatePDOM(LOC_TSTPRJ3, TestProjectProvider5.class, null);
|
||||||
|
|
||||||
URL url= FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path(locProject3), null);
|
|
||||||
String baseDir= FileLocator.toFileURL(url).getFile();
|
|
||||||
|
|
||||||
doGenerate(new String[] {
|
|
||||||
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
|
||||||
GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider5.class.getName(),
|
|
||||||
ExternalExportProjectProvider.OPT_SOURCE, baseDir,
|
|
||||||
ExternalExportProjectProvider.OPT_FRAGMENT_ID, "hello.world"
|
|
||||||
});
|
|
||||||
assertTrue(target.exists());
|
|
||||||
|
|
||||||
IndexFilter CLinkage= new IndexFilter() {
|
IndexFilter CLinkage= new IndexFilter() {
|
||||||
public boolean acceptLinkage(ILinkage linkage) {
|
public boolean acceptLinkage(ILinkage linkage) {
|
||||||
|
@ -270,7 +225,6 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
WritablePDOM wpdom= new WritablePDOM(target, new URIRelativeLocationConverter(baseURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
|
||||||
wpdom.acquireReadLock();
|
wpdom.acquireReadLock();
|
||||||
try {
|
try {
|
||||||
assertEquals(1, wpdom.findBindings(new char[][] { "foo"
|
assertEquals(1, wpdom.findBindings(new char[][] { "foo"
|
||||||
|
@ -311,6 +265,34 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WritablePDOM generatePDOM(String testProject, Class<?> provider, final int[] stateCount) throws Exception {
|
||||||
|
IIndexerStateListener listener= null;
|
||||||
|
if(stateCount != null) {
|
||||||
|
listener= new IIndexerStateListener() {
|
||||||
|
public void indexChanged(IIndexerStateEvent event) {
|
||||||
|
stateCount[0]++;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
CCorePlugin.getIndexManager().joinIndexer(8000, new NullProgressMonitor());
|
||||||
|
CCorePlugin.getIndexManager().addIndexerStateListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
URL url= FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path(testProject), null);
|
||||||
|
String baseDir= FileLocator.toFileURL(url).getFile();
|
||||||
|
|
||||||
|
doGenerate(new String[] {
|
||||||
|
GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
|
||||||
|
GeneratePDOMApplication.OPT_PROJECTPROVIDER, provider.getName(),
|
||||||
|
ExternalExportProjectProvider.OPT_SOURCE, baseDir,
|
||||||
|
ExternalExportProjectProvider.OPT_FRAGMENT_ID, "generate.pdom.tests.id."+getName()
|
||||||
|
});
|
||||||
|
assertTrue(target.exists());
|
||||||
|
if(listener!=null) {
|
||||||
|
CCorePlugin.getIndexManager().removeIndexerStateListener(listener);
|
||||||
|
}
|
||||||
|
return new WritablePDOM(target, new URIRelativeLocationConverter(BASEURI), LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
|
||||||
|
}
|
||||||
|
|
||||||
private void doGenerate(String[] args) throws CoreException {
|
private void doGenerate(String[] args) throws CoreException {
|
||||||
GeneratePDOMApplication app = new GeneratePDOMApplication();
|
GeneratePDOMApplication app = new GeneratePDOMApplication();
|
||||||
IApplicationContext ac= new MockApplicationContext(args);
|
IApplicationContext ac= new MockApplicationContext(args);
|
||||||
|
@ -320,6 +302,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
/*
|
/*
|
||||||
* IExportProjectProvider test implementations
|
* IExportProjectProvider test implementations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static class TestProjectProvider1 implements IExportProjectProvider {
|
public static class TestProjectProvider1 implements IExportProjectProvider {
|
||||||
public ICProject createProject() throws CoreException {return null;}
|
public ICProject createProject() throws CoreException {return null;}
|
||||||
public Map getExportProperties() {return null;}
|
public Map getExportProperties() {return null;}
|
||||||
|
@ -331,7 +314,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
public ICProject createProject() throws CoreException {
|
public ICProject createProject() throws CoreException {
|
||||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||||
toDeleteOnTearDown.add(cproject);
|
toDeleteOnTearDown.add(cproject);
|
||||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), locProject1);
|
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
public Map getExportProperties() {return null;}
|
public Map getExportProperties() {return null;}
|
||||||
|
@ -343,7 +326,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
public ICProject createProject() throws CoreException {
|
public ICProject createProject() throws CoreException {
|
||||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||||
toDeleteOnTearDown.add(cproject);
|
toDeleteOnTearDown.add(cproject);
|
||||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), locProject1);
|
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
public Map getExportProperties() {return null;}
|
public Map getExportProperties() {return null;}
|
||||||
|
@ -357,7 +340,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
public ICProject createProject() throws CoreException {
|
public ICProject createProject() throws CoreException {
|
||||||
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
ICProject cproject= CProjectHelper.createCCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||||
toDeleteOnTearDown.add(cproject);
|
toDeleteOnTearDown.add(cproject);
|
||||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), locProject1);
|
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ1);
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
public Map getExportProperties() {
|
public Map getExportProperties() {
|
||||||
|
@ -376,7 +359,7 @@ public class GeneratePDOMApplicationTest extends PDOMTestBase {
|
||||||
public ICProject createProject() throws CoreException {
|
public ICProject createProject() throws CoreException {
|
||||||
ICProject cproject= CProjectHelper.createCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
ICProject cproject= CProjectHelper.createCProject("test"+System.currentTimeMillis(), null, IPDOMManager.ID_NO_INDEXER);
|
||||||
toDeleteOnTearDown.add(cproject);
|
toDeleteOnTearDown.add(cproject);
|
||||||
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), locProject3);
|
CProjectHelper.importSourcesFromPlugin(cproject, CTestPlugin.getDefault().getBundle(), LOC_TSTPRJ3);
|
||||||
return cproject;
|
return cproject;
|
||||||
}
|
}
|
||||||
public Map getExportProperties() {
|
public Map getExportProperties() {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include "b.h"
|
|
@ -0,0 +1,5 @@
|
||||||
|
#ifndef __B_H__
|
||||||
|
#define __B_H__
|
||||||
|
#include "c.h"
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#ifndef __C_H__
|
||||||
|
#define __C_H__
|
||||||
|
#include "b.h"
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include "b.h"
|
|
@ -0,0 +1,5 @@
|
||||||
|
#ifndef __B_H__
|
||||||
|
#define __B_H__
|
||||||
|
#include "b.h"
|
||||||
|
#endif
|
||||||
|
|
|
@ -1408,7 +1408,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
IResource resource= tu.getResource();
|
IResource resource= tu.getResource();
|
||||||
if(resource instanceof IFile) {
|
if(resource instanceof IFile) {
|
||||||
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile)resource);
|
IIndexFileLocation location= IndexLocationFactory.getWorkspaceIFL((IFile)resource);
|
||||||
if(!areSynchronized(index, resource, location)) {
|
if(!areSynchronized(new HashSet<IIndexFileLocation>(), index, resource, location)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1425,13 +1425,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively checks that the specified file, and its include are up-to-date.
|
* Recursively checks that the specified file, and its include are up-to-date.
|
||||||
|
* @param trail a set of previously checked include file locations
|
||||||
* @param index the index to check against
|
* @param index the index to check against
|
||||||
* @param resource the resource to check from the workspace
|
* @param resource the resource to check from the workspace
|
||||||
* @param location the location to check from the index
|
* @param location the location to check from the index
|
||||||
* @return whether the specified file, and its includes are up-to-date.
|
* @return whether the specified file, and its includes are up-to-date.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private static boolean areSynchronized(IIndex index, IResource resource, IIndexFileLocation location) throws CoreException {
|
private static boolean areSynchronized(Set<IIndexFileLocation> trail, IIndex index, IResource resource, IIndexFileLocation location) throws CoreException {
|
||||||
|
if(!trail.contains(location)) {
|
||||||
|
trail.add(location);
|
||||||
|
|
||||||
IIndexFile[] file= index.getFiles(location);
|
IIndexFile[] file= index.getFiles(location);
|
||||||
|
|
||||||
// pre-includes may be listed twice (191989)
|
// pre-includes may be listed twice (191989)
|
||||||
|
@ -1450,12 +1454,13 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
||||||
String path= newLocation.getFullPath();
|
String path= newLocation.getFullPath();
|
||||||
if(path != null) {
|
if(path != null) {
|
||||||
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
IResource newResource= ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path));
|
||||||
if(!areSynchronized(index, newResource, newLocation)) {
|
if(!areSynchronized(trail, index, newResource, newLocation)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue