author | chegar |
Tue, 22 Mar 2016 15:26:07 +0000 | |
changeset 36694 | 182a5e7a519e |
parent 28385 | bec02e2cbde7 |
permissions | -rw-r--r-- |
17123 | 1 |
#!/bin/sh |
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 | 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 |
# |
|
25924 | 25 |
set -x |
17123 | 26 |
|
27 |
# $1 - error code |
|
28 |
# $2 - test name |
|
29 |
# $3,.. - decription |
|
30 |
test_fail() { |
|
31 |
error=$1 |
|
32 |
shift |
|
33 |
name=$1 |
|
34 |
shift |
|
35 |
echo "TEST [$name] FAILED:" |
|
36 |
echo "$@" |
|
37 |
exit $error |
|
38 |
} |
|
39 |
||
40 |
# $@ - additional vm opts |
|
41 |
start_test() { |
|
42 |
# disable core dump on *nix |
|
43 |
ulimit -S -c 0 |
|
44 |
# disable core dump on windows |
|
45 |
VMOPTS="$@ -XX:-CreateMinidumpOnCrash" |
|
46 |
cmd="${JAVA} ${VMOPTS} -XX:+ReplayCompiles -XX:ReplayDataFile=${replay_data}" |
|
47 |
echo $cmd |
|
48 |
$cmd |
|
49 |
return $? |
|
50 |
} |
|
51 |
||
52 |
# $1 - error_code |
|
53 |
# $2 - test name |
|
54 |
# $3,.. - additional vm opts |
|
55 |
positive_test() { |
|
56 |
error=$1 |
|
57 |
shift |
|
58 |
name=$1 |
|
59 |
shift |
|
25924 | 60 |
VMOPTS="${TESTOPTS} $@" |
17123 | 61 |
echo "POSITIVE TEST [$name]" |
62 |
start_test ${VMOPTS} |
|
63 |
exit_code=$? |
|
64 |
if [ ${exit_code} -ne 0 ] |
|
65 |
then |
|
66 |
test_fail $error "$name" "exit_code[${exit_code}] != 0 during replay "\ |
|
67 |
"w/ vmopts: ${VMOPTS}" |
|
68 |
fi |
|
69 |
} |
|
70 |
||
71 |
# $1 - error_code |
|
72 |
# $2 - test name |
|
73 |
# $2,.. - additional vm opts |
|
74 |
negative_test() { |
|
75 |
error=$1 |
|
76 |
shift |
|
77 |
name=$1 |
|
78 |
shift |
|
25924 | 79 |
VMOPTS="${TESTOPTS} $@" |
17123 | 80 |
echo "NEGATIVE TEST [$name]" |
81 |
start_test ${VMOPTS} |
|
82 |
exit_code=$? |
|
83 |
if [ ${exit_code} -eq 0 ] |
|
84 |
then |
|
85 |
test_fail $error "$name" "exit_code[${exit_code}] == 0 during replay "\ |
|
86 |
"w/ vmopts: ${VMOPTS}" |
|
87 |
fi |
|
88 |
} |
|
89 |
||
90 |
# $1 - initial error_code |
|
91 |
common_tests() { |
|
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 | 97 |
} |
98 |
||
99 |
# $1 - initial error_code |
|
100 |
# $2 - non-tiered comp_level |
|
101 |
nontiered_tests() { |
|
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 | 104 |
if [ "$level" -eq $2 ] |
105 |
then |
|
106 |
positive_test $1 "NON-TIERED :: AVAILABLE COMP_LEVEL" \ |
|
107 |
-XX:-TieredCompilation |
|
108 |
else |
|
109 |
negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \ |
|
110 |
-XX:-TieredCompilation |
|
111 |
fi |
|
112 |
} |
|
113 |
||
114 |
# $1 - initial error_code |
|
115 |
client_tests() { |
|
116 |
# testing in opposite VM |
|
117 |
if [ $server_available -eq 1 ] |
|
118 |
then |
|
119 |
negative_test $1 "SERVER :: NON-TIERED" -XX:-TieredCompilation \ |
|
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 | 126 |
fi |
127 |
nontiered_tests `expr $1 + 2` $client_level |
|
128 |
} |
|
129 |
||
130 |
# $1 - initial error_code |
|
131 |
server_tests() { |
|
132 |
# testing in opposite VM |
|
133 |
if [ $client_available -eq 1 ] |
|
134 |
then |
|
135 |
# tiered is unavailable in client vm, so results w/ flags will be the same as w/o flags |
|
136 |
negative_test $1 "CLIENT" -client |
|
137 |
fi |
|
138 |
nontiered_tests `expr $1 + 2` $server_level |
|
139 |
} |
|
140 |
||
141 |
cleanup() { |
|
142 |
${RM} -f core* |
|
143 |
${RM} -f replay*.txt |
|
144 |
${RM} -f hs_err_pid*.log |
|
145 |
${RM} -f test_core |
|
146 |
${RM} -f test_replay.txt |
|
147 |
} |
|
148 |
||
149 |
JAVA=${TESTJAVA}${FS}bin${FS}java |
|
150 |
||
151 |
replay_data=test_replay.txt |
|
152 |
||
25924 | 153 |
${JAVA} ${TESTOPTS} -Xinternalversion 2>&1 | grep debug |
17123 | 154 |
|
155 |
# Only test fastdebug |
|
156 |
if [ $? -ne 0 ] |
|
157 |
then |
|
158 |
echo TEST SKIPPED: product build |
|
159 |
exit 0 |
|
160 |
fi |
|
161 |
||
25924 | 162 |
is_int=`${JAVA} ${TESTOPTS} -version 2>&1 | grep -c "interpreted mode"` |
17123 | 163 |
# Not applicable for Xint |
164 |
if [ $is_int -ne 0 ] |
|
165 |
then |
|
166 |
echo TEST SKIPPED: interpreted mode |
|
167 |
exit 0 |
|
168 |
fi |
|
169 |
||
170 |
cleanup |
|
171 |
||
25924 | 172 |
client_available=`${JAVA} ${TESTOPTS} -client -Xinternalversion 2>&1 | \ |
17123 | 173 |
grep -c Client` |
25924 | 174 |
server_available=`${JAVA} ${TESTOPTS} -server -Xinternalversion 2>&1 | \ |
17123 | 175 |
grep -c Server` |
25924 | 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 | 179 |
is_tiered=`${JAVA} ${TESTOPTS} -XX:+PrintFlagsFinal -version | \ |
17123 | 180 |
grep TieredCompilation | \ |
181 |
grep -c true` |
|
182 |
# CompLevel_simple -- C1 |
|
183 |
client_level=1 |
|
184 |
# CompLevel_full_optimization -- C2 or Shark |
|
185 |
server_level=4 |
|
186 |
||
187 |
echo "client_available=$client_available" |
|
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 | 190 |
echo "is_tiered=$is_tiered" |
191 |
||
192 |
# crash vm in compiler thread with generation replay data and 'small' dump-file |
|
193 |
# $@ - additional vm opts |
|
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 | 204 |
|
205 |
if [ $VM_OS = "solaris" ] |
|
206 |
then |
|
207 |
coreadm -p core $$ |
|
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 | 210 |
|
25924 | 211 |
cmd="${JAVA} ${TESTOPTS} $@ \ |
17123 | 212 |
-Xms8m \ |
213 |
-Xmx32m \ |
|
214 |
-XX:MetaspaceSize=4m \ |
|
215 |
-XX:MaxMetaspaceSize=16m \ |
|
216 |
-XX:InitialCodeCacheSize=512k \ |
|
217 |
-XX:ReservedCodeCacheSize=4m \ |
|
218 |
-XX:ThreadStackSize=512 \ |
|
219 |
-XX:VMThreadStackSize=512 \ |
|
220 |
-XX:CompilerThreadStackSize=512 \ |
|
221 |
-XX:ParallelGCThreads=1 \ |
|
23524
2a2aa2a6b3c3
8038393: [TESTBUG] ciReplay/* tests fail after 8034775
iignatyev
parents:
23206
diff
changeset
|
222 |
-XX:CICompilerCount=2 \ |
17123 | 223 |
-Xcomp \ |
224 |
-XX:CICrashAt=1 \ |
|
225 |
-XX:+CreateMinidumpOnCrash \ |
|
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 | 230 |
-XX:ReplayDataFile=${replay_data} \ |
231 |
-version" |
|
232 |
echo GENERATION OF REPLAY.TXT: |
|
233 |
echo $cmd |
|
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 | 244 |
core_locations=`grep -i core crash.out | grep "location:" | \ |
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 | 252 |
rm crash.out |
22537
ee91b0428fa7
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
19338
diff
changeset
|
253 |
|
17123 | 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 | 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 | 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 | 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 | 270 |
fi |
271 |
fi |
|
272 |
||
273 |
echo "LOOKING FOR CORE IN ${core_locations}" |
|
274 |
for core in $core_locations |
|
275 |
do |
|
276 |
if [ -r "$core" ] |
|
277 |
then |
|
278 |
core_file=$core |
|
279 |
fi |
|
280 |
done |
|
281 |
||
282 |
# core-file was found |
|
283 |
if [ -n "$core_file" ] |
|
284 |
then |
|
285 |
${MV} "${core_file}" test_core |
|
286 |
core_file=test_core |
|
287 |
fi |
|
288 |
||
289 |
${RM} -f hs_err_pid*.log |
|
290 |
} |
|
291 |