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