8002116: This JdbReadTwiceTest.sh gets an exit 1
authordsamersoff
Mon, 27 Jan 2014 17:13:16 +0400
changeset 22580 6068d5e6c746
parent 22579 59fc5fc7a389
child 22581 e868cde95050
8002116: This JdbReadTwiceTest.sh gets an exit 1 Summary: Explicitly check readability of file in question Reviewed-by: sla, dholmes, olagneau
jdk/test/com/sun/jdi/JdbReadTwiceTest.sh
--- a/jdk/test/com/sun/jdi/JdbReadTwiceTest.sh	Mon Jan 27 15:11:56 2014 +0400
+++ b/jdk/test/com/sun/jdi/JdbReadTwiceTest.sh	Mon Jan 27 17:13:16 2014 +0400
@@ -213,10 +213,17 @@
     # If the file exists, we try to read it.  The
     # read will fail.
     mkFiles $HOME/jdb.ini
-        chmod a-r $HOME/jdb.ini
-        doit
-        failIfNot 1 "open: $HOME/jdb.ini"
-        clean
+    id > $HOME/jdb.ini
+    chmod a-r $HOME/jdb.ini
+    if grep -q "uid=" $HOME/jdb.ini  ; then
+      echo "Unable to make file unreadable, so test will fail. chmod: $HOME/jdb.ini"
+      if grep -q "uid=0" $HOME/jdb.ini  ; then
+        echo "The test is running as root. Fix infrastructure!"
+      fi	
+    fi  
+    doit
+    failIfNot 1 "open: $HOME/jdb.ini"
+    clean
 fi