test/runtime/6888954/vmerrors.sh

Thu, 04 Jul 2013 21:10:17 -0700

author
dcubed
date
Thu, 04 Jul 2013 21:10:17 -0700
changeset 5365
59b052799158
parent 1947
5b77884bd4b7
child 5847
cc4f5f8d885e
permissions
-rw-r--r--

8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
Summary: Dl_info struct should only be used if dladdr() has returned non-zero (no errors) and always check the dladdr() return value; Dl_info.dli_sname and Dl_info.dli_saddr fields should only be used if non-NULL; update/improve runtime/6888954/vmerrors.sh test
Reviewed-by: dsamersoff, zgu, hseigel, coleenp

jcoomes@1845 1 # @test
jcoomes@1845 2 # @bug 6888954
dcubed@5365 3 # @bug 8015884
jcoomes@1845 4 # @summary exercise HotSpot error handling code
jcoomes@1845 5 # @author John Coomes
jcoomes@1845 6 # @run shell vmerrors.sh
jcoomes@1845 7
jcoomes@1845 8 # Repeatedly invoke java with a command-line option that causes HotSpot to
jcoomes@1845 9 # produce an error report and terminate just after initialization. Each
jcoomes@1845 10 # invocation is identified by a small integer, <n>, which provokes a different
jcoomes@1845 11 # error (assertion failure, guarantee failure, fatal error, etc.). The output
jcoomes@1845 12 # from stdout/stderr is written to <n>.out and the hs_err_pidXXX.log file is
jcoomes@1845 13 # renamed to <n>.log.
jcoomes@1845 14 #
jcoomes@1845 15 # The automated checking done by this script is minimal. When updating the
jcoomes@1845 16 # fatal error handler it is more useful to run it manually or to use the -retain
jcoomes@1845 17 # option with the jtreg so that test directories are not removed automatically.
jcoomes@1845 18 # To run stand-alone:
jcoomes@1845 19 #
jcoomes@1845 20 # TESTJAVA=/java/home/dir
jcoomes@1845 21 # TESTVMOPTS=...
jcoomes@1845 22 # export TESTJAVA TESTVMOPTS
jcoomes@1845 23 # sh test/runtime/6888954/vmerrors.sh
jcoomes@1845 24
jcoomes@1845 25 ulimit -c 0 # no core files
jcoomes@1845 26
jcoomes@1845 27 i=1
jcoomes@1845 28 rc=0
jcoomes@1845 29
jcoomes@1845 30 assert_re='(assert|guarantee)[(](str|num).*failed: *'
dcubed@5365 31 # for bad_data_ptr_re:
dcubed@5365 32 # EXCEPTION_ACCESS_VIOLATION - Win-*
dcubed@5365 33 # SIGILL - MacOS X
dcubed@5365 34 # SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-*
dcubed@5365 35 #
dcubed@5365 36 bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
dcubed@5365 37 #
dcubed@5365 38 # for bad_func_ptr_re:
dcubed@5365 39 # EXCEPTION_ACCESS_VIOLATION - Win-*
dcubed@5365 40 # SIGBUS - Solaris SPARC-64
dcubed@5365 41 # SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-*
dcubed@5365 42 #
dcubed@5365 43 # Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-*
dcubed@5365 44 # gets its signal at a PC in test_error_handler().
dcubed@5365 45 #
dcubed@5365 46 bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
jcoomes@1845 47 guarantee_re='guarantee[(](str|num).*failed: *'
jcoomes@1845 48 fatal_re='fatal error: *'
jcoomes@1845 49 tail_1='.*expected null'
jcoomes@1845 50 tail_2='.*num='
jcoomes@1845 51
jcoomes@1845 52 for re in \
jcoomes@1845 53 "${assert_re}${tail_1}" "${assert_re}${tail_2}" \
jcoomes@1845 54 "${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \
jcoomes@1845 55 "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \
jcoomes@1845 56 "${fatal_re}.*truncated" "ChunkPool::allocate" \
jcoomes@1845 57 "ShouldNotCall" "ShouldNotReachHere" \
dcubed@5365 58 "Unimplemented" "$bad_data_ptr_re" \
dcubed@5365 59 "$bad_func_ptr_re"
dcubed@5365 60
jcoomes@1845 61 do
jcoomes@1845 62 i2=$i
jcoomes@1845 63 [ $i -lt 10 ] && i2=0$i
jcoomes@1845 64
jcoomes@1845 65 "$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \
jcoomes@1845 66 -XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&1
jcoomes@1845 67
jcoomes@1845 68 # If ErrorHandlerTest is ignored (product build), stop.
jcoomes@1845 69 #
jcoomes@1845 70 # Using the built-in variable $! to get the pid does not work reliably on
jcoomes@1845 71 # windows; use a wildcard instead.
jcoomes@1845 72 mv hs_err_pid*.log ${i2}.log || exit $rc
jcoomes@1845 73
jcoomes@1845 74 for f in ${i2}.log ${i2}.out
jcoomes@1845 75 do
jcoomes@1845 76 egrep -- "$re" $f > $$
jcoomes@1845 77 if [ $? -ne 0 ]
jcoomes@1845 78 then
jcoomes@1845 79 echo "ErrorHandlerTest=$i failed ($f)"
jcoomes@1845 80 rc=1
jcoomes@1845 81 fi
jcoomes@1845 82 done
jcoomes@1845 83 rm -f $$
jcoomes@1845 84
jcoomes@1947 85 i=`expr $i + 1`
jcoomes@1845 86 done
jcoomes@1845 87
jcoomes@1845 88 exit $rc

mercurial