annotate test/tools/javac/fatalErrors/NoJavaLang.sh @ 1218:d8e7e2ccbd41

7130704: Few of the jtreg tests need to be ported for mac builds Reviewed-by: ohair
author jjh
date Tue, 24 Jan 2012 10:24:42 -0800
parents 9d9f26857129
children d7efb58d0dfd
rev   line source
duke@0 1 #!/bin/sh
duke@0 2
duke@0 3 #
ohair@590 4 # Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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 #
ohair@590 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@590 22 # or visit www.oracle.com if you need additional information or have any
ohair@590 23 # questions.
duke@0 24 #
duke@0 25
duke@0 26
duke@0 27 if [ "${TESTSRC}" = "" ]
duke@0 28 then
duke@0 29 echo "TESTSRC not set. Test cannot execute. Failed."
duke@0 30 exit 1
duke@0 31 fi
duke@0 32 printf '%s' "TESTSRC=${TESTSRC}" ; echo
duke@0 33 if [ "${TESTJAVA}" = "" ]
duke@0 34 then
duke@0 35 echo "TESTJAVA not set. Test cannot execute. Failed."
duke@0 36 exit 1
duke@0 37 fi
duke@0 38 printf '%s' "TESTJAVA=${TESTJAVA}" ; echo
duke@0 39 if [ "${TESTCLASSES}" = "" ]
duke@0 40 then
duke@0 41 echo "TESTCLASSES not set. Test cannot execute. Failed."
duke@0 42 exit 1
duke@0 43 fi
duke@0 44 printf '%s' "TESTCLASSES=${TESTCLASSES}" ; echo
duke@0 45 printf '%s' "CLASSPATH=${CLASSPATH}" ; echo
duke@0 46 echo
duke@0 47
duke@0 48 # set platform-dependent variables
duke@0 49 OS=`uname -s`
duke@0 50 case "$OS" in
jjh@1218 51 SunOS | Linux | Darwin )
duke@0 52 FS="/"
duke@0 53 ;;
jjg@412 54 CYGWIN* )
jjg@412 55 FS="/"
jjg@412 56 DIFFOPTS="--strip-trailing-cr"
jjg@412 57 ;;
duke@0 58 Windows* )
duke@0 59 FS="\\"
duke@0 60 ;;
duke@0 61 * )
duke@0 62 echo "Unrecognized system!"
duke@0 63 exit 1;
duke@0 64 ;;
duke@0 65 esac
duke@0 66
duke@0 67 TMP1=OUTPUT.txt
duke@0 68
duke@0 69 cp "${TESTSRC}${FS}NoJavaLang.java" .
duke@0 70
duke@0 71 echo "- verifing that fatal error is not produced in the regular case"
duke@0 72 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} NoJavaLang.java 2> "${TMP1}"
duke@0 73 result=$?
duke@0 74
duke@0 75 if [ $result -eq 0 ]
duke@0 76 then
duke@0 77 echo "Passed - base compilation successful"
duke@0 78 else
duke@0 79 echo "Failed - unable to compile test"
duke@0 80 exit $result
duke@0 81 fi
duke@0 82
duke@0 83 echo
duke@0 84
duke@0 85 echo "- verifing the fatal error is produced"
duke@0 86 rm "${TMP1}"
duke@0 87 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -bootclasspath . NoJavaLang.java 2> "${TMP1}"
duke@0 88
duke@0 89 # return code should be EXIT_SYSERR
duke@0 90 result=$?
duke@0 91 if [ $result -ne 3 ]
duke@0 92 then
duke@0 93 echo "Failed - unexpected return code"
duke@0 94 exit $result
duke@0 95 else
duke@0 96 echo "Passed - expected return code"
duke@0 97 fi
duke@0 98
duke@0 99 # expected message
duke@0 100 cat "${TMP1}"
jjg@412 101 diff ${DIFFOPTS} -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
duke@0 102 result=$?
duke@0 103 rm "${TMP1}"
duke@0 104
duke@0 105 if [ $result -eq 0 ]
duke@0 106 then
duke@0 107 echo "Passed - expected message"
duke@0 108 else
duke@0 109 echo "Failed - unexpected message"
duke@0 110 exit $result
duke@0 111
duke@0 112 fi
duke@0 113
duke@0 114 exit