changeset 7395:74c83f186ab1

8015628: Test Failure in closed/java/io/pathNames/GeneralSolaris.java Reviewed-by: alanb
author igerasim
date Mon, 18 Aug 2014 17:16:50 +0400
parents 434a2dde9c21
children b94e612ae7c5
files test/java/io/pathNames/General.java test/java/io/pathNames/GeneralWin32.java
diffstat 2 files changed, 11 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/io/pathNames/General.java	Mon Aug 18 17:14:25 2014 +0400
+++ b/test/java/io/pathNames/General.java	Mon Aug 18 17:16:50 2014 +0400
@@ -277,8 +277,8 @@
     {
         check(ans, ask + slash);
         checkNames(depth, create,
-                   ans,
-                   ask);
+                   ans.endsWith(File.separator) ? ans : ans + File.separator,
+                   ask + slash);
     }
 
 
@@ -308,9 +308,6 @@
                                   String ans, String ask)
         throws Exception
     {
-        ans = ans.endsWith(File.separator) ? ans : ans + File.separator;
-        ask = ask.endsWith(File.separator) ? ask : ask + File.separator;
-
         int d = depth - 1;
         File f = new File(ans);
         String n;
--- a/test/java/io/pathNames/GeneralWin32.java	Mon Aug 18 17:14:25 2014 +0400
+++ b/test/java/io/pathNames/GeneralWin32.java	Mon Aug 18 17:16:50 2014 +0400
@@ -50,13 +50,13 @@
     private static final int DEPTH = 2;
     private static String baseDir = null;
     private static String userDir = null;
+    private static String relative = null;
 
     /* Pathnames relative to working directory */
 
     private static void checkCaseLookup() throws IOException {
         /* Use long names here to avoid 8.3 format, which Samba servers often
            force to lowercase */
-        String relative = baseDir.substring(userDir.length() + 1);
         File d1 = new File(relative, "XyZzY0123");
         File d2 = new File(d1, "FOO_bar_BAZ");
         File f = new File(d2, "GLORPified");
@@ -79,9 +79,9 @@
            case of filenames, rather than just using the input case */
         File y = new File(userDir, f.getPath());
         String ans = y.getPath();
-        check(ans, relative + "\\" + "XyZzY0123\\FOO_bar_BAZ\\GLORPified");
-        check(ans, relative + "\\" + "xyzzy0123\\foo_bar_baz\\glorpified");
-        check(ans, relative + "\\" + "XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED");
+        check(ans, relative + "XyZzY0123\\FOO_bar_BAZ\\GLORPified");
+        check(ans, relative + "xyzzy0123\\foo_bar_baz\\glorpified");
+        check(ans, relative + "XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED");
     }
 
     private static void checkWild(File f) throws Exception {
@@ -103,8 +103,7 @@
     private static void checkRelativePaths() throws Exception {
         checkCaseLookup();
         checkWildCards();
-        String relative = baseDir.substring(userDir.length() + 1);
-        checkNames(3, true, baseDir.toString(), relative);
+        checkNames(3, true, baseDir, relative);
     }
 
 
@@ -136,7 +135,6 @@
         String ans = exists ? df.getAbsolutePath() : d;
         if (!ans.endsWith("\\"))
             ans = ans + "\\";
-        String relative = baseDir.substring(userDir.length() + 1);
         checkNames(depth, false, ans + relative, d + relative);
     }
 
@@ -171,15 +169,16 @@
             return;
         }
         if (args.length > 0) debug = true;
-        userDir = System.getProperty("user.dir");
-        baseDir = initTestData(6);
+        userDir = System.getProperty("user.dir") + '\\';
+        baseDir = initTestData(6) + '\\';
+        relative = baseDir.substring(userDir.length());
         checkRelativePaths();
         checkDrivePaths();
         checkUncPaths();
     }
 
     private static String initTestData(int maxDepth) throws IOException {
-        File parent = new File(System.getProperty("user.dir"));
+        File parent = new File(userDir);
         String baseDir = null;
         maxDepth = maxDepth < DEPTH + 2 ? DEPTH + 2 : maxDepth;
         for (int i = 0; i < maxDepth; i ++) {