changeset 11393:aa351c5dc9a2

8002116: This JdbReadTwiceTest.sh gets an exit 1 Summary: Explicitly check readability of file in question Reviewed-by: sla, dholmes, olagneau
author dsamersoff
date Fri, 22 Jan 2016 16:12:17 +0300
parents c1e0c10972f4
children 7236a58e3694
files test/com/sun/jdi/JdbReadTwiceTest.sh
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/jdi/JdbReadTwiceTest.sh	Thu Jan 21 19:21:34 2016 +0000
+++ b/test/com/sun/jdi/JdbReadTwiceTest.sh	Fri Jan 22 16:12:17 2016 +0300
@@ -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