hotspot/test/compiler/ciReplay/common.sh
author iignatyev
Sat, 19 Jul 2014 00:34:40 +0400
changeset 25737 71793afd180f
parent 24483 ee49edf1d748
child 25924 4c3dd8541530
permissions -rw-r--r--
8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED: 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
# 
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
# 
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"
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    92
    if [ $tiered_available -eq 1 ]
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    93
    then
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    94
        positive_test `expr $1 + 1` "COMMON :: TIERED" -XX:+TieredCompilation
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
    95
    fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    96
}
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
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
    99
# $2 - non-tiered comp_level 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   100
nontiered_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   101
    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
   102
    # is level available in non-tiered
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   103
    if [ "$level" -eq $2 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   104
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   105
        positive_test $1 "NON-TIERED :: AVAILABLE COMP_LEVEL" \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   106
                -XX:-TieredCompilation
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   107
    else
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   108
        negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   109
                -XX:-TieredCompilation
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   110
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   111
}
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
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   114
client_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   115
    # testing in opposite VM
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   116
    if [ $server_available -eq 1 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   117
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   118
        negative_test $1 "SERVER :: NON-TIERED" -XX:-TieredCompilation \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   119
                -server
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   120
        if [ $tiered_available -eq 1 ]
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   121
        then
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   122
            positive_test `expr $1 + 1` "SERVER :: TIERED" -XX:+TieredCompilation \
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   123
                    -server
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   124
        fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   125
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   126
    nontiered_tests `expr $1 + 2` $client_level 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   127
}
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
# $1 - initial error_code
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   130
server_tests() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   131
    # testing in opposite VM
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   132
    if [ $client_available -eq 1 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   133
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   134
        # 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
   135
        negative_test $1 "CLIENT" -client
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   136
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   137
    nontiered_tests `expr $1 + 2` $server_level
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   138
}
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
cleanup() {
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   141
    ${RM} -f core*
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   142
    ${RM} -f replay*.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   143
    ${RM} -f hs_err_pid*.log
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   144
    ${RM} -f test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   145
    ${RM} -f 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
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   148
JAVA=${TESTJAVA}${FS}bin${FS}java
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   149
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   150
replay_data=test_replay.txt
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   151
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   152
${JAVA} ${TESTVMOPTS} -Xinternalversion 2>&1 | grep debug
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   153
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   154
# Only test fastdebug 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   155
if [ $? -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   156
then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   157
    echo TEST SKIPPED: product build
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   158
    exit 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   159
fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   160
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   161
is_int=`${JAVA} ${TESTVMOPTS} -version 2>&1 | grep -c "interpreted mode"`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   162
# Not applicable for Xint
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   163
if [ $is_int -ne 0 ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   164
then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   165
    echo TEST SKIPPED: interpreted mode
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   166
    exit 0
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   167
fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   168
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   169
cleanup
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   170
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   171
client_available=`${JAVA} ${TESTVMOPTS} -client -Xinternalversion 2>&1 | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   172
        grep -c Client`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   173
server_available=`${JAVA} ${TESTVMOPTS} -server -Xinternalversion 2>&1 | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   174
        grep -c Server`
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   175
tiered_available=`${JAVA} ${TESTVMOPTS} -XX:+TieredCompilation -XX:+PrintFlagsFinal -version | \
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   176
        grep TieredCompilation | \
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   177
        grep -c true`
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   178
is_tiered=`${JAVA} ${TESTVMOPTS} -XX:+PrintFlagsFinal -version | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   179
        grep TieredCompilation | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   180
        grep -c true`
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   181
# CompLevel_simple -- C1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   182
client_level=1
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   183
# CompLevel_full_optimization -- C2 or Shark 
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   184
server_level=4
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   185
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   186
echo "client_available=$client_available"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   187
echo "server_available=$server_available"
19331
ff8ddc49a4c2 8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents: 17387
diff changeset
   188
echo "tiered_available=$tiered_available"
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   189
echo "is_tiered=$is_tiered"
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
# 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
   192
# $@ - additional vm opts
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   193
generate_replay() {
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   194
    if [ $VM_OS != "windows" ]
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   195
    then
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   196
        # enable core dump
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   197
        ulimit -c unlimited
22537
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   198
        new_ulimit=`ulimit -c`
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   199
        if [ $new_ulimit != "unlimited" -a $new_ulimit != "-1" ]
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   200
        then
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   201
            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
   202
        fi
19324
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   203
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   204
        if [ $VM_OS = "solaris" ]
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   205
        then
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   206
            coreadm -p core $$
772bf8afb18a 8022655: ClassDump ignored jarStream setting
kevinw
parents: 17387
diff changeset
   207
        fi
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   208
    fi
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   209
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   210
    cmd="${JAVA} ${TESTVMOPTS} $@ \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   211
            -Xms8m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   212
            -Xmx32m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   213
            -XX:MetaspaceSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   214
            -XX:MaxMetaspaceSize=16m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   215
            -XX:InitialCodeCacheSize=512k \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   216
            -XX:ReservedCodeCacheSize=4m \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   217
            -XX:ThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   218
            -XX:VMThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   219
            -XX:CompilerThreadStackSize=512 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   220
            -XX:ParallelGCThreads=1 \
23524
2a2aa2a6b3c3 8038393: [TESTBUG] ciReplay/* tests fail after 8034775
iignatyev
parents: 23206
diff changeset
   221
            -XX:CICompilerCount=2 \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   222
            -Xcomp \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   223
            -XX:CICrashAt=1 \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   224
            -XX:+CreateMinidumpOnCrash \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   225
            -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
   226
            -XX:-TransmitErrorReport \
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   227
            -XX:+PreferInterpreterNativeStubs \
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   228
            -XX:+PrintCompilation \
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   229
            -XX:ReplayDataFile=${replay_data} \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   230
            -version"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   231
    echo GENERATION OF REPLAY.TXT:
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   232
    echo $cmd
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   233
17387
201ce4a5360b 8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents: 17123
diff changeset
   234
    ${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
   235
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   236
    exit_code=$?
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   237
    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
   238
    then
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   239
        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
   240
        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
   241
    fi
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   242
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   243
    core_locations=`grep -i core crash.out | grep "location:" | \
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   244
            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
   245
   
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   246
    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
   247
    then
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   248
        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
   249
    fi
ee49edf1d748 8032498: compiler/ciReplay tests fail with StatusError: failed to clean up files after test...
iignatyev
parents: 23524
diff changeset
   250
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   251
    rm crash.out 
22537
ee91b0428fa7 8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents: 19338
diff changeset
   252
    
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   253
    # 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
   254
    if [ $VM_OS != "windows" ]
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   255
    then
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   256
        # 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
   257
        # 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
   258
        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
   259
                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
   260
        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
   261
        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
   262
        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
   263
        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
   264
        # add <core_path>/core.<pid> core
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   265
        core_locations="'$core_with_dir' '$file'"
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   266
        if [ -n "${core_with_pid}" ]
17123
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   267
        then
25737
71793afd180f 8031978: compiler/ciReplay/TestVM_no_comp_level.sh fails with "TEST [CHECK :: REPLAY DATA GENERATION] FAILED:
iignatyev
parents: 24483
diff changeset
   268
            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
   269
        fi
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
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   272
    echo "LOOKING FOR CORE IN ${core_locations}"
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   273
    for core in $core_locations
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   274
    do
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   275
        if [ -r "$core" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   276
        then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   277
            core_file=$core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   278
        fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   279
    done
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   280
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   281
    # core-file was found
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   282
    if [ -n "$core_file" ]
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   283
    then
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   284
        ${MV} "${core_file}" test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   285
        core_file=test_core
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   286
    fi
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   287
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   288
    ${RM} -f hs_err_pid*.log
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   289
}
a8e62eed2e3e 8011675: adding compilation level to replay data
iignatyev
parents:
diff changeset
   290