From 010ca0d23eb67082c623e52f03a35ece016d2107 Mon Sep 17 00:00:00 2001 From: alanb Date: Tue, 28 Aug 2012 11:12:46 +0100 Subject: [PATCH] 6962637: TEST_BUG: java/io/File/MaxPathLength.java may fail in busy system Reviewed-by: dholmes, alanb Contributed-by: Eric Wang --- test/ProblemList.txt | 3 -- test/java/io/File/MaxPathLength.java | 49 +++------------------------- 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/test/ProblemList.txt b/test/ProblemList.txt index ca0f9cd23..2dd87ee7a 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -222,9 +222,6 @@ java/net/URLClassLoader/closetest/CloseTest.java macosx-all # jdk_io -# 6962637 -java/io/File/MaxPathLength.java windows-all - # 7162111 - these tests need to be updated to run headless java/io/Serializable/resolveClass/deserializeButton/run.sh macosx-all java/io/Serializable/serialver/classpath/run.sh macosx-all diff --git a/test/java/io/File/MaxPathLength.java b/test/java/io/File/MaxPathLength.java index 2e6f38ff9..af8323a36 100644 --- a/test/java/io/File/MaxPathLength.java +++ b/test/java/io/File/MaxPathLength.java @@ -35,32 +35,11 @@ public class MaxPathLength { private static String fileName = "areallylongfilenamethatsforsur"; private static boolean isWindows = false; - private static long totalSpace; - private static long freeSpace; - private static long usableSpace; - private static long ONEMEGA = 1024*1024; public static void main(String[] args) throws Exception { String osName = System.getProperty("os.name"); if (osName.startsWith("Windows")) { isWindows = true; - if (osName.startsWith("Windows 9") || - osName.startsWith("Windows Me")) - return; // win9x/Me cannot handle long paths - } - - if (osName.startsWith("SunOS")) { - return; // We don't run this test on Solaris either. - // Some Solaris machines have very "slow" disk - // access performance which causes this one - // to timeout. - } - - if (isWindows) { - File f = new File("."); - totalSpace = f.getTotalSpace()/ONEMEGA; - freeSpace = f.getFreeSpace()/ONEMEGA; - usableSpace = f.getUsableSpace()/ONEMEGA; } for (int i = 4; i < 7; i++) { @@ -72,25 +51,17 @@ public class MaxPathLength { } } - // Testing below will not be run if "-extra" is not - if (args.length == 0 || - !"-extra".equals(args[0]) || - !isWindows) - return; - - /* Testings below should not be run on a remote - dir that exists on a Solaris machine */ - for (int i = 20; i < 21; i++) { + // test long paths on windows + if (isWindows) { String name = fileName; while (name.length() < 256) { - testLongPath (i, name, false); - testLongPath (i, name, true); + testLongPath (20, name, false); + testLongPath (20, name, true); name += "A"; } } } - private static int lastMax = 0; static void testLongPath(int max, String fn, boolean tryAbsolute) throws Exception { String[] created = new String[max]; @@ -125,18 +96,6 @@ public class MaxPathLength { dirFile = new File(dirFile.getCanonicalPath()); if (!dirFile.isDirectory()) throw new RuntimeException ("File.isDirectory() failed"); - if (isWindows && lastMax != max) { - long diff = totalSpace - dirFile.getTotalSpace()/ONEMEGA; - if (diff < -5 || diff > 5) - throw new RuntimeException ("File.getTotalSpace() failed"); - diff = freeSpace - dirFile.getFreeSpace()/ONEMEGA; - if (diff < -5 || diff > 5) - throw new RuntimeException ("File.getFreeSpace() failed"); - diff = usableSpace - dirFile.getUsableSpace()/ONEMEGA; - if (diff < -5 || diff > 5) - throw new RuntimeException ("File.getUsableSpace() failed"); - lastMax = max; - } f = new File(tPath); if (!f.createNewFile()) { throw new RuntimeException ("File.createNewFile() failed"); -- GitLab