8055253: test/java/util/Currency/PropertiesTest.sh modifies the test JDK
Summary: Always make a temp copy of the test JDK before destructively modifying
Reviewed-by: naoto, alanb
--- a/jdk/test/TEST.ROOT Mon Aug 18 20:09:25 2014 -0700
+++ b/jdk/test/TEST.ROOT Mon Aug 18 21:06:45 2014 -0700
@@ -8,7 +8,7 @@
othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces
# Tests that cannot run concurrently
-exclusiveAccess.dirs=java/rmi/Naming java/util/Currency java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
+exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
# Group definitions
groups=TEST.groups [closed/TEST.groups]
--- a/jdk/test/java/util/Currency/PropertiesTest.sh Mon Aug 18 20:09:25 2014 -0700
+++ b/jdk/test/java/util/Currency/PropertiesTest.sh Mon Aug 18 21:06:45 2014 -0700
@@ -97,25 +97,16 @@
# Dump built-in currency data + overrides in properties file copied into
# JRE image.
-# Copy the test properties file. If testjava is not a typical jdk-image
-# or testjava is not writable, make a private copy of it.
-COPIED=0
-if [ -w ${TESTJAVA}${FS}jre${FS}lib ]
-then
- WRITABLEJDK=$TESTJAVA
+# Make a private copy of the jdk so we can write to the properties file location
+# without disturbing other users, including concurrently executing tests.
+WRITABLEJDK=.${FS}testjava
+cp -Hr $TESTJAVA $WRITABLEJDK
+if [ -d ${TESTJAVA}${FS}jre ]; then
PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
else
- WRITABLEJDK=.${FS}testjava
- if [ -d ${TESTJAVA}${FS}jre ]
- then
- PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
- else
- PROPLOCATION=${WRITABLEJDK}${FS}lib
- fi
- cp -r $TESTJAVA $WRITABLEJDK
- chmod -R +w $WRITABLEJDK
- COPIED=1
+ PROPLOCATION=${WRITABLEJDK}${FS}lib
fi
+chmod -R +w $WRITABLEJDK
cp ${PROPS} $PROPLOCATION
echo "Properties location: ${PROPLOCATION}"
@@ -125,11 +116,7 @@
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
# Cleanup
-rm -f ${PROPLOCATION}${FS}currency.properties
-if [ $COPIED -eq 1 ]
-then
- rm -rf $WRITABLEJDK
-fi
+rm -rf $WRITABLEJDK
# compare the two dump files
run PropertiesTest -c dump1 dump3 ${PROPS}