hotspot/test/compiler/ciReplay/common.sh
author chegar
Tue, 22 Mar 2016 15:26:07 +0000
changeset 36694 182a5e7a519e
parent 28385 bec02e2cbde7
permissions -rw-r--r--
Merge
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
# 
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
     3
# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
17123
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
# 
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
    25
set -x
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    26
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    27
# $1 - error code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    28
# $2 - test name
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    29
# $3,.. - decription
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    30
test_fail() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    31
    error=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    32
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    33
    name=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    34
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    35
    echo "TEST [$name] FAILED:"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    36
    echo "$@"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    37
    exit $error
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
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    40
# $@ - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    41
start_test() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    42
    # disable core dump on *nix
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    43
    ulimit -S -c 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    44
    # disable core dump on windows
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    45
    VMOPTS="$@ -XX:-CreateMinidumpOnCrash"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    46
    cmd="${JAVA} ${VMOPTS} -XX:+ReplayCompiles -XX:ReplayDataFile=${replay_data}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    47
    echo $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    48
    $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    49
    return $?
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
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    52
# $1 - error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    53
# $2 - test name
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    54
# $3,.. - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    55
positive_test() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    56
    error=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    57
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    58
    name=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    59
    shift
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
    60
    VMOPTS="${TESTOPTS} $@"
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    61
    echo "POSITIVE TEST [$name]"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    62
    start_test ${VMOPTS}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    63
    exit_code=$?
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    64
    if [ ${exit_code} -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    65
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    66
        test_fail $error "$name" "exit_code[${exit_code}] != 0 during replay "\
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    67
                "w/ vmopts: ${VMOPTS}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    68
    fi
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
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    71
# $1 - error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    72
# $2 - test name
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    73
# $2,.. - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    74
negative_test() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    75
    error=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    76
    shift
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    77
    name=$1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    78
    shift
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
    79
    VMOPTS="${TESTOPTS} $@"
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    80
    echo "NEGATIVE TEST [$name]"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    81
    start_test ${VMOPTS}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    82
    exit_code=$?
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    83
    if [ ${exit_code} -eq 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    84
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    85
        test_fail $error "$name" "exit_code[${exit_code}] == 0 during replay "\
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    86
                "w/ vmopts: ${VMOPTS}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    87
    fi
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
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    90
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    91
common_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    92
    positive_test $1 "COMMON :: THE SAME FLAGS"
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    93
    if [ $tiered_available -eq 1 ]
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    94
    then
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    95
        positive_test `expr $1 + 1` "COMMON :: TIERED" -XX:+TieredCompilation
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    96
    fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    97
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    98
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    99
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   100
# $2 - non-tiered comp_level 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   101
nontiered_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   102
    level=`grep "^compile " $replay_data | awk '{print $6}'`
23206
15209a068428 8027257: [TESTBUG] compiler/ciReplay/TestVM.sh : Error: Could not find or load main class negative_test
iignatyev
parents: 22537
diff changeset
   103
    # is level available in non-tiered
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   104
    if [ "$level" -eq $2 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   105
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   106
        positive_test $1 "NON-TIERED :: AVAILABLE 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
    else
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   109
        negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   110
                -XX:-TieredCompilation
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   111
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   112
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   113
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   114
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   115
client_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   116
    # testing in opposite VM
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   117
    if [ $server_available -eq 1 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   118
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   119
        negative_test $1 "SERVER :: NON-TIERED" -XX:-TieredCompilation \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   120
                -server
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   121
        if [ $tiered_available -eq 1 ]
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   122
        then
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   123
            positive_test `expr $1 + 1` "SERVER :: TIERED" -XX:+TieredCompilation \
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   124
                    -server
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   125
        fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   126
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   127
    nontiered_tests `expr $1 + 2` $client_level 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   128
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   129
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   130
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   131
server_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   132
    # testing in opposite VM
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   133
    if [ $client_available -eq 1 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   134
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   135
        # 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
   136
        negative_test $1 "CLIENT" -client
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   137
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   138
    nontiered_tests `expr $1 + 2` $server_level
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   139
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   140
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   141
cleanup() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   142
    ${RM} -f core*
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   143
    ${RM} -f replay*.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   144
    ${RM} -f hs_err_pid*.log
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   145
    ${RM} -f test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   146
    ${RM} -f test_replay.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   147
}
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
JAVA=${TESTJAVA}${FS}bin${FS}java
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   150
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   151
replay_data=test_replay.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   152
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   153
${JAVA} ${TESTOPTS} -Xinternalversion 2>&1 | grep debug
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   154
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   155
# Only test fastdebug 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   156
if [ $? -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   157
then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   158
    echo TEST SKIPPED: product build
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   159
    exit 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   160
fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   161
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   162
is_int=`${JAVA} ${TESTOPTS} -version 2>&1 | grep -c "interpreted mode"`
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   163
# Not applicable for Xint
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   164
if [ $is_int -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   165
then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   166
    echo TEST SKIPPED: interpreted mode
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   167
    exit 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   168
fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   169
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   170
cleanup
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   171
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   172
client_available=`${JAVA} ${TESTOPTS} -client -Xinternalversion 2>&1 | \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   173
        grep -c Client`
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   174
server_available=`${JAVA} ${TESTOPTS} -server -Xinternalversion 2>&1 | \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   175
        grep -c Server`
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   176
tiered_available=`${JAVA} ${TESTOPTS} -XX:+TieredCompilation -XX:+PrintFlagsFinal -version | \
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   177
        grep TieredCompilation | \
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   178
        grep -c true`
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   179
is_tiered=`${JAVA} ${TESTOPTS} -XX:+PrintFlagsFinal -version | \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   180
        grep TieredCompilation | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   181
        grep -c true`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   182
# CompLevel_simple -- C1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   183
client_level=1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   184
# CompLevel_full_optimization -- C2 or Shark 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   185
server_level=4
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   186
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   187
echo "client_available=$client_available"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   188
echo "server_available=$server_available"
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   189
echo "tiered_available=$tiered_available"
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   190
echo "is_tiered=$is_tiered"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   191
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   192
# 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
   193
# $@ - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   194
generate_replay() {
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   195
    if [ $VM_OS != "windows" ]
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   196
    then
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   197
        # enable core dump
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   198
        ulimit -c unlimited
22537
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   199
        new_ulimit=`ulimit -c`
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   200
        if [ $new_ulimit != "unlimited" -a $new_ulimit != "-1" ]
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   201
        then
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   202
            test_fail 2 "CHECK :: ULIMIT" "Could not set 'ulimit -c unlimited'. 'ulimit -c' returns : $new_ulimit"
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   203
        fi
19324
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   204
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   205
        if [ $VM_OS = "solaris" ]
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   206
        then
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   207
            coreadm -p core $$
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   208
        fi
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   209
    fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   210
25924
4c3dd8541530 8051896: jtreg tests don't use $TESTJAVAOPTS
iignatyev
parents: 25737
diff changeset
   211
    cmd="${JAVA} ${TESTOPTS} $@ \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   212
            -Xms8m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   213
            -Xmx32m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   214
            -XX:MetaspaceSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   215
            -XX:MaxMetaspaceSize=16m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   216
            -XX:InitialCodeCacheSize=512k \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   217
            -XX:ReservedCodeCacheSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   218
            -XX:ThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   219
            -XX:VMThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   220
            -XX:CompilerThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   221
            -XX:ParallelGCThreads=1 \
23524
2a2aa2a6b3c3 8038393: [TESTBUG] ciReplay/* tests fail after 8034775
iignatyev
parents: 23206
diff changeset
   222
            -XX:CICompilerCount=2 \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   223
            -Xcomp \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   224
            -XX:CICrashAt=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   225
            -XX:+CreateMinidumpOnCrash \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   226
            -XX:+DumpReplayDataOnError \
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   227
            -XX:-TransmitErrorReport \
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   228
            -XX:+PreferInterpreterNativeStubs \
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   229
            -XX:+PrintCompilation \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   230
            -XX:ReplayDataFile=${replay_data} \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   231
            -version"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   232
    echo GENERATION OF REPLAY.TXT:
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   233
    echo $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   234
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   235
    ${cmd} > crash.out 2>&1
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   236
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   237
    exit_code=$?
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   238
    if [ ${exit_code} -eq 0 ]
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   239
    then
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   240
        cat crash.out
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   241
        test_fail 3 "CHECK :: CRASH" "JVM exits gracefully"
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   242
    fi
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   243
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   244
    core_locations=`grep -i core crash.out | grep "location:" | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   245
            sed -e 's/.*location: //'`
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   246
   
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   247
    if [ -z "${core_locations}" ]
24483
ee49edf1d748 8032498: compiler/ciReplay tests fail with StatusError: failed to clean up files after test...
iignatyev
parents: 23524
diff changeset
   248
    then
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   249
        test_fail 4 "CHECK :: CORE_LOCATION" "output doesn't contain the location of core file, see crash.out"
24483
ee49edf1d748 8032498: compiler/ciReplay tests fail with StatusError: failed to clean up files after test...
iignatyev
parents: 23524
diff changeset
   250
    fi
ee49edf1d748 8032498: compiler/ciReplay tests fail with StatusError: failed to clean up files after test...
iignatyev
parents: 23524
diff changeset
   251
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   252
    rm crash.out 
22537
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   253
    
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   254
    # 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
   255
    if [ $VM_OS != "windows" ]
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   256
    then
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   257
        # remove 'or' between '<core_path>/core.<pid>' and 'core'
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   258
        # and the rest of line -- ' (max size ...) . To ensure a full core ...'
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   259
        core_locations=`echo $core_locations | \
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   260
                sed -e 's/\([^ ]*\) or \([^ ]*\).*/\1 \2/'`
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   261
        core_with_dir=`echo $core_locations | awk '{print $1}'`
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   262
        core_with_pid=`echo $core_locations | awk '{print $2}'`
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   263
        dir=`dirname $core_with_dir`
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   264
        file=`basename $core_with_dir`
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   265
        # add <core_path>/core.<pid> core
28385
bec02e2cbde7 8062012: test/compiler/ciReplay/TestSA.sh should be updated to work w/ modular image build
tpivovarova
parents: 25924
diff changeset
   266
        core_locations='$core_with_dir' '$file'
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   267
        if [ -n "${core_with_pid}" ]
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   268
        then
28385
bec02e2cbde7 8062012: test/compiler/ciReplay/TestSA.sh should be updated to work w/ modular image build
tpivovarova
parents: 25924
diff changeset
   269
            core_locations=$core_locations '$core_with_pid' '$dir${FS}$core_with_pid'
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   270
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   271
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   272
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   273
    echo "LOOKING FOR CORE IN ${core_locations}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   274
    for core in $core_locations
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   275
    do
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   276
        if [ -r "$core" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   277
        then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   278
            core_file=$core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   279
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   280
    done
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   281
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   282
    # core-file was found
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   283
    if [ -n "$core_file" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   284
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   285
        ${MV} "${core_file}" test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   286
        core_file=test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   287
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   288
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   289
    ${RM} -f hs_err_pid*.log
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   290
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   291