609N/A# @test
609N/A# @bug 6888954
609N/A# @summary exercise HotSpot error handling code
609N/A# @author John Coomes
609N/A# @run shell vmerrors.sh
609N/A
609N/A# Repeatedly invoke java with a command-line option that causes HotSpot to
609N/A# produce an error report and terminate just after initialization. Each
609N/A# invocation is identified by a small integer, <n>, which provokes a different
609N/A# error (assertion failure, guarantee failure, fatal error, etc.). The output
609N/A# from stdout/stderr is written to <n>.out and the hs_err_pidXXX.log file is
609N/A# renamed to <n>.log.
609N/A#
609N/A# The automated checking done by this script is minimal. When updating the
609N/A# fatal error handler it is more useful to run it manually or to use the -retain
609N/A# option with the jtreg so that test directories are not removed automatically.
609N/A# To run stand-alone:
609N/A#
609N/A# TESTJAVA=/java/home/dir
609N/A# TESTVMOPTS=...
609N/A# export TESTJAVA TESTVMOPTS
609N/A# sh test/runtime/6888954/vmerrors.sh
609N/A
609N/Aulimit -c 0 # no core files
609N/A
609N/Ai=1
609N/Arc=0
609N/A
609N/Aassert_re='(assert|guarantee)[(](str|num).*failed: *'
609N/Aguarantee_re='guarantee[(](str|num).*failed: *'
609N/Afatal_re='fatal error: *'
609N/Asignal_re='(SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
609N/Atail_1='.*expected null'
609N/Atail_2='.*num='
for re in \
"${assert_re}${tail_1}" "${assert_re}${tail_2}" \
"${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \
"${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \
"${fatal_re}.*truncated" "ChunkPool::allocate" \
"ShouldNotCall" "ShouldNotReachHere" \
"Unimplemented" "$signal_re"
do
i2=$i
[ $i -lt 10 ] && i2=0$i
"$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \
-XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&1
# If ErrorHandlerTest is ignored (product build), stop.
#
# Using the built-in variable $! to get the pid does not work reliably on
# windows; use a wildcard instead.
mv hs_err_pid*.log ${i2}.log || exit $rc
for f in ${i2}.log ${i2}.out
do
egrep -- "$re" $f > $$
if [ $? -ne 0 ]
then
echo "ErrorHandlerTest=$i failed ($f)"
rc=1
fi
done
rm -f $$
i=`expr $i + 1`
done
exit $rc