test/jdk/java/util/TimeZone/TimeZoneDatePermissionCheck.sh
changeset 52551 339963bcff24
parent 52550 65407a437327
parent 52486 6f5948597697
child 52552 1a62b3420c27
equal deleted inserted replaced
52550:65407a437327 52551:339963bcff24
     1 # Testcase for PR381 Stackoverflow error with security manager, signed jars
       
     2 # and -Djava.security.debug set.
       
     3 #
       
     4 # Copyright (c) 2009, Red Hat Inc.
       
     5 #
       
     6 # This code is free software; you can redistribute it and/or modify
       
     7 # it under the terms of the GNU General Public License as published by
       
     8 # the Free Software Foundation; either version 2, or (at your option)
       
     9 # any later version.
       
    10 # 
       
    11 # This code is distributed in the hope that it will be useful, but
       
    12 # WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    14 # General Public License for more details.
       
    15 # 
       
    16 # You should have received a copy of the GNU General Public License version
       
    17 # 2 along with this work; if not, write to the Free Software Foundation,
       
    18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19 #
       
    20 # @test
       
    21 # @bug 6584033
       
    22 # @summary Stackoverflow error with security manager, signed jars and debug.
       
    23 # @build TimeZoneDatePermissionCheck
       
    24 # @run shell TimeZoneDatePermissionCheck.sh
       
    25 
       
    26 # Set default if not run under jtreg from test dir itself
       
    27 if [ "${TESTCLASSES}" = "" ] ; then
       
    28   TESTCLASSES="."
       
    29 fi
       
    30 if [ "${TESTJAVA}" = "" ] ; then
       
    31   TESTJAVA=/usr
       
    32 fi
       
    33 if [ "${COMPILEJAVA}" = "" ]; then
       
    34   COMPILEJAVA="${TESTJAVA}"
       
    35 fi
       
    36 
       
    37 # create a test keystore and dummy cert. Note that we use the COMPILEJAVA
       
    38 # as this test is a TimeZone test, it doesn't test keytool
       
    39 rm -f ${TESTCLASSES}/timezonedatetest.store
       
    40 ${COMPILEJAVA}/bin/keytool ${TESTTOOLVMOPTS} -genkeypair -alias testcert \
       
    41   -keystore ${TESTCLASSES}/timezonedatetest.store \
       
    42   -storepass testpass -validity 360 \
       
    43   -keyalg rsa \
       
    44   -dname "cn=Mark Wildebeest, ou=FreeSoft, o=Red Hat, c=NL" \
       
    45   -keypass testpass
       
    46 
       
    47 # create a jar file to sign with the test class in it.
       
    48 rm -f ${TESTCLASSES}/timezonedatetest.jar
       
    49 ${COMPILEJAVA}/bin/jar ${TESTTOOLVMOPTS} cf \
       
    50   ${TESTCLASSES}/timezonedatetest.jar \
       
    51   -C ${TESTCLASSES} TimeZoneDatePermissionCheck.class
       
    52 
       
    53 # sign it
       
    54 ${COMPILEJAVA}/bin/jarsigner ${TESTTOOLVMOPTS} \
       
    55   -keystore ${TESTCLASSES}/timezonedatetest.store \
       
    56   -storepass testpass ${TESTCLASSES}/timezonedatetest.jar testcert
       
    57 
       
    58 # run it with the security manager on, plus accesscontroller debugging
       
    59 # will go into infinite recursion trying to get enough permissions for
       
    60 # printing Date of failing certificate unless fix is applied.
       
    61 ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.security.manager \
       
    62   -Djava.security.debug=access,failure,policy \
       
    63   -cp ${TESTCLASSES}/timezonedatetest.jar TimeZoneDatePermissionCheck