diff options
author | Andrew Gvozdev | 2012-12-16 12:17:43 +0000 |
---|---|---|
committer | Andrew Gvozdev | 2012-12-16 12:18:39 +0000 |
commit | 0a4170fed0f50ba5c04bc4380458fd4feb93c9db (patch) | |
tree | 34b87a052ab1e120d51d0ff991633bcc35de1121 /build | |
parent | 963f1bf26e40f7156d51d5fd34067e87c370c8b9 (diff) | |
download | org.eclipse.cdt-0a4170fed0f50ba5c04bc4380458fd4feb93c9db.tar.gz org.eclipse.cdt-0a4170fed0f50ba5c04bc4380458fd4feb93c9db.tar.xz org.eclipse.cdt-0a4170fed0f50ba5c04bc4380458fd4feb93c9db.zip |
bug 396411: JUnit failure: cdt.managedbuilder.core.tests.ManagedBuildCoreTests20.testScannerInfoInterface
Diffstat (limited to 'build')
2 files changed, 23 insertions, 17 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 73c4d90863a..1aab71b5996 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 @@ -204,7 +204,7 @@ public class ManagedBuildCoreTests20 extends TestCase { /** * Convert path to OS specific representation */ - private String toOSString(String path) { + private String toOSLocation(String path) { File file = new File(path); try { path = file.getCanonicalPath(); @@ -213,7 +213,14 @@ public class ManagedBuildCoreTests20 extends TestCase { 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 @@ -240,24 +247,24 @@ public class ManagedBuildCoreTests20 extends TestCase { if (new Path("C:\\home\\tester/include").isAbsolute()) { // Windows expectedPaths = new String[] { - toOSString("/usr/include"), - toOSString("/opt/gnome/include"), - toOSString("C:\\home\\tester/include"), + toOSLocation("/usr/include"), + toOSLocation("/opt/gnome/include"), + toOSLocation("C:\\home\\tester/include"), // relative paths make 2 entries - project.getLocation().append("includes").toOSString(), - "includes", // FIXME this is incorrect, the original entry set via extension point is "../includes" + 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[] { - toOSString("/usr/include"), - toOSString("/opt/gnome/include"), + toOSLocation("/usr/include"), + toOSLocation("/opt/gnome/include"), + buildCWD.append("C:\\home\\tester/include").toOSString(), // added on Unix being relative path + toOSLocation("C:\\home\\tester/include"), // relative paths make 2 entries - buildCWD.append("C:\\home\\tester/include").toOSString(), - "C:\\home\\tester/include", - project.getLocation().append("includes").toOSString(), - "includes", // FIXME this is incorrect, the original entry set via extension point is "../includes" + buildCWD.append("../includes").toOSString(), + toOSString("includes"), "/usr/gnu/include", // Not converted to OS string due to being flagged as ICSettingEntry.RESOLVED }; } diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java index 9378bdf1988..3f6b3818677 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java @@ -1841,11 +1841,10 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider // } if(!buildPath.isAbsolute()){ - buildPath = project.getFullPath().append(buildPath); IStringVariableManager mngr = VariablesPlugin.getDefault().getStringVariableManager(); - - result = buildPath.toString(); - result = mngr.generateVariableExpression("workspace_loc", result); //$NON-NLS-1$ + // build dir may not exist yet and non-existent paths will resolve to empty string by VariablesPlugin + // so append relative part outside of expression, i.e. ${workspace_loc:/Project}/BuildDir + result = mngr.generateVariableExpression("workspace_loc", project.getFullPath().toString()) + Path.SEPARATOR + buildPath.toString(); //$NON-NLS-1$ } else { result = buildPath.toString(); } |