Browse Source

fix test error happening under Windows @ Jetbrains see http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt133

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1447450 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 12 years ago
parent
commit
2487a90505
1 changed files with 22 additions and 2 deletions
  1. +22
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java

+ 22
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java View File

@@ -22,6 +22,9 @@ import org.apache.tools.ant.BuildFileTest;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;

import java.io.File;
import java.io.IOException;

/**
* Tests <bm:manifestclasspath>.
*/
@@ -167,10 +170,27 @@ public class ManifestClassPathTest
if (!Os.isFamily("windows")) {
System.out.println("Test with drive letters only run on windows");
} else {
// the lines below try to find a drive name different than the one containing the temp dir
// if the temp dir is C will try to use D
// if the temp dir is on D or other will try to use C
File tmpdir = new File(System.getProperty("java.io.tmpdir"));
String driveLetter = "C";
try {
String tmpCanonicalPath = tmpdir.getCanonicalPath();
driveLetter = tmpCanonicalPath.substring(1).toUpperCase();
} catch (IOException ioe) {
System.out.println("exception happened getting canonical path of java.io.tmpdir : " + ioe.getMessage());
}
String altDriveLetter = null;
try {
new java.io.File("D:/foo.txt").getCanonicalPath();
if ("C".equals(driveLetter)) {
altDriveLetter = "D";
} else {
altDriveLetter = "C";
}
new java.io.File(altDriveLetter + ":/foo.txt").getCanonicalPath();
} catch (java.io.IOException e) {
System.out.println("drive d: doesn't exist or is not ready,"
System.out.println("drive " + altDriveLetter + ": doesn't exist or is not ready,"
+ " skipping test");
return;
}


Loading…
Cancel
Save