diff options
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java')
-rw-r--r-- | build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java | 68 |
1 files changed, 12 insertions, 56 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java index 1df00d08f76..13f87f2dcb1 100644 --- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java +++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests20.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.cdt.managedbuilder.core.tests; -import java.io.File; -import java.io.IOException; import java.util.Arrays; import java.util.Map; import java.util.Properties; @@ -24,7 +22,6 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfoChangeListener; import org.eclipse.cdt.core.parser.IScannerInfoProvider; -import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsScannerInfoProvider; import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.IConfiguration; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; @@ -202,26 +199,6 @@ public class ManagedBuildCoreTests20 extends TestCase { /** - * Convert path to OS specific representation - */ - private String toOSLocation(String path) { - File file = new File(path); - try { - path = file.getCanonicalPath(); - } catch (IOException e) { - } - - return path; - } - - /** - * Convert path to OS specific representation - */ - private String toOSString(String path) { - return new Path(path).toOSString(); - } - - /** * The purpose of this test is to exercise the build path info interface. * To get to that point, a new project/config has to be created in the test * project and the default configuration changed. @@ -241,38 +218,18 @@ public class ManagedBuildCoreTests20 extends TestCase { } //These are the expected path settings - IPath buildCWD = project.getLocation().append("Sub Config"); - - final String[] expectedPaths; - if (new Path("C:\\home\\tester/include").isAbsolute()) { - // Windows - expectedPaths = new String[] { - toOSLocation("/usr/include"), - toOSLocation("/opt/gnome/include"), - toOSLocation("C:\\home\\tester/include"), - // relative paths from MBS will make 3 entries - project.getLocation().append("includes").toOSString(), - buildCWD.append("includes").toOSString(), - toOSString("includes"), - "/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED - }; - } else { - // Unix - expectedPaths = new String[] { - toOSLocation("/usr/include"), - toOSLocation("/opt/gnome/include"), - // on unix "C:\\home\\tester/include" is relative path - // looks like nonsense but has to be this way as MBS converts entry to keep "Sub Config/C:\\home\\tester/include" in its storage - project.getLocation().append("Sub Config/C:\\home\\tester/include").toOSString(), - buildCWD.append("Sub Config/C:\\home\\tester/include").toOSString(), - toOSString("Sub Config/C:\\home\\tester/include"), - // relative paths from MBS will make 3 entries - project.getLocation().append("includes").toOSString(), - buildCWD.append("includes").toOSString(), - toOSString("includes"), - "/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED - }; - } + final String[] expectedPaths = new String[5]; + + // This first path is a built-in, so it will not be manipulated by build manager + expectedPaths[0] = (new Path("/usr/include")).toOSString(); + expectedPaths[1] = (new Path("/opt/gnome/include")).toOSString(); + IPath path = new Path("C:\\home\\tester/include"); + if(path.isAbsolute()) // for win32 path is treated as absolute + expectedPaths[2] = path.toOSString(); + else // for Linux path is relative + expectedPaths[2] = project.getLocation().append("Sub Config").append(path).toOSString(); + expectedPaths[3] = project.getLocation().append( "includes" ).toOSString(); + expectedPaths[4] = (new Path("/usr/gnu/include")).toOSString(); // Create a new managed project based on the sub project type IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub"); @@ -324,7 +281,6 @@ public class ManagedBuildCoreTests20 extends TestCase { // Find the first IScannerInfoProvider that supplies build info for the project IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project); assertNotNull(provider); - assertTrue(provider instanceof LanguageSettingsScannerInfoProvider); // Now subscribe (note that the method will be called after a change provider.subscribe(project, new IScannerInfoChangeListener () { |