8208623: [TESTBUG] runtime/LoadClass/LongBCP.java fails in AUFS file system
authordholmes
Mon, 06 Aug 2018 04:31:50 -0400
changeset 51312 c00451b67854
parent 51311 d93577466d8c
child 51313 f7236b46b60c
8208623: [TESTBUG] runtime/LoadClass/LongBCP.java fails in AUFS file system Summary: Limit the maximal file name length to 242 for AUFS file system Reviewed-by: dholmes, redestad Contributed-by: pengfei.li@arm.com
test/hotspot/jtreg/runtime/LoadClass/LongBCP.java
--- a/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java	Sun Aug 05 19:16:31 2018 +0100
+++ b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java	Mon Aug 06 04:31:50 2018 -0400
@@ -32,6 +32,9 @@
  * @run main LongBCP
  */
 
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.FileStore;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
@@ -85,8 +88,15 @@
         // We currently cannot handle relative path specified in the
         // -Xbootclasspath/a on windows.
         //
-        // relative path length within the 256 limit
-        char[] chars = new char[255];
+        // relative path length within the file system limit
+        int fn_max_length = 255;
+        // In AUFS file system, the maximal file name length is 242
+        FileStore store = Files.getFileStore(new File(".").toPath());
+        String fs_type = store.type();
+        if ("aufs".equals(fs_type)) {
+            fn_max_length = 242;
+        }
+        char[] chars = new char[fn_max_length];
         Arrays.fill(chars, 'y');
         String subPath = new String(chars);
         destDir = Paths.get(".", subPath);