Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/6888954/vmerrors.sh
32284 views
# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.1# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2#3# This code is free software; you can redistribute it and/or modify it4# under the terms of the GNU General Public License version 2 only, as5# published by the Free Software Foundation.6#7# This code is distributed in the hope that it will be useful, but WITHOUT8# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10# version 2 for more details (a copy is included in the LICENSE file that11# accompanied this code).12#13# You should have received a copy of the GNU General Public License version14# 2 along with this work; if not, write to the Free Software Foundation,15# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16#17# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18# or visit www.oracle.com if you need additional information or have any19# questions.20#2122# @test23# @bug 688895424# @bug 801588425# @summary exercise HotSpot error handling code26# @author John Coomes27# @run shell vmerrors.sh2829# Repeatedly invoke java with a command-line option that causes HotSpot to30# produce an error report and terminate just after initialization. Each31# invocation is identified by a small integer, <n>, which provokes a different32# error (assertion failure, guarantee failure, fatal error, etc.). The output33# from stdout/stderr is written to <n>.out and the hs_err_pidXXX.log file is34# renamed to <n>.log.35#36# The automated checking done by this script is minimal. When updating the37# fatal error handler it is more useful to run it manually or to use the -retain38# option with the jtreg so that test directories are not removed automatically.39# To run stand-alone:40#41# TESTJAVA=/java/home/dir42# TESTVMOPTS=...43# export TESTJAVA TESTVMOPTS44# sh test/runtime/6888954/vmerrors.sh4546ulimit -c 0 # no core files4748i=149rc=05051assert_re='(assert|guarantee)[(](str|num).*failed: *'52# for bad_data_ptr_re:53# EXCEPTION_ACCESS_VIOLATION - Win-*54# SIGILL - MacOS X55# SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-*56#57bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='58#59# for bad_func_ptr_re:60# EXCEPTION_ACCESS_VIOLATION - Win-*61# SIGBUS - Solaris SPARC-6462# SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-*63# SIGILL - Aix64#65# Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-*66# gets its signal at a PC in test_error_handler().67#68bad_func_ptr_re='(SIGBUS|SIGSEGV|SIGILL|EXCEPTION_ACCESS_VIOLATION).* at pc='69guarantee_re='guarantee[(](str|num).*failed: *'70fatal_re='fatal error: *'71tail_1='.*expected null'72tail_2='.*num='7374for re in \75"${assert_re}${tail_1}" "${assert_re}${tail_2}" \76"${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \77"${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \78"${fatal_re}.*truncated" "ChunkPool::allocate" \79"ShouldNotCall" "ShouldNotReachHere" \80"Unimplemented" "$bad_data_ptr_re" \81"$bad_func_ptr_re"8283do84i2=$i85[ $i -lt 10 ] && i2=0$i8687"$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \88-XX:-TransmitErrorReport \89-XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&19091# If ErrorHandlerTest is ignored (product build), stop.92#93# Using the built-in variable $! to get the pid does not work reliably on94# windows; use a wildcard instead.95mv hs_err_pid*.log ${i2}.log || exit $rc9697for f in ${i2}.log ${i2}.out98do99egrep -- "$re" $f > $$100if [ $? -ne 0 ]101then102echo "ErrorHandlerTest=$i failed ($f)"103rc=1104fi105done106rm -f $$107108i=`expr $i + 1`109done110111exit $rc112113114