8036006: [TESTBUG] sun/tools/native2ascii/NativeErrors.java fails: Process exit code was 0, but error was expected.
Summary: Ignore read-only test if file is not read-only. This will happen when test is run as root.
Reviewed-by: sla, dholmes
--- a/jdk/test/sun/tools/native2ascii/NativeErrors.java Wed Jun 04 16:26:11 2014 +0400
+++ b/jdk/test/sun/tools/native2ascii/NativeErrors.java Wed Jun 04 13:12:16 2014 +0200
@@ -73,7 +73,14 @@
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 {