7152892: some jtreg tests fail with permission denied
authorrobm
Mon, 10 Feb 2014 14:35:42 +0000
changeset 22948 2cf7e7202386
parent 22947 c7d9e7b465f9
child 22949 459e9fe0bbf8
7152892: some jtreg tests fail with permission denied Reviewed-by: coffeys
jdk/test/java/lang/ClassLoader/Assert.sh
jdk/test/java/rmi/registry/readTest/readTest.sh
jdk/test/java/util/zip/ZipFile/ReadZip.java
jdk/test/sun/net/www/protocol/jar/jarbug/run.sh
--- a/jdk/test/java/lang/ClassLoader/Assert.sh	Mon Feb 10 14:01:16 2014 +0100
+++ b/jdk/test/java/lang/ClassLoader/Assert.sh	Mon Feb 10 14:35:42 2014 +0000
@@ -23,6 +23,21 @@
 
 #
 
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux | Darwin )
+    FS="/"
+    CHMOD="${FS}bin${FS}chmod"
+    ;;
+  Windows* | CYGWIN* )
+    CHMOD="chmod"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
 if [ "${TESTSRC}" = "" ]
 then
   echo "TESTSRC not set.  Test cannot execute.  Failed."
@@ -50,6 +65,7 @@
 cp ${TESTSRC}/Assert.java .
 cp -R ${TESTSRC}/package1 .
 cp -R ${TESTSRC}/package2 .
+${CHMOD} -R u+w *
 
 ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} Assert.java 
 
--- a/jdk/test/java/rmi/registry/readTest/readTest.sh	Mon Feb 10 14:01:16 2014 +0100
+++ b/jdk/test/java/rmi/registry/readTest/readTest.sh	Mon Feb 10 14:35:42 2014 +0000
@@ -37,11 +37,13 @@
   SunOS | Linux | Darwin | AIX )
     PS=":"
     FS="/"
+    CHMOD="${FS}bin${FS}chmod"
     FILEURL="file:"
     ;;
   Windows* )
     PS=";"
     FS="\\"
+    CHMOD="chmod"
     FILEURL="file:/"
     if [ "$VER" -eq "5" ]; then
         ARGS="-Djdk.net.ephemeralPortRange.low=1024 -Djdk.net.ephemeralPortRange.high=65000"
@@ -51,6 +53,7 @@
   CYGWIN* )
     PS=";"
     FS="/"
+    CHMOD="chmod"
     FILEURL="file:/"
     if [ "$VER" -eq "5" ]; then
         ARGS="-Djdk.net.ephemeralPortRange.low=1024 -Djdk.net.ephemeralPortRange.high=65000"
@@ -65,6 +68,7 @@
 
 TEST_CLASSPATH=.$PS${TESTCLASSPATH:-$TESTCLASSES}
 cp -r ${TESTSRC}${FS}* .
+${CHMOD} -R u+w *
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} testPkg${FS}*java
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -cp $TEST_CLASSPATH readTest.java
 
--- a/jdk/test/java/util/zip/ZipFile/ReadZip.java	Mon Feb 10 14:01:16 2014 +0100
+++ b/jdk/test/java/util/zip/ZipFile/ReadZip.java	Mon Feb 10 14:35:42 2014 +0000
@@ -63,6 +63,8 @@
         Files.copy(Paths.get(System.getProperty("test.src", ""), "input.zip"),
                    newZip.toPath(), StandardCopyOption.REPLACE_EXISTING);
 
+        newZip.setWritable(true);
+
         // pad some bytes
         try (OutputStream os = Files.newOutputStream(newZip.toPath(),
                                                      StandardOpenOption.APPEND)) {
--- a/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh	Mon Feb 10 14:01:16 2014 +0100
+++ b/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh	Mon Feb 10 14:35:42 2014 +0000
@@ -34,14 +34,17 @@
   SunOS | Linux | Darwin | AIX )
     PS=":"
     FS="/"
+    CHMOD="${FS}bin${FS}chmod"
     ;;
   Windows* )
     PS=";"
     FS="\\"
+    CHMOD="chmod"
     ;;
   CYGWIN* )
     PS=";"
     FS="/"
+    CHMOD="chmod"
     #
     # javac does not like /cygdrive produced by `pwd`.
     #
@@ -59,6 +62,7 @@
 mkdir -p ${DEST}${FS}jar1
 cd ${TESTSRC}${FS}etc${FS}jar1
 cp -r . ${DEST}${FS}jar1
+${CHMOD} -R u+w ${DEST}${FS}jar1
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${DEST}${FS}jar1 \
     ${TESTSRC}${FS}src${FS}jar1${FS}LoadResourceBundle.java
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${DEST}${FS}jar1 \