hotspot/test/compiler/ciReplay/common.sh
author iignatyev
Thu, 25 Apr 2013 11:09:24 -0700
changeset 17123 a8e62eed2e3e
child 17387 201ce4a5360b
permissions -rw-r--r--
8011675: adding compilation level to replay data Reviewed-by: kvn, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     1
#!/bin/sh
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     2
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     3
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     5
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     8
# published by the Free Software Foundation.
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
     9
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    10
# This code is distributed in the hope that it will be useful, but WITHOUT
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    11
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    12
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    13
# version 2 for more details (a copy is included in the LICENSE file that
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    14
# accompanied this code).
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    15
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    16
# You should have received a copy of the GNU General Public License version
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    17
# 2 along with this work; if not, write to the Free Software Foundation,
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    18
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    19
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    20
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    21
# or visit www.oracle.com if you need additional information or have any
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    22
# questions.
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    23
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    24
# 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    25
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    26
# $1 - error code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    27
# $2 - test name
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    28
# $3,.. - decription
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    29
test_fail() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    30
    error=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    31
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    32
    name=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    33
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    34
    echo "TEST [$name] FAILED:"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    35
    echo "$@"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    36
    exit $error
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    37
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    38
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    39
# $@ - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    40
start_test() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    41
    # disable core dump on *nix
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    42
    ulimit -S -c 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    43
    # disable core dump on windows
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    44
    VMOPTS="$@ -XX:-CreateMinidumpOnCrash"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    45
    cmd="${JAVA} ${VMOPTS} -XX:+ReplayCompiles -XX:ReplayDataFile=${replay_data}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    46
    echo $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    47
    $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    48
    return $?
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    49
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    50
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    51
# $1 - error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    52
# $2 - test name
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    53
# $3,.. - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    54
positive_test() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    55
    error=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    56
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    57
    name=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    58
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    59
    VMOPTS="${TESTVMOPTS} $@"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    60
    echo "POSITIVE TEST [$name]"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    61
    start_test ${VMOPTS}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    62
    exit_code=$?
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    63
    if [ ${exit_code} -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    64
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    65
        test_fail $error "$name" "exit_code[${exit_code}] != 0 during replay "\
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    66
                "w/ vmopts: ${VMOPTS}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    67
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    68
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    69
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    70
# $1 - error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    71
# $2 - test name
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    72
# $2,.. - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    73
negative_test() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    74
    error=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    75
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    76
    name=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    77
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    78
    VMOPTS="${TESTVMOPTS} $@"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    79
    echo "NEGATIVE TEST [$name]"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    80
    start_test ${VMOPTS}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    81
    exit_code=$?
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    82
    if [ ${exit_code} -eq 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    83
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    84
        test_fail $error "$name" "exit_code[${exit_code}] == 0 during replay "\
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    85
                "w/ vmopts: ${VMOPTS}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    86
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    87
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    88
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    89
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    90
common_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    91
    positive_test $1 "COMMON :: THE SAME FLAGS"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    92
    positive_test `expr $1 + 1` "COMMON :: TIERED" -XX:+TieredCompilation
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    93
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    94
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    95
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    96
# $2 - non-tiered comp_level 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    97
nontiered_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    98
    level=`grep "^compile " $replay_data | awk '{print $6}'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    99
    # is level available in non-tiere
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   100
    if [ "$level" -eq $2 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   101
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   102
        positive_test $1 "NON-TIERED :: AVAILABLE COMP_LEVEL" \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   103
                -XX:-TieredCompilation
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   104
    else
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   105
        negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   106
        negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   107
                -XX:-TieredCompilation
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   108
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   109
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   110
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   111
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   112
client_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   113
    # testing in opposite VM
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   114
    if [ $server_available -eq 1 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   115
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   116
        negative_test $1 "SERVER :: NON-TIERED" -XX:-TieredCompilation \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   117
                -server
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   118
        positive_test `expr $1 + 1` "SERVER :: TIERED" -XX:+TieredCompilation \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   119
                -server
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   120
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   121
    nontiered_tests `expr $1 + 2` $client_level 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   122
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   124
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   125
server_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   126
    # testing in opposite VM
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   127
    if [ $client_available -eq 1 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   128
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   129
        # tiered is unavailable in client vm, so results w/ flags will be the same as w/o flags
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   130
        negative_test $1 "CLIENT" -client
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   131
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   132
    nontiered_tests `expr $1 + 2` $server_level
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   133
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   134
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   135
cleanup() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   136
    ${RM} -f core*
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   137
    ${RM} -f replay*.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   138
    ${RM} -f hs_err_pid*.log
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   139
    ${RM} -f test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   140
    ${RM} -f test_replay.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   141
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   142
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   143
JAVA=${TESTJAVA}${FS}bin${FS}java
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   144
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   145
replay_data=test_replay.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   146
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   147
${JAVA} ${TESTVMOPTS} -Xinternalversion 2>&1 | grep debug
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   148
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   149
# Only test fastdebug 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   150
if [ $? -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   151
then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   152
    echo TEST SKIPPED: product build
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   153
    exit 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   154
fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   155
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   156
is_int=`${JAVA} ${TESTVMOPTS} -version 2>&1 | grep -c "interpreted mode"`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   157
# Not applicable for Xint
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   158
if [ $is_int -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   159
then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   160
    echo TEST SKIPPED: interpreted mode
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   161
    exit 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   162
fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   163
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   164
cleanup
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   165
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   166
client_available=`${JAVA} ${TESTVMOPTS} -client -Xinternalversion 2>&1 | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   167
        grep -c Client`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   168
server_available=`${JAVA} ${TESTVMOPTS} -server -Xinternalversion 2>&1 | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   169
        grep -c Server`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   170
is_tiered=`${JAVA} ${TESTVMOPTS} -XX:+PrintFlagsFinal -version | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   171
        grep TieredCompilation | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   172
        grep -c true`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   173
# CompLevel_simple -- C1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   174
client_level=1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   175
# CompLevel_full_optimization -- C2 or Shark 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   176
server_level=4
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   177
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   178
echo "client_available=$client_available"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   179
echo "server_available=$server_available"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   180
echo "is_tiered=$is_tiered"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   181
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   182
# crash vm in compiler thread with generation replay data and 'small' dump-file
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   183
# $@ - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   184
generate_replay() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   185
    # enable core dump
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   186
    ulimit -c unlimited
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   187
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   188
    cmd="${JAVA} ${TESTVMOPTS} $@ \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   189
            -Xms8m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   190
            -Xmx32m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   191
            -XX:MetaspaceSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   192
            -XX:MaxMetaspaceSize=16m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   193
            -XX:InitialCodeCacheSize=512k \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   194
            -XX:ReservedCodeCacheSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   195
            -XX:ThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   196
            -XX:VMThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   197
            -XX:CompilerThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   198
            -XX:ParallelGCThreads=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   199
            -XX:CICompilerCount=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   200
            -Xcomp \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   201
            -XX:CICrashAt=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   202
            -XX:+CreateMinidumpOnCrash \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   203
            -XX:+DumpReplayDataOnError \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   204
            -XX:ReplayDataFile=${replay_data} \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   205
            -version"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   206
    echo GENERATION OF REPLAY.TXT:
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   207
    echo $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   208
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   209
    ${cmd} 2>&1 > crash.out
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   210
    
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   211
    core_locations=`grep -i core crash.out | grep "location:" | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   212
            sed -e 's/.*location: //'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   213
    rm crash.out 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   214
    # processing core locations for *nix
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   215
    if [ $OS != "windows" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   216
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   217
        # remove 'or' between '/core.<pid>' and 'core'
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   218
        core_locations=`echo $core_locations | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   219
                sed -e 's/\([^ ]*\) or \([^ ]*\)/\1 \2/'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   220
        # add <core_path>/core.<pid> core.<pid>
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   221
        core=`echo $core_locations | awk '{print $1}'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   222
        dir=`dirname $core`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   223
        core=`basename $core`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   224
        if [ -n ${core} ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   225
        then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   226
            core_locations="$core_locations $dir${FS}$core"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   227
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   228
        core=`echo $core_locations | awk '{print $2}'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   229
        if [ -n ${core} ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   230
        then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   231
            core_locations="$core_locations $dir${FS}$core"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   232
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   233
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   234
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   235
    echo "LOOKING FOR CORE IN ${core_locations}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   236
    for core in $core_locations
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   237
    do
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   238
        if [ -r "$core" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   239
        then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   240
            core_file=$core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   241
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   242
    done
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   243
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   244
    # core-file was found
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   245
    if [ -n "$core_file" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   246
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   247
        ${MV} "${core_file}" test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   248
        core_file=test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   249
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   250
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   251
    ${RM} -f hs_err_pid*.log
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   252
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   253