jdk/test/java/util/Currency/PropertiesTest.sh
author nishjain
Fri, 20 May 2016 13:48:58 +0900
changeset 38440 9e77c5b81def
parent 36859 1a821b9a7245
permissions -rw-r--r--
7102969: currency.properties supercede not working correctly 8149452: j.t.SimpleDateFormat.getDateFormatSymbols().getZoneStrings() returns incorrect result for some time zones 8157138: Error while fetching currency instance by Currency.getInstance(currencycode) Reviewed-by: naoto, okutsu, peytoia
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
     2
36859
1a821b9a7245 8149735: PropertiesTest.sh fails
rgoel
parents: 34431
diff changeset
     3
# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
     5
#
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
     8
# published by the Free Software Foundation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
#
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    14
# accompanied this code).
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    15
#
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    16
# You should have received a copy of the GNU General Public License version
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    19
#
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    22
# questions.
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    23
#
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    24
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
# @test
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
    26
# @bug 6332666 6863624 7180362 8003846 8074350 8074351 8130246 8149735 7102969
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
    27
#      8157138
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
# @summary tests the capability of replacing the currency data with user
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#     specified currency properties file
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# @build PropertiesTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
# @run shell/timeout=600 PropertiesTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
if [ "${TESTSRC}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  echo "TESTSRC not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
echo "TESTSRC=${TESTSRC}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
if [ "${TESTJAVA}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
echo "TESTJAVA=${TESTJAVA}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
if [ "${TESTCLASSES}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
echo "TESTCLASSES=${TESTCLASSES}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
echo "CLASSPATH=${CLASSPATH}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
# set platform-dependent variables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
OS=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
case "$OS" in
22602
0d9a07b0d7e9 8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents: 18539
diff changeset
    56
  SunOS | Linux | Darwin | AIX )
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    PS=":"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    FS="/"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    ;;
18539
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
    60
  Windows* )
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    PS=";"
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    62
    FS="/"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    ;;
18539
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
    64
  CYGWIN* )
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
    65
    PS=";"
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
    66
    FS="/"
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
    67
    TESTJAVA=`cygpath -u ${TESTJAVA}`
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
    68
    ;;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    echo "Unrecognized system!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    exit 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    75
failures=0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    77
run() {
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    78
    echo ''
34431
0b471e6f3fce 8130246: java/util/Currency/PropertiesTest.sh fails Exception java.lang.NullPointerException
rgoel
parents: 33404
diff changeset
    79
    ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $* 2>&1
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    80
    if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    81
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    83
PROPS=${TESTSRC}${FS}currency.properties
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    84
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    85
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    86
# Dump built-in currency data
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    88
run PropertiesTest -d dump1
36859
1a821b9a7245 8149735: PropertiesTest.sh fails
rgoel
parents: 34431
diff changeset
    89
if [ ! -f dump1 ]; then  echo "file dump1 not created. Test cannot execute.  Failed."; exit 1; fi
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    90
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    91
# Dump built-in currency data + overrides in properties file specified
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    92
# by system property.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    94
run -Djava.util.currency.data=${PROPS} PropertiesTest -d dump2
36859
1a821b9a7245 8149735: PropertiesTest.sh fails
rgoel
parents: 34431
diff changeset
    95
if [ ! -f dump2 ]; then  echo "file dump2 not created. Test cannot execute.  Failed."; exit 1; fi
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    96
run PropertiesTest -c dump1 dump2 ${PROPS}
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    97
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    98
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
    99
# Dump built-in currency data + overrides in properties file copied into
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   100
# JRE image.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
25994
01dbe01af8e5 8055253: test/java/util/Currency/PropertiesTest.sh modifies the test JDK
martin
parents: 22602
diff changeset
   102
# Make a private copy of the jdk so we can write to the properties file location
01dbe01af8e5 8055253: test/java/util/Currency/PropertiesTest.sh modifies the test JDK
martin
parents: 22602
diff changeset
   103
# without disturbing other users, including concurrently executing tests.
01dbe01af8e5 8055253: test/java/util/Currency/PropertiesTest.sh modifies the test JDK
martin
parents: 22602
diff changeset
   104
WRITABLEJDK=.${FS}testjava
26189
1868b96bbc6e 8055675: java/util/Currency/PropertiesTest.sh fails on OS X after JDK-8055253
martin
parents: 25994
diff changeset
   105
cp -H -R $TESTJAVA $WRITABLEJDK || exit 1
33404
4d65de89ebde 8061287: Update i18n tests to remove references of jre dir
naoto
parents: 29524
diff changeset
   106
PROPLOCATION=${WRITABLEJDK}${FS}lib
36859
1a821b9a7245 8149735: PropertiesTest.sh fails
rgoel
parents: 34431
diff changeset
   107
chmod -R a+rx $WRITABLEJDK || exit 1
26189
1868b96bbc6e 8055675: java/util/Currency/PropertiesTest.sh fails on OS X after JDK-8055253
martin
parents: 25994
diff changeset
   108
cp ${PROPS} $PROPLOCATION || exit 1
18539
cc30fa6fcf7c 6863624: java/util/Currency/PropertiesTest.sh writable check is incorrect
naoto
parents: 14786
diff changeset
   109
echo "Properties location: ${PROPLOCATION}"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
# run
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   112
echo ''
34431
0b471e6f3fce 8130246: java/util/Currency/PropertiesTest.sh fails Exception java.lang.NullPointerException
rgoel
parents: 33404
diff changeset
   113
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   114
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
36859
1a821b9a7245 8149735: PropertiesTest.sh fails
rgoel
parents: 34431
diff changeset
   115
if [ ! -f dump3 ]; then  echo "file dump3 not created. Test cannot execute.  Failed."; exit 1; fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
38440
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   117
# run bug7102969 test
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   118
echo ''
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   119
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug7102969
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   120
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   121
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   122
# run bug8157138 test
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   123
echo ''
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   124
${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8157138
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   125
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
9e77c5b81def 7102969: currency.properties supercede not working correctly
nishjain
parents: 36859
diff changeset
   126
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
# Cleanup
25994
01dbe01af8e5 8055253: test/java/util/Currency/PropertiesTest.sh modifies the test JDK
martin
parents: 22602
diff changeset
   128
rm -rf $WRITABLEJDK
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
14697
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   130
# compare the two dump files
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   131
run PropertiesTest -c dump1 dump3 ${PROPS}
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   132
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   133
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   134
# Results
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   135
echo ''
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   136
if [ $failures -gt 0 ];
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   137
  then echo "$failures tests failed";
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   138
  else echo "All tests passed"; fi
6ed46ffc2d33 8003846: Override mechanism for currency data should not require creating currency.properties in java.home
alanb
parents: 13790
diff changeset
   139
exit $failures