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