jdk/test/java/util/PluggableLocale/ExecTest.sh
author xuelei
Fri, 29 Jul 2011 02:50:58 -0700
changeset 10138 b7572da25d15
parent 7668 d4a77089c587
child 12047 320a714614e9
permissions -rw-r--r--
7068662: Reserve and restore the default locale Reviewed-by: alanb, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
# 
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 5506
diff changeset
     2
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4662
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4662
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4662
diff changeset
    21
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
# This script is the actual launcher of each locale service provider test.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
# fooprovider.jar contains localized object providers and barprovider.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
# contains localized name providers.  This way, we can test providers that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# can relate to each other (such as, DateFormatSymbolsProvider and 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
# TimeZoneNameProvider) separately.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
# Parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#    providersToTest: [foo|bar|foobar]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#    java class name: <class name>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#    providersInExtDir: [true|false]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
if [ "${TESTSRC}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  echo "TESTSRC not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
echo "TESTSRC=${TESTSRC}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
if [ "${TESTJAVA}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
echo "TESTJAVA=${TESTJAVA}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
if [ "${TESTCLASSES}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
echo "TESTCLASSES=${TESTCLASSES}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
echo "CLASSPATH=${CLASSPATH}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
# set platform-dependent variables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
OS=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
case "$OS" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  SunOS | Linux )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    PS=":"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    FS="/"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    ;;
4662
49b8cbe45e6a 6911108: These tests do not work with CYGWIN: java/util
ohair
parents: 2
diff changeset
    65
  Windows* | CYGWIN* )
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    PS=";"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    FS="\\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    ;;
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
# set classpath and extension directory variables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
if [ -d ${TESTJAVA}${FS}lib${FS}ext ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    EXTDIRS="${TESTJAVA}${FS}lib${FS}ext${PS}${TESTCLASSES}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    EXTDIRS="${TESTJAVA}${FS}jre${FS}lib${FS}ext${PS}${TESTCLASSES}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
case "$1" in 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  "foo" )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
  "bar" )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
  "foobar" )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
# compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
cp ${TESTSRC}${FS}ProviderTest.java .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
cp ${TESTSRC}${FS}$2.java .
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
COMPILE="${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
echo ${COMPILE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
${COMPILE}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
result=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
if [ $result -eq 0 ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  echo "Compilation of the test case was successful."
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
else 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  echo "Compilation of the test case failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  # Cleanup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  rm -f ${TESTCLASSES}${FS}$2*.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
  rm -f ${TESTCLASSES}${FS}fooprovider.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  rm -f ${TESTCLASSES}${FS}barprovider.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  exit $result
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
# run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
if [ "$3" = "true" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
  RUNCMD="${TESTJAVA}${FS}bin${FS}java -Djava.ext.dirs=${EXTDIRS} $2 "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
  RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${CLASSPATHARG} $2 "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
echo ${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
result=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
if [ $result -eq 0 ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  echo "Execution successful"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  echo "Execution of the test case failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
# Cleanup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
rm -f ${TESTCLASSES}${FS}$2*.class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
rm -f ${TESTCLASSES}${FS}fooprovider.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
rm -f ${TESTCLASSES}${FS}barprovider.jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
exit $result