changeset 7281:f522bbdf2859

8015628: Test Failure in closed/java/io/pathNames/GeneralSolaris.java Reviewed-by: alanb
author dxu
date Fri, 31 May 2013 13:34:27 -0700
parents 933b1338b99c
children 11cdcf87ad5d
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	Fri May 31 11:20:51 2013 -0700
+++ b/test/java/io/pathNames/General.java	Fri May 31 13:34:27 2013 -0700
@@ -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	Fri May 31 11:20:51 2013 -0700
+++ b/test/java/io/pathNames/GeneralWin32.java	Fri May 31 13:34:27 2013 -0700
@@ -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 ++) {