From 6b7158a04df0a967c09e4caa15d4d70ea083345e Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Mon, 9 Sep 2024 15:48:20 +0200 Subject: [PATCH] Skip test when getFileStore() fails 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 --- .../lambda/LogGeneratedClassesTest.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java b/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java index d75e9b4d2..5b4316b37 100644 --- a/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java +++ b/test/jdk/java/lang/invoke/lambda/LogGeneratedClassesTest.java @@ -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; } -- 2.30.2