hotspot/test/runtime/6888954/vmerrors.sh
author kvn
Thu, 05 Dec 2013 15:10:36 -0800
changeset 22598 ad765acfda85
parent 20390 a86c9ed78205
child 23861 1a6ab02cf5ca
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20390
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     1
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     3
#
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     4
# This code is free software; you can redistribute it and/or modify it
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     5
# under the terms of the GNU General Public License version 2 only, as
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     6
# published by the Free Software Foundation.
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     7
#
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     8
# This code is distributed in the hope that it will be useful, but WITHOUT
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
     9
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    10
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    11
# version 2 for more details (a copy is included in the LICENSE file that
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    12
# accompanied this code).
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    13
#
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    14
# You should have received a copy of the GNU General Public License version
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    15
# 2 along with this work; if not, write to the Free Software Foundation,
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    16
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    17
#
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    18
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    19
# or visit www.oracle.com if you need additional information or have any
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    20
# questions.
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    21
#
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    22
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    23
# @test
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    24
# @bug 6888954
18683
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    25
# @bug 8015884
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    26
# @summary exercise HotSpot error handling code
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    27
# @author John Coomes
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    28
# @run shell vmerrors.sh
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    29
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    30
# Repeatedly invoke java with a command-line option that causes HotSpot to
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    31
# produce an error report and terminate just after initialization.  Each
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    32
# invocation is identified by a small integer, <n>, which provokes a different
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    33
# error (assertion failure, guarantee failure, fatal error, etc.).  The output
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    34
# from stdout/stderr is written to <n>.out and the hs_err_pidXXX.log file is
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    35
# renamed to <n>.log.
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    36
#
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    37
# The automated checking done by this script is minimal.  When updating the
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    38
# fatal error handler it is more useful to run it manually or to use the -retain
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    39
# option with the jtreg so that test directories are not removed automatically.
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    40
# To run stand-alone:
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    41
#
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    42
# TESTJAVA=/java/home/dir
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    43
# TESTVMOPTS=...
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    44
# export TESTJAVA TESTVMOPTS
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    45
# sh test/runtime/6888954/vmerrors.sh
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    46
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    47
ulimit -c 0 # no core files
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    48
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    49
i=1
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    50
rc=0
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    51
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    52
assert_re='(assert|guarantee)[(](str|num).*failed: *'
18683
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    53
# for bad_data_ptr_re:
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    54
# EXCEPTION_ACCESS_VIOLATION - Win-*
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    55
# SIGILL - MacOS X
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    56
# SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-*
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    57
#
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    58
bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    59
#
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    60
# for bad_func_ptr_re:
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    61
# EXCEPTION_ACCESS_VIOLATION - Win-*
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    62
# SIGBUS - Solaris SPARC-64
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    63
# SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-*
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    64
#
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    65
# Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-*
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    66
# gets its signal at a PC in test_error_handler().
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    67
#
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    68
bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc='
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    69
guarantee_re='guarantee[(](str|num).*failed: *'
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    70
fatal_re='fatal error: *'
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    71
tail_1='.*expected null'
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    72
tail_2='.*num='
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    73
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    74
for re in                                                 \
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    75
    "${assert_re}${tail_1}"    "${assert_re}${tail_2}"    \
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    76
    "${guarantee_re}${tail_1}" "${guarantee_re}${tail_2}" \
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    77
    "${fatal_re}${tail_1}"     "${fatal_re}${tail_2}"     \
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    78
    "${fatal_re}.*truncated"   "ChunkPool::allocate"      \
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    79
    "ShouldNotCall"            "ShouldNotReachHere"       \
18683
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    80
    "Unimplemented"            "$bad_data_ptr_re"         \
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    81
    "$bad_func_ptr_re"
a6418e038255 8015884: runThese crashed with SIGSEGV, hs_err has an error instead of stacktrace
dcubed
parents: 5715
diff changeset
    82
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    83
do
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    84
    i2=$i
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    85
    [ $i -lt 10 ] && i2=0$i
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    86
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    87
    "$TESTJAVA/bin/java" $TESTVMOPTS -XX:+IgnoreUnrecognizedVMOptions \
20390
a86c9ed78205 8023796: [TESTBUG] Add -XX:-TransmitErrorReport to runtime/6888954/vmerrors.sh
mseledtsov
parents: 18683
diff changeset
    88
        -XX:-TransmitErrorReport \
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    89
        -XX:ErrorHandlerTest=${i} -version > ${i2}.out 2>&1
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    90
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    91
    # If ErrorHandlerTest is ignored (product build), stop.
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    92
    #
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    93
    # Using the built-in variable $! to get the pid does not work reliably on
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    94
    # windows; use a wildcard instead.
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    95
    mv hs_err_pid*.log ${i2}.log || exit $rc
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    96
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    97
    for f in ${i2}.log ${i2}.out
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    98
    do
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
    99
        egrep -- "$re" $f > $$
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   100
        if [ $? -ne 0 ]
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   101
        then
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   102
            echo "ErrorHandlerTest=$i failed ($f)"
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   103
            rc=1
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   104
        fi
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   105
    done
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   106
    rm -f $$
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   107
5715
fe333439d5c6 6956472: test/runtime/6888954/vmerrors.sh uses ksh-specific syntax
jcoomes
parents: 5403
diff changeset
   108
    i=`expr $i + 1`
5403
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   109
done
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   110
6b0dd9c75dde 6888954: argument formatting for assert() and friends
jcoomes
parents:
diff changeset
   111
exit $rc