2013-06-03 10:44:10 -04:00
|
|
|
#!/bin/sh
|
2012-03-06 20:34:38 +00:00
|
|
|
#
|
2012-11-02 15:50:11 +00:00
|
|
|
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2012-03-06 20:34:38 +00:00
|
|
|
#
|
2007-12-01 00:00:00 +00:00
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation.
|
2012-03-06 20:34:38 +00:00
|
|
|
#
|
2007-12-01 00:00:00 +00:00
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
2012-03-06 20:34:38 +00:00
|
|
|
#
|
2007-12-01 00:00:00 +00:00
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-03-06 20:34:38 +00:00
|
|
|
#
|
2010-05-25 15:58:33 -07:00
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This script is the actual launcher of each locale service provider test.
|
|
|
|
# fooprovider.jar contains localized object providers and barprovider.jar
|
|
|
|
# contains localized name providers. This way, we can test providers that
|
2012-03-06 20:34:38 +00:00
|
|
|
# can relate to each other (such as, DateFormatSymbolsProvider and
|
2007-12-01 00:00:00 +00:00
|
|
|
# TimeZoneNameProvider) separately.
|
2012-03-06 20:34:38 +00:00
|
|
|
#
|
2007-12-01 00:00:00 +00:00
|
|
|
# Parameters:
|
|
|
|
# providersToTest: [foo|bar|foobar]
|
|
|
|
# java class name: <class name>
|
|
|
|
# providersInExtDir: [true|false]
|
|
|
|
|
|
|
|
if [ "${TESTSRC}" = "" ]
|
|
|
|
then
|
|
|
|
echo "TESTSRC not set. Test cannot execute. Failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "TESTSRC=${TESTSRC}"
|
|
|
|
if [ "${TESTJAVA}" = "" ]
|
|
|
|
then
|
|
|
|
echo "TESTJAVA not set. Test cannot execute. Failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-01-11 20:19:55 +00:00
|
|
|
if [ "${COMPILEJAVA}" = "" ]
|
|
|
|
then
|
|
|
|
COMPILEJAVA="${TESTJAVA}"
|
|
|
|
fi
|
2007-12-01 00:00:00 +00:00
|
|
|
echo "TESTJAVA=${TESTJAVA}"
|
|
|
|
if [ "${TESTCLASSES}" = "" ]
|
|
|
|
then
|
|
|
|
echo "TESTCLASSES not set. Test cannot execute. Failed."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "TESTCLASSES=${TESTCLASSES}"
|
|
|
|
echo "CLASSPATH=${CLASSPATH}"
|
|
|
|
|
|
|
|
# set platform-dependent variables
|
|
|
|
OS=`uname -s`
|
|
|
|
case "$OS" in
|
2014-01-17 21:54:30 +01:00
|
|
|
SunOS | Linux | Darwin | AIX )
|
2007-12-01 00:00:00 +00:00
|
|
|
PS=":"
|
|
|
|
FS="/"
|
|
|
|
;;
|
2010-01-04 15:52:38 -08:00
|
|
|
Windows* | CYGWIN* )
|
2007-12-01 00:00:00 +00:00
|
|
|
PS=";"
|
|
|
|
FS="\\"
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
echo "Unrecognized system!"
|
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# set classpath and extension directory variables
|
|
|
|
if [ -d ${TESTJAVA}${FS}lib${FS}ext ]
|
|
|
|
then
|
|
|
|
EXTDIRS="${TESTJAVA}${FS}lib${FS}ext${PS}${TESTCLASSES}"
|
|
|
|
else
|
|
|
|
EXTDIRS="${TESTJAVA}${FS}jre${FS}lib${FS}ext${PS}${TESTCLASSES}"
|
|
|
|
fi
|
|
|
|
|
2012-03-06 20:34:38 +00:00
|
|
|
case "$1" in
|
2007-12-01 00:00:00 +00:00
|
|
|
"foo" )
|
|
|
|
cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
|
|
|
|
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar"
|
|
|
|
;;
|
|
|
|
"bar" )
|
|
|
|
cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
|
|
|
|
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
|
|
|
|
;;
|
|
|
|
"foobar" )
|
|
|
|
cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
|
|
|
|
cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
|
|
|
|
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
|
|
|
|
;;
|
|
|
|
esac
|
2012-03-06 20:34:38 +00:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
# compile
|
|
|
|
cp ${TESTSRC}${FS}ProviderTest.java .
|
|
|
|
cp ${TESTSRC}${FS}$2.java .
|
2013-01-11 20:19:55 +00:00
|
|
|
COMPILE="${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
|
|
|
|
-XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java"
|
2007-12-01 00:00:00 +00:00
|
|
|
echo ${COMPILE}
|
|
|
|
${COMPILE}
|
|
|
|
result=$?
|
|
|
|
|
|
|
|
if [ $result -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "Compilation of the test case was successful."
|
2012-03-06 20:34:38 +00:00
|
|
|
else
|
2007-12-01 00:00:00 +00:00
|
|
|
echo "Compilation of the test case failed."
|
|
|
|
# Cleanup
|
|
|
|
rm -f ${TESTCLASSES}${FS}$2*.class
|
|
|
|
rm -f ${TESTCLASSES}${FS}fooprovider.jar
|
|
|
|
rm -f ${TESTCLASSES}${FS}barprovider.jar
|
|
|
|
exit $result
|
|
|
|
fi
|
|
|
|
|
|
|
|
# run
|
|
|
|
if [ "$3" = "true" ]
|
|
|
|
then
|
2012-12-13 14:47:35 +00:00
|
|
|
RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djava.ext.dirs=${EXTDIRS} $2 "
|
2007-12-01 00:00:00 +00:00
|
|
|
else
|
2012-12-13 14:47:35 +00:00
|
|
|
RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 "
|
2007-12-01 00:00:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ${RUNCMD}
|
|
|
|
${RUNCMD}
|
|
|
|
result=$?
|
|
|
|
|
|
|
|
if [ $result -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "Execution successful"
|
|
|
|
else
|
|
|
|
echo "Execution of the test case failed."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm -f ${TESTCLASSES}${FS}$2*.class
|
|
|
|
rm -f ${TESTCLASSES}${FS}fooprovider.jar
|
|
|
|
rm -f ${TESTCLASSES}${FS}barprovider.jar
|
|
|
|
|
|
|
|
exit $result
|