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