Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/util/Currency/PropertiesTest.sh
47458 views
#!/bin/sh12# Copyright (c) 2007, 2015, 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 807435126# @summary tests the capability of replacing the currency data with user27# specified currency properties file28# @build PropertiesTest29# @run shell/timeout=600 PropertiesTest.sh3031if [ "${TESTSRC}" = "" ]32then33echo "TESTSRC not set. Test cannot execute. Failed."34exit 135fi36echo "TESTSRC=${TESTSRC}"37if [ "${TESTJAVA}" = "" ]38then39echo "TESTJAVA not set. Test cannot execute. Failed."40exit 141fi42echo "TESTJAVA=${TESTJAVA}"43if [ "${TESTCLASSES}" = "" ]44then45echo "TESTCLASSES not set. Test cannot execute. Failed."46exit 147fi48echo "TESTCLASSES=${TESTCLASSES}"49echo "CLASSPATH=${CLASSPATH}"5051# set platform-dependent variables52OS=`uname -s`53case "$OS" in54SunOS | Linux | Darwin | AIX )55PS=":"56FS="/"57;;58Windows* )59PS=";"60FS="/"61;;62CYGWIN* )63PS=";"64FS="/"65TESTJAVA=`cygpath -u ${TESTJAVA}`66;;67* )68echo "Unrecognized system!"69exit 1;70;;71esac7273failures=07475run() {76echo ''77sh -xc "${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} $*" 2>&178if [ $? != 0 ]; then failures=`expr $failures + 1`; fi79}8081PROPS=${TESTSRC}${FS}currency.properties828384# Dump built-in currency data8586run PropertiesTest -d dump1878889# Dump built-in currency data + overrides in properties file specified90# by system property.9192run -Djava.util.currency.data=${PROPS} PropertiesTest -d dump293run PropertiesTest -c dump1 dump2 ${PROPS}949596# Dump built-in currency data + overrides in properties file copied into97# JRE image.9899# Copy the test properties file. If testjava is not a typical jdk-image100# or testjava is not writable, make a private copy of it.101COPIED=0102if [ -w ${TESTJAVA}${FS}jre${FS}lib ]103then104WRITABLEJDK=$TESTJAVA105PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib106else107WRITABLEJDK=.${FS}testjava108if [ -d ${TESTJAVA}${FS}jre ]109then110PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib111else112PROPLOCATION=${WRITABLEJDK}${FS}lib113fi114cp -r $TESTJAVA $WRITABLEJDK115chmod -R +w $WRITABLEJDK116COPIED=1117fi118cp ${PROPS} $PROPLOCATION119echo "Properties location: ${PROPLOCATION}"120121# run122echo ''123sh -xc "${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest -d dump3"124if [ $? != 0 ]; then failures=`expr $failures + 1`; fi125126# Cleanup127rm -f ${PROPLOCATION}${FS}currency.properties128if [ $COPIED -eq 1 ]129then130rm -rf $WRITABLEJDK131fi132133# compare the two dump files134run PropertiesTest -c dump1 dump3 ${PROPS}135136137# Results138echo ''139if [ $failures -gt 0 ];140then echo "$failures tests failed";141else echo "All tests passed"; fi142exit $failures143144145