8156595: java/io/pathNames/GeneralWin32.java fail intermittently on windows-x64
Reviewed-by: psandoz
--- a/jdk/test/ProblemList.txt Mon Jan 16 09:53:34 2017 +0100
+++ b/jdk/test/ProblemList.txt Mon Jan 16 21:17:24 2017 +0800
@@ -141,8 +141,6 @@
# jdk_io
-java/io/pathNames/GeneralWin32.java 8156595 windows-all
-
############################################################################
# jdk_management
--- a/jdk/test/java/io/pathNames/General.java Mon Jan 16 09:53:34 2017 +0100
+++ b/jdk/test/java/io/pathNames/General.java Mon Jan 16 21:17:24 2017 +0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
private static int gensymCounter = 0;
protected static final String userDir = System.getProperty("user.dir");
+ protected static final String workSubDir = "tmp";
protected static String baseDir = null;
protected static String relative = null;
@@ -60,7 +61,10 @@
* direct or indirect calling) in a whole test.
*/
protected static void initTestData(int depth) throws IOException {
- File parent = new File(userDir);
+ File parent = new File(userDir + File.separator + workSubDir);
+ if (!parent.mkdir()) {
+ throw new IOException("Fail to create directory: " + parent);
+ }
for (int i = 0; i < depth; i++) {
File tmp = new File(parent, gensym());
tmp.createNewFile();
--- a/jdk/test/java/io/pathNames/GeneralWin32.java Mon Jan 16 09:53:34 2017 +0100
+++ b/jdk/test/java/io/pathNames/GeneralWin32.java Mon Jan 16 21:17:24 2017 +0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,8 @@
private static void checkCaseLookup() throws IOException {
/* Use long names here to avoid 8.3 format, which Samba servers often
force to lowercase */
- File d = new File("XyZzY0123", "FOO_bar_BAZ");
+ File r = new File (workSubDir, "XyZzY0123");
+ File d = new File(r, "FOO_bar_BAZ");
File f = new File(d, "GLORPified");
if (!f.exists()) {
if (!d.exists()) {
@@ -74,9 +75,9 @@
case of filenames, rather than just using the input case */
File y = new File(userDir, f.getPath());
String ans = y.getPath();
- check(ans, "XyZzY0123\\FOO_bar_BAZ\\GLORPified");
- check(ans, "xyzzy0123\\foo_bar_baz\\glorpified");
- check(ans, "XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED");
+ check(ans, workSubDir + File.separator + "XyZzY0123\\FOO_bar_BAZ\\GLORPified");
+ check(ans, workSubDir + File.separator + "xyzzy0123\\foo_bar_baz\\glorpified");
+ check(ans, workSubDir + File.separator + "XYZZY0123\\FOO_BAR_BAZ\\GLORPIFIED");
}
private static void checkWild(File f) throws Exception {
@@ -125,20 +126,19 @@
throw new RuntimeException("Can't find an active drive");
}
- private static void checkDrive(int depth, char drive, boolean exists)
+ private static void checkDrive(int depth, String drive, boolean exists)
throws Exception
{
- String d = drive + ":";
- File df = new File(d);
- String ans = exists ? df.getAbsolutePath() : d;
+ File df = new File(drive);
+ String ans = exists ? df.getAbsolutePath() : drive;
if (!ans.endsWith("\\"))
ans = ans + "\\";
- checkNames(depth, false, ans, d);
+ checkNames(depth, false, ans, drive);
}
private static void checkDrivePaths(int depth) throws Exception {
- checkDrive(depth, findActiveDrive(), true);
- checkDrive(depth, findInactiveDrive(), false);
+ checkDrive(depth, findActiveDrive() + ":" + workSubDir + File.separator, true);
+ checkDrive(depth, findInactiveDrive() + ":", false);
}