Skip test when getFileStore() fails
authorVladimir Petko <vladimir.petko@canonical.com>
Thu, 24 Aug 2023 06:29:32 +0000 (07:29 +0100)
committerMatthias Klose <doko@ubuntu.com>
Thu, 24 Aug 2023 06:29:32 +0000 (07:29 +0100)
Bug: https://bugs.openjdk.org/browse/JDK-8166162
Forwarded: not-needed
Last-Update: 2023-03-27

Due to https://bugs.openjdk.org/browse/JDK-8166162 getFileStore() fails with exception
failing the test suite. Skip test when getFileStore() throws.

Gbp-Pq: Name log-generated-classes-test.patch

test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java

index d75e9b4d2a581fdfc1fba1db6fc76e46dd7a254c..5b4316b378c1d29df28e655d91162018ab3de685 100644 (file)
@@ -195,14 +195,21 @@ public class LogGeneratedClassesTest extends LUtils {
 
     @Test
     public void testDumpDirNotWritable() throws IOException {
-        if (!Files.getFileStore(Paths.get("."))
-                  .supportsFileAttributeView(PosixFileAttributeView.class)) {
-            // No easy way to setup readonly directory without POSIX
-            // We would like to skip the test with a cause with
-            //     throw new SkipException("Posix not supported");
-            // but jtreg will report failure so we just pass the test
-            // which we can look at if jtreg changed its behavior
-            System.out.println("WARNING: POSIX is not supported. Skipping testDumpDirNotWritable test.");
+        try
+        {
+            if (!Files.getFileStore(Paths.get("."))
+                    .supportsFileAttributeView(PosixFileAttributeView.class)) {
+                // No easy way to setup readonly directory without POSIX
+                // We would like to skip the test with a cause with
+                //     throw new SkipException("Posix not supported");
+                // but jtreg will report failure so we just pass the test
+                // which we can look at if jtreg changed its behavior
+                System.out.println("WARNING: POSIX is not supported. Skipping testDumpDirNotWritable test.");
+                return;
+            }
+        }
+        catch (Throwable t) {
+            System.out.println("WARNING: Mount point not found (JDK-8166162). Skipping testDumpDirNotWritable test.");
             return;
         }