Path: blob/master/test/jdk/java/util/Currency/PropertiesTest.sh
41152 views
#!/bin/sh12# Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 2 along with this work; if not, write to the Free Software Foundation,17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18#19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20# or visit www.oracle.com if you need additional information or have any21# questions.22#2324# @test25# @bug 6332666 6863624 7180362 8003846 8074350 8074351 8130246 8149735 710296926# 8157138 819090427# @summary tests the capability of replacing the currency data with user28# specified currency properties file29# @build PropertiesTest30# @run shell/timeout=600 PropertiesTest.sh3132if [ "${TESTSRC}" = "" ]33then34echo "TESTSRC not set. Test cannot execute. Failed."35exit 136fi37echo "TESTSRC=${TESTSRC}"38if [ "${TESTJAVA}" = "" ]39then40echo "TESTJAVA not set. Test cannot execute. Failed."41exit 142fi43echo "TESTJAVA=${TESTJAVA}"44if [ "${TESTCLASSES}" = "" ]45then46echo "TESTCLASSES not set. Test cannot execute. Failed."47exit 148fi49echo "TESTCLASSES=${TESTCLASSES}"50echo "CLASSPATH=${CLASSPATH}"5152# set platform-dependent variables53OS=`uname -s`54case "$OS" in55Linux | Darwin | AIX )56PS=":"57FS="/"58;;59Windows* )60PS=";"61FS="/"62;;63CYGWIN* )64PS=";"65FS="/"66TESTJAVA=`cygpath -u ${TESTJAVA}`67;;68* )69echo "Unrecognized system!"70exit 1;71;;72esac7374failures=07576run() {77echo ''78${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $* 2>&179if [ $? != 0 ]; then failures=`expr $failures + 1`; fi80}8182PROPS=${TESTSRC}${FS}currency.properties838485# Dump built-in currency data8687run PropertiesTest -d dump188if [ ! -f dump1 ]; then echo "file dump1 not created. Test cannot execute. Failed."; exit 1; fi8990# Dump built-in currency data + overrides in properties file specified91# by system property.9293run -Djava.util.currency.data=${PROPS} PropertiesTest -d dump294if [ ! -f dump2 ]; then echo "file dump2 not created. Test cannot execute. Failed."; exit 1; fi95run PropertiesTest -c dump1 dump2 ${PROPS}969798# Dump built-in currency data + overrides in properties file copied into99# JRE image.100101# Make a private copy of the jdk so we can write to the properties file location102# without disturbing other users, including concurrently executing tests.103WRITABLEJDK=.${FS}testjava104cp -H -R $TESTJAVA $WRITABLEJDK || exit 1105PROPLOCATION=${WRITABLEJDK}${FS}lib106chmod -R u+w $WRITABLEJDK || exit 1107cp ${PROPS} $PROPLOCATION || exit 1108echo "Properties location: ${PROPLOCATION}"109110# run111echo ''112${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3113if [ $? != 0 ]; then failures=`expr $failures + 1`; fi114if [ ! -f dump3 ]; then echo "file dump3 not created. Test cannot execute. Failed."; exit 1; fi115116# run bug7102969 test117echo ''118${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug7102969119if [ $? != 0 ]; then failures=`expr $failures + 1`; fi120121# run bug8157138 test122echo ''123${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8157138124if [ $? != 0 ]; then failures=`expr $failures + 1`; fi125126# run bug8190904 test127echo ''128${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8190904129if [ $? != 0 ]; then failures=`expr $failures + 1`; fi130131# Cleanup132rm -rf $WRITABLEJDK133134# compare the two dump files135run PropertiesTest -c dump1 dump3 ${PROPS}136137138# Results139echo ''140if [ $failures -gt 0 ];141then echo "$failures tests failed";142else echo "All tests passed"; fi143exit $failures144145146