test/tools/javah/MissingParamClassTest.sh

changeset 1591
dc8b7aa7cef3
parent 1590
011cf7e0a148
child 1592
9345394ac8fe
     1.1 --- a/test/tools/javah/MissingParamClassTest.sh	Tue Feb 19 00:31:45 2013 -0800
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,124 +0,0 @@
     1.4 -#!/bin/sh
     1.5 -
     1.6 -#
     1.7 -# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
     1.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9 -#
    1.10 -# This code is free software; you can redistribute it and/or modify it
    1.11 -# under the terms of the GNU General Public License version 2 only, as
    1.12 -# published by the Free Software Foundation.
    1.13 -#
    1.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 -# version 2 for more details (a copy is included in the LICENSE file that
    1.18 -# accompanied this code).
    1.19 -#
    1.20 -# You should have received a copy of the GNU General Public License version
    1.21 -# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 -#
    1.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 -# or visit www.oracle.com if you need additional information or have any
    1.26 -# questions.
    1.27 -#
    1.28 -
    1.29 -# @test	
    1.30 -#
    1.31 -# @bug 4942232
    1.32 -
    1.33 -#
    1.34 -# Verifies that javah won't attempt to generate a header file
    1.35 -# if a native method in a supplied class contains a parameter
    1.36 -# type whose corresponding class is missing or not in the 
    1.37 -# classpath
    1.38 -
    1.39 -TMP1=OUTPUT.txt
    1.40 -
    1.41 -if [ "${TESTSRC}" = "" ]
    1.42 -then
    1.43 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
    1.44 -  exit 1
    1.45 -fi
    1.46 -echo "TESTSRC=${TESTSRC}"
    1.47 -if [ "${TESTJAVA}" = "" ]
    1.48 -then
    1.49 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
    1.50 -  exit 1
    1.51 -fi
    1.52 -echo "TESTJAVA=${TESTJAVA}"
    1.53 -if [ "${TESTCLASSES}" = "" ]
    1.54 -then
    1.55 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
    1.56 -  exit 1
    1.57 -fi
    1.58 -echo "TESTCLASSES=${TESTCLASSES}"
    1.59 -echo "CLASSPATH=${CLASSPATH}"
    1.60 -
    1.61 -# set platform-dependent variables
    1.62 -OS=`uname -s`
    1.63 -case "$OS" in
    1.64 -  SunOS | Linux | Darwin | CYGWIN* )
    1.65 -    PS=":"
    1.66 -    FS="/"
    1.67 -    ;;
    1.68 -  Windows* )
    1.69 -    PS=";"
    1.70 -    FS="\\"
    1.71 -    ;;
    1.72 -  * )
    1.73 -    echo "Unrecognized system!"
    1.74 -    exit 1;
    1.75 -    ;;
    1.76 - esac
    1.77 -
    1.78 -GENERATED_HEADER_FILE=ParamClassTest.h
    1.79 -
    1.80 -rm -f ParamClassTest.class MissingParamClassException.class ParamClassTest.h
    1.81 -rm -f ${TMP1}
    1.82 -
    1.83 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
    1.84 -
    1.85 -# Before running javah remove dependent class file
    1.86 -rm -f MissingParamClassException.class 
    1.87 -
    1.88 -"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
    1.89 -
    1.90 -if [ -f $GENERATED_HEADER_FILE ]; then
    1.91 -     echo "1-- Failed: $GENERATED_HEADER_FILE found"
    1.92 -     rc=1
    1.93 -fi
    1.94 -if [ ! -s ${TMP1} ]; then
    1.95 -     echo "1-- Failed: ${TMP1} is empty"
    1.96 -     rc=1
    1.97 -fi
    1.98 -
    1.99 -# Clean out work dir
   1.100 -rm -f MissingParamClassException.class ParamClassTest.class
   1.101 -rm -f $GENERATED_HEADER_FILE $TMP1 
   1.102 -
   1.103 -# Re-compile everything
   1.104 -
   1.105 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
   1.106 -
   1.107 -
   1.108 -# Before re-run of javah remove dependent class file Param.class 
   1.109 -rm -f Param.class
   1.110 -
   1.111 -"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
   1.112 -
   1.113 -if [ -f $GENERATED_HEADER_FILE ]; then
   1.114 -     echo "2-- Failed: $GENERATED_HEADER_FILE found"
   1.115 -     rc=1
   1.116 -fi
   1.117 -if [ ! -s ${TMP1} ]; then
   1.118 -     echo "2-- Failed: ${TMP1} is empty"
   1.119 -     rc=1
   1.120 -fi
   1.121 -
   1.122 -if [ "$rc" = "" ]; then
   1.123 -    echo Passed
   1.124 -else
   1.125 -    echo Failed
   1.126 -    exit 1
   1.127 -fi

mercurial