hotspot/test/compiler/ciReplay/common.sh
author iignatyev
Wed, 15 May 2013 22:44:52 +0400
changeset 17387 201ce4a5360b
parent 17123 a8e62eed2e3e
child 19331 ff8ddc49a4c2
child 19324 772bf8afb18a
permissions -rw-r--r--
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated Reviewed-by: kvn
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() {
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   185
    if [ $VM_OS != "windows" ]
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   186
    then
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   187
        # enable core dump
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   188
        ulimit -c unlimited
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   189
    fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   190
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   191
    cmd="${JAVA} ${TESTVMOPTS} $@ \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   192
            -Xms8m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   193
            -Xmx32m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   194
            -XX:MetaspaceSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   195
            -XX:MaxMetaspaceSize=16m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   196
            -XX:InitialCodeCacheSize=512k \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   197
            -XX:ReservedCodeCacheSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   198
            -XX:ThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   199
            -XX:VMThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   200
            -XX:CompilerThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   201
            -XX:ParallelGCThreads=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   202
            -XX:CICompilerCount=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   203
            -Xcomp \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   204
            -XX:CICrashAt=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   205
            -XX:+CreateMinidumpOnCrash \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   206
            -XX:+DumpReplayDataOnError \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   207
            -XX:ReplayDataFile=${replay_data} \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   208
            -version"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   209
    echo GENERATION OF REPLAY.TXT:
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   210
    echo $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   211
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   212
    ${cmd} > crash.out 2>&1
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   213
    
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   214
    core_locations=`grep -i core crash.out | grep "location:" | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   215
            sed -e 's/.*location: //'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   216
    rm crash.out 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   217
    # processing core locations for *nix
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   218
    if [ $VM_OS != "windows" ]
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   219
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   220
        # remove 'or' between '/core.<pid>' and 'core'
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   221
        core_locations=`echo $core_locations | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   222
                sed -e 's/\([^ ]*\) or \([^ ]*\)/\1 \2/'`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   223
        # add <core_path>/core.<pid> core.<pid>
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   224
        core_with_dir=`echo $core_locations | awk '{print $1}'`
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   225
        dir=`dirname $core_with_dir`
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   226
        core_with_pid=`echo $core_locations | awk '{print $2}'`
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   227
        if [ -n ${core_with_pid} ]
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   228
        then
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   229
            core_locations="$core_locations $dir${FS}$core_with_pid $core_with_pid"
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   230
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   231
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   232
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   233
    echo "LOOKING FOR CORE IN ${core_locations}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   234
    for core in $core_locations
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   235
    do
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   236
        if [ -r "$core" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   237
        then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   238
            core_file=$core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   239
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   240
    done
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   241
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   242
    # core-file was found
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   243
    if [ -n "$core_file" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   244
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   245
        ${MV} "${core_file}" test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   246
        core_file=test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   247
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   248
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   249
    ${RM} -f hs_err_pid*.log
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