test/runtime/6888954/vmerrors.sh

Fri, 22 Jul 2016 16:53:17 +0800

author
aoqi
date
Fri, 22 Jul 2016 16:53:17 +0800
changeset 39
72830a7941b2
parent 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added MIPS support in hotspot/test/test_env.sh

aoqi@0 1 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 3 #
aoqi@0 4 # This code is free software; you can redistribute it and/or modify it
aoqi@0 5 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 6 # published by the Free Software Foundation.
aoqi@0 7 #
aoqi@0 8 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 10 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 11 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 12 # accompanied this code).
aoqi@0 13 #
aoqi@0 14 # You should have received a copy of the GNU General Public License version
aoqi@0 15 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 17 #
aoqi@0 18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 19 # or visit www.oracle.com if you need additional information or have any
aoqi@0 20 # questions.
aoqi@0 21 #
aoqi@0 22
aoqi@0 23 # @test
aoqi@0 24 # @bug 6888954
aoqi@0 25 # @bug 8015884
aoqi@0 26 # @summary exercise HotSpot error handling code
aoqi@0 27 # @author John Coomes
aoqi@0 28 # @run shell vmerrors.sh
aoqi@0 29
aoqi@0 30 # Repeatedly invoke java with a command-line option that causes HotSpot to
aoqi@0 31 # produce an error report and terminate just after initialization. Each
aoqi@0 32 # invocation is identified by a small integer, <n>, which provokes a different
aoqi@0 33 # error (assertion failure, guarantee failure, fatal error, etc.). The output
aoqi@0 34 # from stdout/stderr is written to <n>.out and the hs_err_pidXXX.log file is
aoqi@0 35 # renamed to <n>.log.
aoqi@0 36 #
aoqi@0 37 # The automated checking done by this script is minimal. When updating the
aoqi@0 38 # fatal error handler it is more useful to run it manually or to use the -retain
aoqi@0 39 # option with the jtreg so that test directories are not removed automatically.
aoqi@0 40 # To run stand-alone:
aoqi@0 41 #
aoqi@0 42 # TESTJAVA=/java/home/dir
aoqi@0 43 # TESTVMOPTS=...
aoqi@0 44 # export TESTJAVA TESTVMOPTS
aoqi@0 45 # sh test/runtime/6888954/vmerrors.sh
aoqi@0 46
aoqi@0 47 ulimit -c 0 # no core files
aoqi@0 48
aoqi@0 49 i=1
aoqi@0 50 rc=0
aoqi@0 51
aoqi@0 52 assert_re='(assert|guarantee)[(](str|num).*failed: *'
aoqi@0 53 # for bad_data_ptr_re:
aoqi@0 54 # EXCEPTION_ACCESS_VIOLATION - Win-*
aoqi@0 55 # SIGILL - MacOS X
aoqi@0 56 # SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-*
aoqi@0 57 #
aoqi@0 58 bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
aoqi@0 59 #
aoqi@0 60 # for bad_func_ptr_re:
aoqi@0 61 # EXCEPTION_ACCESS_VIOLATION - Win-*
aoqi@0 62 # SIGBUS - Solaris SPARC-64
aoqi@0 63 # SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-*
aoqi@0 64 #
aoqi@0 65 # Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-*
aoqi@0 66 # gets its signal at a PC in test_error_handler().
aoqi@0 67 #
aoqi@0 68 bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
aoqi@0 69 guarantee_re='guarantee[(](str|num).*failed: *'
aoqi@0 70 fatal_re='fatal error: *'
aoqi@0 71 tail_1='.*expected null'
aoqi@0 72 tail_2='.*num='
aoqi@0 73
aoqi@0 74 for re in \
aoqi@0 75 "${assert_re}${tail_1}" "${assert_re}${tail_2}" \
aoqi@0 76 "${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \
aoqi@0 77 "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \
aoqi@0 78 "${fatal_re}.*truncated" "ChunkPool::allocate" \
aoqi@0 79 "ShouldNotCall" "ShouldNotReachHere" \
aoqi@0 80 "Unimplemented" "$bad_data_ptr_re" \
aoqi@0 81 "$bad_func_ptr_re"
aoqi@0 82
aoqi@0 83 do
aoqi@0 84 i2=$i
aoqi@0 85 [ $i -lt 10 ] && i2=0$i
aoqi@0 86
aoqi@0 87 "$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \
aoqi@0 88 -XX:-TransmitErrorReport \
aoqi@0 89 -XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&1
aoqi@0 90
aoqi@0 91 # If ErrorHandlerTest is ignored (product build), stop.
aoqi@0 92 #
aoqi@0 93 # Using the built-in variable $! to get the pid does not work reliably on
aoqi@0 94 # windows; use a wildcard instead.
aoqi@0 95 mv hs_err_pid*.log ${i2}.log || exit $rc
aoqi@0 96
aoqi@0 97 for f in ${i2}.log ${i2}.out
aoqi@0 98 do
aoqi@0 99 egrep -- "$re" $f > $$
aoqi@0 100 if [ $? -ne 0 ]
aoqi@0 101 then
aoqi@0 102 echo "ErrorHandlerTest=$i failed ($f)"
aoqi@0 103 rc=1
aoqi@0 104 fi
aoqi@0 105 done
aoqi@0 106 rm -f $$
aoqi@0 107
aoqi@0 108 i=`expr $i + 1`
aoqi@0 109 done
aoqi@0 110
aoqi@0 111 exit $rc

mercurial