annotate test/tools/javah/MissingParamClassTest.sh @ 403:14735c7932d7

6884624: Update copyright year Summary: Update copyright for files that have been modified in 2009 through Septermber Reviewed-by: tbell, ohair
author xdono
date Tue, 22 Sep 2009 14:06:29 -0700
parents 477c5bf1149c
children 4776a869fdfa
rev   line source
duke@0 1 #!/bin/sh
duke@0 2
duke@0 3 #
xdono@403 4 # Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@0 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 6 #
duke@0 7 # This code is free software; you can redistribute it and/or modify it
duke@0 8 # under the terms of the GNU General Public License version 2 only, as
duke@0 9 # published by the Free Software Foundation.
duke@0 10 #
duke@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 15 # accompanied this code).
duke@0 16 #
duke@0 17 # You should have received a copy of the GNU General Public License version
duke@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 20 #
duke@0 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 23 # have any questions.
duke@0 24 #
duke@0 25
duke@0 26 # @test
duke@0 27 #
duke@0 28 # @bug 4942232
duke@0 29
duke@0 30 #
duke@0 31 # Verifies that javah won't attempt to generate a header file
duke@0 32 # if a native method in a supplied class contains a parameter
duke@0 33 # type whose corresponding class is missing or not in the
duke@0 34 # classpath
duke@0 35
duke@0 36 TMP1=OUTPUT.txt
duke@0 37
duke@0 38 if [ "${TESTSRC}" = "" ]
duke@0 39 then
duke@0 40 echo "TESTSRC not set. Test cannot execute. Failed."
duke@0 41 exit 1
duke@0 42 fi
duke@0 43 echo "TESTSRC=${TESTSRC}"
duke@0 44 if [ "${TESTJAVA}" = "" ]
duke@0 45 then
duke@0 46 echo "TESTJAVA not set. Test cannot execute. Failed."
duke@0 47 exit 1
duke@0 48 fi
duke@0 49 echo "TESTJAVA=${TESTJAVA}"
duke@0 50 if [ "${TESTCLASSES}" = "" ]
duke@0 51 then
duke@0 52 echo "TESTCLASSES not set. Test cannot execute. Failed."
duke@0 53 exit 1
duke@0 54 fi
duke@0 55 echo "TESTCLASSES=${TESTCLASSES}"
duke@0 56 echo "CLASSPATH=${CLASSPATH}"
duke@0 57
duke@0 58 # set platform-dependent variables
duke@0 59 OS=`uname -s`
duke@0 60 case "$OS" in
jjg@387 61 SunOS | Linux | CYGWIN* )
duke@0 62 PS=":"
duke@0 63 FS="/"
duke@0 64 ;;
duke@0 65 Windows* )
duke@0 66 PS=";"
duke@0 67 FS="\\"
duke@0 68 ;;
duke@0 69 * )
duke@0 70 echo "Unrecognized system!"
duke@0 71 exit 1;
duke@0 72 ;;
duke@0 73 esac
duke@0 74
duke@0 75 GENERATED_HEADER_FILE=ParamClassTest.h
duke@0 76
duke@0 77 rm -f ParamClassTest.class MissingParamClassException.class ParamClassTest.h
duke@0 78 rm -f ${TMP1}
duke@0 79
duke@0 80 cp ${TESTSRC}${FS}ParamClassTest.java .
duke@0 81 cp ${TESTSRC}${FS}MissingParamClassException.java .
duke@0 82
duke@0 83 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java"
duke@0 84
duke@0 85 # Before running javah remove dependent class file
duke@0 86 rm -f MissingParamClassException.class
duke@0 87
duke@0 88 "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
duke@0 89
duke@0 90 if [ -f $GENERATED_HEADER_FILE ]; then
duke@0 91 echo "Failed"
duke@0 92 exit 1
duke@0 93 fi
duke@0 94 if [ ! -f ${TMP1} ]; then
duke@0 95 echo "Failed"
duke@0 96 exit 1
duke@0 97 else
duke@0 98 echo "Passed"
duke@0 99 exit 0
duke@0 100 fi
duke@0 101
duke@0 102 # Clean out work dir
duke@0 103 rm -f MissingParamClassException.class ParamClassTest.class
duke@0 104 rm -f $GENERATED_HEADER_FILE $TMP1
duke@0 105
duke@0 106 # Re-compile everything
duke@0 107 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}ParamClassTest.java
duke@0 108
duke@0 109 # Before re-run of javah remove dependent class file Param.class
duke@0 110 rm -f Param.class
duke@0 111
duke@0 112 "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
duke@0 113
duke@0 114 if [ -f $GENERATED_HEADER_FILE ]; then
duke@0 115 echo "Failed"
duke@0 116 exit 1
duke@0 117 fi
duke@0 118 if [ ! -f ${TMP1} ]; then
duke@0 119 echo "Failed"
duke@0 120 exit 1
duke@0 121 else
duke@0 122 echo "Passed"
duke@0 123 exit 0
duke@0 124 fi