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