From 77bcb60eeefa220cbe5597db83ceeccfc7454163 Mon Sep 17 00:00:00 2001 From: Rob McKenna Date: Mon, 10 Feb 2014 14:35:42 +0000 Subject: [PATCH] 7152892: some jtreg tests fail with permission denied Reviewed-by: coffeys --- jdk/test/java/lang/ClassLoader/Assert.sh | 16 ++++++++++++++++ jdk/test/java/rmi/registry/readTest/readTest.sh | 4 ++++ jdk/test/java/util/zip/ZipFile/ReadZip.java | 2 ++ jdk/test/sun/net/www/protocol/jar/jarbug/run.sh | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/jdk/test/java/lang/ClassLoader/Assert.sh b/jdk/test/java/lang/ClassLoader/Assert.sh index 812e6f43340..e65e6b8176f 100644 --- a/jdk/test/java/lang/ClassLoader/Assert.sh +++ b/jdk/test/java/lang/ClassLoader/Assert.sh @@ -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 @@ echo "CLASSPATH=${CLASSPATH}" cp ${TESTSRC}/Assert.java . cp -R ${TESTSRC}/package1 . cp -R ${TESTSRC}/package2 . +${CHMOD} -R u+w * ${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} Assert.java diff --git a/jdk/test/java/rmi/registry/readTest/readTest.sh b/jdk/test/java/rmi/registry/readTest/readTest.sh index 812d0a42b54..b43b2b59ba1 100644 --- a/jdk/test/java/rmi/registry/readTest/readTest.sh +++ b/jdk/test/java/rmi/registry/readTest/readTest.sh @@ -37,11 +37,13 @@ case "$OS" in 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 @@ case "$OS" in 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 @@ esac 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 diff --git a/jdk/test/java/util/zip/ZipFile/ReadZip.java b/jdk/test/java/util/zip/ZipFile/ReadZip.java index b0e757158f7..44f1d9ed97f 100644 --- a/jdk/test/java/util/zip/ZipFile/ReadZip.java +++ b/jdk/test/java/util/zip/ZipFile/ReadZip.java @@ -63,6 +63,8 @@ public class ReadZip { 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)) { diff --git a/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh b/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh index 69632014bac..32de6ee0f78 100644 --- a/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh +++ b/jdk/test/sun/net/www/protocol/jar/jarbug/run.sh @@ -34,14 +34,17 @@ case "$OS" in 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 @@ esac 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 \