Skip to content

Commit 4090ba3

Browse files
author
SendaoYan
committed
8367988: NewFileSystemTests.readOnlyZipFileFailure fails when run by root user
Backport-of: b03b6f54c5f538146c3088c4dc2cea70ba70d07a
1 parent 4724078 commit 4090ba3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/jdk/jdk/nio/zipfs/NewFileSystemTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.testng.annotations.BeforeClass;
2626
import org.testng.annotations.DataProvider;
2727
import org.testng.annotations.Test;
28+
import org.testng.SkipException;
2829

2930
import java.io.IOException;
3031
import java.net.URI;
@@ -35,6 +36,7 @@
3536
import java.nio.file.Path;
3637
import java.util.Iterator;
3738
import java.util.Map;
39+
import jdk.test.lib.Platform;
3840

3941
import static java.nio.charset.StandardCharsets.UTF_8;
4042
import static org.testng.Assert.assertEquals;
@@ -48,6 +50,7 @@
4850
* @bug 8218875
4951
* @summary ZIP File System tests that leverage Files.newFileSystem
5052
* @modules jdk.zipfs
53+
* @library /test/lib
5154
* @compile NewFileSystemTests.java
5255
* @run testng NewFileSystemTests
5356
*/
@@ -219,6 +222,9 @@ public void multiReleaseJarReadWriteSuccess() throws IOException {
219222
*/
220223
@Test
221224
public void readOnlyZipFileFailure() throws IOException {
225+
if (Platform.isRoot()) {
226+
throw new SkipException("Test skipped when executed by root user.");
227+
}
222228
// Underlying file is read-only.
223229
Path readOnlyZip = Utils.createJarFile("read_only.zip", Map.of("file.txt", "Hello World"));
224230
// In theory this can fail, and we should avoid unwanted false-negatives.

0 commit comments

Comments
 (0)