6931128: (spec) File attribute tests fail when run as root.
Reviewed-by: alanb
diff --git a/test/java/io/File/SetAccess.java b/test/java/io/File/SetAccess.java
index f9287ee..1fc4e97 100644
--- a/test/java/io/File/SetAccess.java
+++ b/test/java/io/File/SetAccess.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /* @test
    @bug 4167472 5097703 6216563 6284003 6728842 6464744
    @summary Basic test for setWritable/Readable/Executable methods
+   @build SetAccess Util
+   @run main SetAccess
  */
 
 import java.io.*;
@@ -32,6 +34,11 @@
 
 public class SetAccess {
     public static void main(String[] args) throws Exception {
+        if (Util.isPrivileged()) {
+            System.out.println("Unable to test file permissions when running with privileges");
+            return;
+        }
+
         File d = new File(System.getProperty("test.dir", "."));
 
         File f = new File(d, "x.SetAccessPermission");