mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 515560: Avoid indexer race condition by joining the indexer
Change-Id: I13bd33adba4eb790fae0c31d2c1378e19a59f4ff
This commit is contained in:
parent
c8b23ec2d7
commit
cc0955b823
22 changed files with 142 additions and 29 deletions
|
@ -15,9 +15,12 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
import org.eclipse.cdt.make.core.IMakeBuilderInfo;
|
||||||
import org.eclipse.cdt.make.core.IMakeCommonBuildInfo;
|
import org.eclipse.cdt.make.core.IMakeCommonBuildInfo;
|
||||||
import org.eclipse.cdt.make.core.MakeBuilder;
|
import org.eclipse.cdt.make.core.MakeBuilder;
|
||||||
|
@ -134,7 +137,8 @@ public class StandardBuildTests extends TestCase {
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
private void removeProject(String name) {
|
private void removeProject(String name) throws CoreException, IOException {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IProject project = root.getProject(name);
|
IProject project = root.getProject(name);
|
||||||
if (project.exists()) {
|
if (project.exists()) {
|
||||||
|
@ -149,7 +153,7 @@ public class StandardBuildTests extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Remove all the project information associated with the project used during test.
|
* Remove all the project information associated with the project used during test.
|
||||||
*/
|
*/
|
||||||
public void testProjectCleanup() {
|
public void testProjectCleanup() throws CoreException, IOException {
|
||||||
removeProject(PROJECT_NAME);
|
removeProject(PROJECT_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||||
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.ResourceHelper;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCPerFileBOPConsoleParser;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCPerFileBOPConsoleParser;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.CCommandDSC;
|
||||||
|
@ -64,6 +65,7 @@ public class GCCPerFileBOPConsoleParserTests extends BaseBOPConsoleParserTests {
|
||||||
if (fOutputParser != null) {
|
if (fOutputParser != null) {
|
||||||
fOutputParser.shutdown();
|
fOutputParser.shutdown();
|
||||||
}
|
}
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
if (fCProject != null) {
|
if (fCProject != null) {
|
||||||
CProjectHelper.delete(fCProject);
|
CProjectHelper.delete(fCProject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.MakeProjectNature;
|
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||||
|
@ -59,6 +60,7 @@ public class ScannerConfigDiscoveryTests extends BaseTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
StandardBuildTestHelper.removeProject("SCDC");
|
StandardBuildTestHelper.removeProject("SCDC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.make.scannerdiscovery;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
|
@ -42,6 +43,7 @@ public class ScannerConfigProfileTests extends BaseTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
StandardBuildTestHelper.removeProject("SCDC");
|
StandardBuildTestHelper.removeProject("SCDC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
import org.eclipse.core.resources.IBuildConfiguration;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
@ -68,6 +69,7 @@ public abstract class AbstractBuilderTest extends TestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
// Bug 327126 Stop the indexer before tearing down so we don't deadlock
|
// Bug 327126 Stop the indexer before tearing down so we don't deadlock
|
||||||
Job.getJobManager().cancel(CCorePlugin.getPDOMManager());
|
Job.getJobManager().cancel(CCorePlugin.getPDOMManager());
|
||||||
Job.getJobManager().join(CCorePlugin.getPDOMManager(), null);
|
Job.getJobManager().join(CCorePlugin.getPDOMManager(), null);
|
||||||
|
|
|
@ -32,6 +32,7 @@ import junit.framework.TestCase;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
|
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
@ -214,6 +215,7 @@ public class ManagedBuildTestHelper {
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
static public void removeProject(String name) {
|
static public void removeProject(String name) {
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(ManagedBuildTestHelper.class.getName());
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
final IProject project = root.getProject(name);
|
final IProject project = root.getProject(name);
|
||||||
if (project.exists()) {
|
if (project.exists()) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySu
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
@ -49,6 +50,7 @@ public class CfgScannerConfigProfileManagerTests extends BaseTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
ManagedBuildTestHelper.removeProject(fProject.getName());
|
ManagedBuildTestHelper.removeProject(fProject.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ 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.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
||||||
|
@ -854,6 +855,7 @@ public class BuildDescriptionModelTests extends TestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
fCleaner.run();
|
fCleaner.run();
|
||||||
if(DbgUtil.DEBUG)
|
if(DbgUtil.DEBUG)
|
||||||
DbgUtil.flush();
|
DbgUtil.flush();
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
@ -315,6 +316,7 @@ public class BuildSystem40Tests extends TestCase {
|
||||||
//deletion is performed in case if no fail occured
|
//deletion is performed in case if no fail occured
|
||||||
for(int i = 0; i < projects.length; i++){
|
for(int i = 0; i < projects.length; i++){
|
||||||
try {
|
try {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
projects[i].delete(true, null);
|
projects[i].delete(true, null);
|
||||||
assertNull(mngr.getProjectDescription(projects[i]));
|
assertNull(mngr.getProjectDescription(projects[i]));
|
||||||
assertNull(mngr.getProjectDescription(projects[i], false));
|
assertNull(mngr.getProjectDescription(projects[i], false));
|
||||||
|
@ -442,6 +444,7 @@ public class BuildSystem40Tests extends TestCase {
|
||||||
|
|
||||||
//deletion is performed in case if no fail occured
|
//deletion is performed in case if no fail occured
|
||||||
for(int i = 0; i < projects.length; i++){
|
for(int i = 0; i < projects.length; i++){
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
projects[i].delete(true, null);
|
projects[i].delete(true, null);
|
||||||
assertNull(mngr.getProjectDescription(projects[i]));
|
assertNull(mngr.getProjectDescription(projects[i]));
|
||||||
assertNull(mngr.getProjectDescription(projects[i], false));
|
assertNull(mngr.getProjectDescription(projects[i], false));
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
@ -302,6 +303,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
try {
|
try {
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("Failed on project close: " + e.getLocalizedMessage());
|
fail("Failed on project close: " + e.getLocalizedMessage());
|
||||||
|
@ -474,6 +476,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
// Save, close, reopen and test again
|
// Save, close, reopen and test again
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
project.open(null);
|
project.open(null);
|
||||||
|
|
||||||
|
@ -612,6 +615,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
try {
|
try {
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("Failed on project close: " + e.getLocalizedMessage());
|
fail("Failed on project close: " + e.getLocalizedMessage());
|
||||||
|
@ -1709,7 +1713,8 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Remove all the project information associated with the project used during test.
|
* Remove all the project information associated with the project used during test.
|
||||||
*/
|
*/
|
||||||
public void cleanup() {
|
public void cleanup() throws CoreException, IOException {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
removeProject(projectName);
|
removeProject(projectName);
|
||||||
removeProject(projectName2);
|
removeProject(projectName2);
|
||||||
}
|
}
|
||||||
|
@ -1831,6 +1836,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
try {
|
try {
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("Failed on error parser project close: " + e.getLocalizedMessage());
|
fail("Failed on error parser project close: " + e.getLocalizedMessage());
|
||||||
|
@ -1901,6 +1907,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
|
||||||
// Save, close, reopen and test again
|
// Save, close, reopen and test again
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
ManagedBuildManager.saveBuildInfo(project, false);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
project.open(null);
|
project.open(null);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
|
@ -276,7 +277,7 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase {
|
||||||
* Sets up the test environment for a project created from the
|
* Sets up the test environment for a project created from the
|
||||||
* default project
|
* default project
|
||||||
*/
|
*/
|
||||||
private void setupProject() throws Exception {
|
private IProject setupProject() throws Exception {
|
||||||
|
|
||||||
// The assertCorrectId() call needs to be set up
|
// The assertCorrectId() call needs to be set up
|
||||||
testExtensionElements = false;
|
testExtensionElements = false;
|
||||||
|
@ -307,6 +308,8 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase {
|
||||||
testProject = newProject.getProjectType();
|
testProject = newProject.getProjectType();
|
||||||
IConfiguration config = testProject.getConfiguration(configID);
|
IConfiguration config = testProject.getConfiguration(configID);
|
||||||
testConfig = newProject.createConfiguration(config, configID + ".12345678");
|
testConfig = newProject.createConfiguration(config, configID + ".12345678");
|
||||||
|
|
||||||
|
return project;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -553,12 +556,17 @@ public class ManagedBuildCoreTests_SharedToolOptions extends TestCase {
|
||||||
public void testConfiguration() throws Exception {
|
public void testConfiguration() throws Exception {
|
||||||
|
|
||||||
// Set up the environment
|
// Set up the environment
|
||||||
setupProject();
|
IProject project = setupProject();
|
||||||
setupTestEnvironment();
|
try {
|
||||||
// Rerun the other tests, without setting the test up again
|
setupTestEnvironment();
|
||||||
testIsSetup = true;
|
// Rerun the other tests, without setting the test up again
|
||||||
testIcons();
|
testIsSetup = true;
|
||||||
testValueHandlers();
|
testIcons();
|
||||||
testOptions();
|
testValueHandlers();
|
||||||
|
testOptions();
|
||||||
|
} finally {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
|
project.delete(true, new NullProgressMonitor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
@ -86,6 +87,13 @@ public class ManagedBuildEnvironmentTests extends TestCase {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.addResourceCreated(proj);
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
// Checking behaviour when vars are not defined (except system)
|
// Checking behaviour when vars are not defined (except system)
|
||||||
public void testEnvNotDef(){
|
public void testEnvNotDef(){
|
||||||
doInit();
|
doInit();
|
||||||
|
|
|
@ -22,6 +22,7 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
@ -105,6 +106,13 @@ public class ManagedBuildMacrosTests extends TestCase {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.addResourceCreated(proj);
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testMacroConf()
|
* testMacroConf()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,6 +15,7 @@ import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
|
@ -33,7 +34,14 @@ public class ManagedBuildTCSupportedTest extends TestCase {
|
||||||
suite.addTest(new ManagedBuildTCSupportedTest("testIsSupported")); //$NON-NLS-1$
|
suite.addTest(new ManagedBuildTCSupportedTest("testIsSupported")); //$NON-NLS-1$
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.addResourceCreated(ManagedBuildMacrosTests.proj);
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testIsSupported() -
|
* testIsSupported() -
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -164,5 +164,6 @@ public class PathConverterTest extends TestCase {
|
||||||
IPath path = entry.getIncludePath();
|
IPath path = entry.getIncludePath();
|
||||||
String pathText = path.toString() ;
|
String pathText = path.toString() ;
|
||||||
assertEquals("Unexpected value for include path", "/usr/local/include", pathText);
|
assertEquals("Unexpected value for include path", "/usr/local/include", pathText);
|
||||||
|
ManagedBuildTestHelper.removeProject("pathconverter01");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,8 @@ package org.eclipse.cdt.managedbuilder.core.tests;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
@ -46,6 +43,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
|
||||||
public class ResourceBuildCoreTests extends TestCase {
|
public class ResourceBuildCoreTests extends TestCase {
|
||||||
private static final boolean boolVal = true;
|
private static final boolean boolVal = true;
|
||||||
|
@ -71,6 +72,12 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a couple of resource configurations.
|
* Creates a couple of resource configurations.
|
||||||
* Checks whether the resource & project default build properties are same or not.
|
* Checks whether the resource & project default build properties are same or not.
|
||||||
|
@ -255,6 +262,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
assertNotSame(projDebugOptionValue, newResMainDebugOptionValue);
|
assertNotSame(projDebugOptionValue, newResMainDebugOptionValue);
|
||||||
|
|
||||||
// Close and remove project.
|
// Close and remove project.
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
removeProject(projectName);
|
removeProject(projectName);
|
||||||
}
|
}
|
||||||
|
@ -356,6 +364,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
assertEquals(defaultResToolFlags,resetResToolFlags);
|
assertEquals(defaultResToolFlags,resetResToolFlags);
|
||||||
|
|
||||||
// Close and remove project.
|
// Close and remove project.
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
removeProject(projectName);
|
removeProject(projectName);
|
||||||
}
|
}
|
||||||
|
@ -498,6 +507,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
ManagedBuildManager.saveBuildInfo(project,false);
|
ManagedBuildManager.saveBuildInfo(project,false);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
|
|
||||||
// Now reopen the project.
|
// Now reopen the project.
|
||||||
|
@ -566,6 +576,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
assertEquals(resBarDebugVal,newResBarDebugVal);
|
assertEquals(resBarDebugVal,newResBarDebugVal);
|
||||||
|
|
||||||
// Close and remove project.
|
// Close and remove project.
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
removeProject(projectName);
|
removeProject(projectName);
|
||||||
|
|
||||||
|
@ -612,6 +623,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
private void removeProject(String name) {
|
private void removeProject(String name) {
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
IProject project = root.getProject(name);
|
IProject project = root.getProject(name);
|
||||||
if (project.exists()) {
|
if (project.exists()) {
|
||||||
|
@ -702,6 +714,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
ManagedBuildManager.removeBuildInfo(project);
|
ManagedBuildManager.removeBuildInfo(project);
|
||||||
try {
|
try {
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
fail("Failed on project close: " + e.getLocalizedMessage());
|
fail("Failed on project close: " + e.getLocalizedMessage());
|
||||||
|
@ -918,6 +931,7 @@ public class ResourceBuildCoreTests extends TestCase {
|
||||||
assertEquals(1,resConfigs.length);
|
assertEquals(1,resConfigs.length);
|
||||||
|
|
||||||
// Close and remove project.
|
// Close and remove project.
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
removeProject(renamedProjectName2);
|
removeProject(renamedProjectName2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import junit.framework.TestCase;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||||
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
import org.eclipse.cdt.core.templateengine.TemplateEngine;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
|
@ -53,6 +54,7 @@ public class TestProcesses extends TestCase {
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
|
||||||
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
|
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
if (project.exists()) {
|
if (project.exists()) {
|
||||||
try {
|
try {
|
||||||
ManagedBuildTestHelper.delete(CoreModel.getDefault().create(project));
|
ManagedBuildTestHelper.delete(CoreModel.getDefault().create(project));
|
||||||
|
|
|
@ -21,6 +21,7 @@ import junit.framework.TestSuite;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ public class BackwardCompatiblityTests extends TestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
for(Iterator<IProject> iter = projList.iterator(); iter.hasNext();){
|
for(Iterator<IProject> iter = projList.iterator(); iter.hasNext();){
|
||||||
IProject proj = iter.next();
|
IProject proj = iter.next();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
|
@ -103,6 +104,7 @@ public class CProjectDescriptionSerializationTests extends TestCase {
|
||||||
|
|
||||||
// Persist the project
|
// Persist the project
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +147,7 @@ public class CProjectDescriptionSerializationTests extends TestCase {
|
||||||
Assert.assertEquals(message, 2, configurations.length);
|
Assert.assertEquals(message, 2, configurations.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,6 +210,7 @@ public class CProjectDescriptionSerializationTests extends TestCase {
|
||||||
Assert.fail(e.getMessage());
|
Assert.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,6 +268,7 @@ public class CProjectDescriptionSerializationTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close project
|
// Close project
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
|
@ -58,11 +59,13 @@ public class OptionStringListValueTests extends TestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
|
ResourceHelper.cleanUp(getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCfgDesEntries() throws Exception {
|
public void testCfgDesEntries() throws Exception {
|
||||||
String projName = PROJ_NAME_PREFIX + "1";
|
String projName = PROJ_NAME_PREFIX + "1";
|
||||||
IProject project = BuildSystemTestHelper.createProject(projName, null, "cdt.managedbuild.target.gnu30.exe");
|
IProject project = BuildSystemTestHelper.createProject(projName, null, "cdt.managedbuild.target.gnu30.exe");
|
||||||
|
ResourceHelper.addResourceCreated(project);
|
||||||
CoreModel model = CoreModel.getDefault();
|
CoreModel model = CoreModel.getDefault();
|
||||||
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
|
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
|
||||||
|
|
||||||
|
@ -111,6 +114,7 @@ public class OptionStringListValueTests extends TestCase {
|
||||||
public void testLibFiles() throws Exception {
|
public void testLibFiles() throws Exception {
|
||||||
String projName = PROJ_NAME_PREFIX + "2";
|
String projName = PROJ_NAME_PREFIX + "2";
|
||||||
IProject project = BuildSystemTestHelper.createProject(projName, null, "lv.tests.ptype");
|
IProject project = BuildSystemTestHelper.createProject(projName, null, "lv.tests.ptype");
|
||||||
|
ResourceHelper.addResourceCreated(project);
|
||||||
CoreModel model = CoreModel.getDefault();
|
CoreModel model = CoreModel.getDefault();
|
||||||
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
|
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
|
||||||
|
|
||||||
|
@ -200,6 +204,7 @@ public class OptionStringListValueTests extends TestCase {
|
||||||
public void testOptions() throws Exception {
|
public void testOptions() throws Exception {
|
||||||
String projName = PROJ_NAME_PREFIX + "3";
|
String projName = PROJ_NAME_PREFIX + "3";
|
||||||
IProject project = BuildSystemTestHelper.createProject(projName, null, "lv.tests.ptype");
|
IProject project = BuildSystemTestHelper.createProject(projName, null, "lv.tests.ptype");
|
||||||
|
ResourceHelper.addResourceCreated(project);
|
||||||
CoreModel model = CoreModel.getDefault();
|
CoreModel model = CoreModel.getDefault();
|
||||||
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
|
ICProjectDescriptionManager mngr = model.getProjectDescriptionManager();
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
import org.eclipse.cdt.core.settings.model.ICSourceEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||||
|
@ -174,6 +175,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
|
|
||||||
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
IWorkspaceRoot root = wsp.getRoot();
|
IWorkspaceRoot root = wsp.getRoot();
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(false, true, new NullProgressMonitor());
|
project.delete(false, true, new NullProgressMonitor());
|
||||||
|
|
||||||
project = root.getProject(projectName);
|
project = root.getProject(projectName);
|
||||||
|
@ -331,6 +333,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
}
|
}
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(false, true, new NullProgressMonitor());
|
project.delete(false, true, new NullProgressMonitor());
|
||||||
|
|
||||||
project = root.getProject(projectName);
|
project = root.getProject(projectName);
|
||||||
|
@ -376,6 +379,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
fEventChecker = null;
|
fEventChecker = null;
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(false, true, new NullProgressMonitor());
|
project.delete(false, true, new NullProgressMonitor());
|
||||||
|
|
||||||
project = root.getProject(projectName);
|
project = root.getProject(projectName);
|
||||||
|
@ -463,6 +467,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
coreModel.setProjectDescription(project, des);
|
coreModel.setProjectDescription(project, des);
|
||||||
fEventChecker = null;
|
fEventChecker = null;
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(true, true, new NullProgressMonitor());
|
project.delete(true, true, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,6 +508,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
|
|
||||||
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||||
IWorkspaceRoot root = wsp.getRoot();
|
IWorkspaceRoot root = wsp.getRoot();
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(false, true, new NullProgressMonitor());
|
project.delete(false, true, new NullProgressMonitor());
|
||||||
|
|
||||||
project = root.getProject(projectName);
|
project = root.getProject(projectName);
|
||||||
|
@ -559,6 +565,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
cfgDes = des.getConfigurations()[0];
|
cfgDes = des.getConfigurations()[0];
|
||||||
checkArrays(cfgDes.getSourceEntries(), s);
|
checkArrays(cfgDes.getSourceEntries(), s);
|
||||||
|
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(true, true, new NullProgressMonitor());
|
project.delete(true, true, new NullProgressMonitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,6 +729,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
assertEquals(cprojectFileStamp, cprojectFile.lastModified());
|
assertEquals(cprojectFileStamp, cprojectFile.lastModified());
|
||||||
|
|
||||||
// verify that closing/reopening the project preserves active configuration and does not touch project-model files
|
// verify that closing/reopening the project preserves active configuration and does not touch project-model files
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.close(null);
|
project.close(null);
|
||||||
project.open(null);
|
project.open(null);
|
||||||
des = coreModel.getProjectDescription(project);
|
des = coreModel.getProjectDescription(project);
|
||||||
|
@ -731,6 +739,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
assertEquals(cprojectFileStamp, cprojectFile.lastModified());
|
assertEquals(cprojectFileStamp, cprojectFile.lastModified());
|
||||||
|
|
||||||
// verify that deleting/reimporting the project resets active configuration but does not touch project-model files
|
// verify that deleting/reimporting the project resets active configuration but does not touch project-model files
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(false, true, null);
|
project.delete(false, true, null);
|
||||||
project.create(null);
|
project.create(null);
|
||||||
project.open(null);
|
project.open(null);
|
||||||
|
@ -747,6 +756,7 @@ public class ProjectModelTests extends TestCase implements IElementChangedListen
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if(project != null)
|
if(project != null)
|
||||||
|
ResourceHelper.joinIndexerBeforeCleanup(getName());
|
||||||
project.delete(true, null);
|
project.delete(true, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -700,19 +700,7 @@ public class ResourceHelper {
|
||||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
root.refreshLocal(IResource.DEPTH_INFINITE, NULL_MONITOR);
|
root.refreshLocal(IResource.DEPTH_INFINITE, NULL_MONITOR);
|
||||||
|
|
||||||
// Bug 499471: there is a race condition in the indexer when projects
|
joinIndexerBeforeCleanup(testName);
|
||||||
// are created and deleted quickly. Therefore, wait for the indexer
|
|
||||||
// to be idle before deleting projects.
|
|
||||||
if (!CCorePlugin.getIndexManager().isIndexerIdle()) {
|
|
||||||
// the 2 second wait is very long in practice, when the race condition is
|
|
||||||
// happening the total join time is just a few ms for most tests, and
|
|
||||||
// up to 75 ms for a couple of tests on the HIPP
|
|
||||||
boolean joinSuccess = CCorePlugin.getIndexManager().joinIndexer(2000, new NullProgressMonitor());
|
|
||||||
if (!joinSuccess) {
|
|
||||||
System.err.println(
|
|
||||||
"Indexer did not stop runing, possible deadlock about to happen. Running test " + testName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Delete all external files & folders created using ResourceHelper
|
// Delete all external files & folders created using ResourceHelper
|
||||||
|
@ -736,6 +724,22 @@ public class ResourceHelper {
|
||||||
resourcesCreated.clear();
|
resourcesCreated.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void joinIndexerBeforeCleanup(String testName) {
|
||||||
|
// Bug 499471: there is a race condition in the indexer when projects
|
||||||
|
// are created and deleted quickly. Therefore, wait for the indexer
|
||||||
|
// to be idle before deleting projects.
|
||||||
|
if (!CCorePlugin.getIndexManager().isIndexerIdle()) {
|
||||||
|
// the 2 second wait is very long in practice, when the race condition is
|
||||||
|
// happening the total join time is just a few ms for most tests, and
|
||||||
|
// up to 75 ms for a couple of tests on the HIPP
|
||||||
|
boolean joinSuccess = CCorePlugin.getIndexManager().joinIndexer(2000, new NullProgressMonitor());
|
||||||
|
if (!joinSuccess) {
|
||||||
|
System.err.println(
|
||||||
|
"Indexer did not stop runing, possible deadlock about to happen. Running test " + testName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void waitForProjectRefreshToFinish() {
|
private static void waitForProjectRefreshToFinish() {
|
||||||
try {
|
try {
|
||||||
// CDT opens the Project with BACKGROUND_REFRESH enabled which causes the
|
// CDT opens the Project with BACKGROUND_REFRESH enabled which causes the
|
||||||
|
@ -769,4 +773,14 @@ public class ResourceHelper {
|
||||||
}
|
}
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify {@link ResourceHelper} that given resource should be removed in
|
||||||
|
* {@link #cleanUp(String)}.
|
||||||
|
*/
|
||||||
|
public static void addResourceCreated(IResource resource) {
|
||||||
|
if (resource != null) {
|
||||||
|
resourcesCreated.add(resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue