test/tools/javah/ConstMacroTest.sh

Thu, 09 Oct 2008 16:21:04 +0100

author
mcimadamore
date
Thu, 09 Oct 2008 16:21:04 +0100
changeset 138
d766e40e49d6
parent 1
9a66ca7c79fa
child 388
477c5bf1149c
permissions
-rw-r--r--

6586091: javac crashes with StackOverflowError
Summary: Types.adapt should avoid infinite loops by exploiting a local cache
Reviewed-by: jjg

     1 #!/bin/sh
     3 #
     4 # Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
     5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6 #
     7 # This code is free software; you can redistribute it and/or modify it
     8 # under the terms of the GNU General Public License version 2 only, as
     9 # published by the Free Software Foundation.
    10 #
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14 # version 2 for more details (a copy is included in the LICENSE file that
    15 # accompanied this code).
    16 #
    17 # You should have received a copy of the GNU General Public License version
    18 # 2 along with this work; if not, write to the Free Software Foundation,
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20 #
    21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22 # CA 95054 USA or visit www.sun.com if you need additional information or
    23 # have any questions.
    24 #
    26 # @test	
    27 #
    28 # @bug 4786406 4781221 4780341 6214324
    30 # Validates rewritten javah handling of class defined constants
    31 # and ensures that the appropriate macro definitions are placed
    32 # in the generated header file.
    34 if [ "${TESTSRC}" = "" ]
    35 then
    36   echo "TESTSRC not set.  Test cannot execute.  Failed."
    37   exit 1
    38 fi
    39 echo "TESTSRC=${TESTSRC}"
    40 if [ "${TESTJAVA}" = "" ]
    41 then
    42   echo "TESTJAVA not set.  Test cannot execute.  Failed."
    43   exit 1
    44 fi
    45 echo "TESTJAVA=${TESTJAVA}"
    46 if [ "${TESTCLASSES}" = "" ]
    47 then
    48   echo "TESTCLASSES not set.  Test cannot execute.  Failed."
    49   exit 1
    50 fi
    51 echo "TESTCLASSES=${TESTCLASSES}"
    52 echo "CLASSPATH=${CLASSPATH}"
    54 EXPECTED_JAVAH_OUT_FILE=SubClassConsts.out
    56 # set platform-dependent variables
    57 OS=`uname -s`
    58 case "$OS" in
    59   SunOS | Linux )
    60     NULL=/dev/null
    61     PS=":"
    62     FS="/"
    63     ;;
    64   Windows* )
    65     NULL=NUL
    66     PS=";"
    67     FS="\\"
    68     EXPECTED_JAVAH_OUT_FILE=SubClassConsts.win
    69     ;;
    70   * )
    71     echo "Unrecognized system!"
    72     exit 1;
    73     ;;
    74  esac
    76 GENERATED_HEADER_FILE=SubClassConsts.h
    77 HEADER_FILE_FILTERED=SubClassConsts.h.linefeed-filtered
    79 rm -rf SuperClassConsts.class SubClassConsts.class
    81 cp "${TESTSRC}${FS}SuperClassConsts.java" .
    82 cp "${TESTSRC}${FS}SubClassConsts.java" .
    84 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}SubClassConsts.java"
    86 "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} SubClassConsts
    88 cmp  "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
    89 result=$?
    90 rm ${GENERATED_HEADER_FILE}
    92 if [ $result -eq 0 ]
    93 then
    94   echo "Passed"
    95 else
    96   echo "Failed"
    97 fi
    98 exit $result

mercurial