changeset 10052:c5a2fc3ec942

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
author mtobiass
date Wed, 04 Jun 2014 13:12:16 +0200
parents d23c0eb930f7
children da62865b6478
files test/sun/tools/native2ascii/NativeErrors.java
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/tools/native2ascii/NativeErrors.java	Wed Jun 04 16:26:11 2014 +0400
+++ b/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 {