diff --git a/test/sun/tools/native2ascii/NativeErrors.java b/test/sun/tools/native2ascii/NativeErrors.java index 00493b8e908be395f75561e545bb39651dadf67c..02ca85344755f140144a88a9690b0ae0beb8e541 100644 --- a/test/sun/tools/native2ascii/NativeErrors.java +++ b/test/sun/tools/native2ascii/NativeErrors.java @@ -75,7 +75,14 @@ public class NativeErrors { throw new Error("Output file cannot be made read only: " + path2); } f2.deleteOnExit(); - checkResult(executeCmd(path1, path2), "err.cannot.write"); + if ( f2.canWrite() ) { + String msg = "Output file is still writable. " + + "Probably because test is run as root. Read-only test skipped."; + System.out.println(msg); + } else { + // Test write to a read-only file. + checkResult(executeCmd(path1, path2), "err.cannot.write"); + } } private static String executeCmd(String... toolArgs) throws Throwable {