jdk/test/java/util/Currency/PropertiesTest.sh
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 4662 49b8cbe45e6a
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
# @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
# @bug 6332666
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# @summary tests the capability of replacing the currency data with user
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#     specified currency properties file
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# @build PropertiesTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# @run shell/timeout=600 PropertiesTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
if [ "${TESTSRC}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
  echo "TESTSRC not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
echo "TESTSRC=${TESTSRC}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
if [ "${TESTJAVA}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
echo "TESTJAVA=${TESTJAVA}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
if [ "${TESTCLASSES}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
echo "TESTCLASSES=${TESTCLASSES}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
echo "CLASSPATH=${CLASSPATH}"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# set platform-dependent variables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
OS=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
case "$OS" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
  SunOS | Linux )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
    PS=":"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
    FS="/"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  Windows* )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    PS=";"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    FS="\\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    echo "Unrecognized system!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    exit 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
# Currency dump path #1.  Just dump currencies with the bare JRE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
# run
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
RUNCMD="${TESTJAVA}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -d dump1"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
echo ${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
result=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
if [ $result -eq 0 ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  echo "Execution successful"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  echo "Execution of the test case failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
# Currency dump path #2.  Dump currencies using the JRE with replacement currencies
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
# copy the test properties file
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
COPIED=0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
if [ -w $TESTJAVA ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
then 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  WRITABLEJDK=$TESTJAVA
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  WRITABLEJDK=.${FS}testjava 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  cp -r $TESTJAVA $WRITABLEJDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  COPIED=1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
if [ -d ${WRITABLEJDK}${FS}jre ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  PROPLOCATION=${WRITABLEJDK}${FS}lib
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
cp ${TESTSRC}${FS}currency.properties $PROPLOCATION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
# run
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
RUNCMD="${WRITABLEJDK}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -d dump2"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
echo ${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
result=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
if [ $result -eq 0 ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  echo "Execution successful"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  echo "Execution of the test case failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
# Now compare the two dump files
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
RUNCMD="${WRITABLEJDK}${FS}bin${FS}java -classpath ${TESTCLASSES} PropertiesTest -c dump1 dump2"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
echo ${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
${RUNCMD}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
result=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
if [ $result -eq 0 ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  echo "Execution successful"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  echo "Execution of the test case failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
# Cleanup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
rm -f dump1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
rm -f dump2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
rm -f ${PROPLOCATION}${FS}currency.properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
if [ $COPIED -eq 1 ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  rm -rf $WRITABLEJDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
exit $result