Mercurial > hg > truffle
annotate test/compiler/ciReplay/common.sh @ 14580:a15776cb4e6c
small additional null check in GraphPrinterDumpHandler
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 18 Mar 2014 10:01:08 +0100 |
parents | 4c241e42a3e4 |
children | c0b9499e5525 4ca6dc0799b6 |
rev | line source |
---|---|
10197 | 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" | |
12072
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
92 if [ $tiered_available -eq 1 ] |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
93 then |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
94 positive_test `expr $1 + 1` "COMMON :: TIERED" -XX:+TieredCompilation |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
95 fi |
10197 | 96 } |
97 | |
98 # $1 - initial error_code | |
99 # $2 - non-tiered comp_level | |
100 nontiered_tests() { | |
101 level=`grep "^compile " $replay_data | awk '{print $6}'` | |
102 # is level available in non-tiere | |
103 if [ "$level" -eq $2 ] | |
104 then | |
105 positive_test $1 "NON-TIERED :: AVAILABLE COMP_LEVEL" \ | |
106 -XX:-TieredCompilation | |
107 else | |
108 negative_test `expr $1 + 1` "NON-TIERED :: UNAVAILABLE COMP_LEVEL" \ | |
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 | |
12072
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
121 if [ $tiered_available -eq 1 ] |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
122 then |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
123 positive_test `expr $1 + 1` "SERVER :: TIERED" -XX:+TieredCompilation \ |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
124 -server |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
125 fi |
10197 | 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 | |
153 ${JAVA} ${TESTVMOPTS} -Xinternalversion 2>&1 | grep debug | |
154 | |
155 # Only test fastdebug | |
156 if [ $? -ne 0 ] | |
157 then | |
158 echo TEST SKIPPED: product build | |
159 exit 0 | |
160 fi | |
161 | |
162 is_int=`${JAVA} ${TESTVMOPTS} -version 2>&1 | grep -c "interpreted mode"` | |
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 | |
172 client_available=`${JAVA} ${TESTVMOPTS} -client -Xinternalversion 2>&1 | \ | |
173 grep -c Client` | |
174 server_available=`${JAVA} ${TESTVMOPTS} -server -Xinternalversion 2>&1 | \ | |
175 grep -c Server` | |
12072
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
176 tiered_available=`${JAVA} ${TESTVMOPTS} -XX:+TieredCompilation -XX:+PrintFlagsFinal -version | \ |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
177 grep TieredCompilation | \ |
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
178 grep -c true` |
10197 | 179 is_tiered=`${JAVA} ${TESTVMOPTS} -XX:+PrintFlagsFinal -version | \ |
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" | |
12072
6c72125a2f40
8016456: ciReplay test assumes TIERED compilation is available
iignatyev
parents:
10282
diff
changeset
|
189 echo "tiered_available=$tiered_available" |
10197 | 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() { | |
10282
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
195 if [ $VM_OS != "windows" ] |
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
196 then |
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
197 # enable core dump |
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
198 ulimit -c unlimited |
14295
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
199 new_ulimit=`ulimit -c` |
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
200 if [ $new_ulimit != "unlimited" -a $new_ulimit != "-1" ] |
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
201 then |
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
202 test_fail 2 "CHECK :: ULIMIT" "Could not set 'ulimit -c unlimited'. 'ulimit -c' returns : $new_ulimit" |
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
203 fi |
12065 | 204 |
205 if [ $VM_OS = "solaris" ] | |
206 then | |
207 coreadm -p core $$ | |
208 fi | |
10282
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
209 fi |
10197 | 210 |
211 cmd="${JAVA} ${TESTVMOPTS} $@ \ | |
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 \ | |
222 -XX:CICompilerCount=1 \ | |
223 -Xcomp \ | |
224 -XX:CICrashAt=1 \ | |
225 -XX:+CreateMinidumpOnCrash \ | |
226 -XX:+DumpReplayDataOnError \ | |
227 -XX:ReplayDataFile=${replay_data} \ | |
228 -version" | |
229 echo GENERATION OF REPLAY.TXT: | |
230 echo $cmd | |
231 | |
10282
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
232 ${cmd} > crash.out 2>&1 |
10197 | 233 |
234 core_locations=`grep -i core crash.out | grep "location:" | \ | |
235 sed -e 's/.*location: //'` | |
14295
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
236 echo CRASH OUTPUT: |
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
237 cat crash.out |
10197 | 238 rm crash.out |
14295
4c241e42a3e4
8032662: test/compiler/ciReplay/TestSA.sh should report ulimit issues
sla
parents:
12079
diff
changeset
|
239 |
10197 | 240 # processing core locations for *nix |
10282
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
241 if [ $VM_OS != "windows" ] |
10197 | 242 then |
243 # remove 'or' between '/core.<pid>' and 'core' | |
244 core_locations=`echo $core_locations | \ | |
245 sed -e 's/\([^ ]*\) or \([^ ]*\)/\1 \2/'` | |
246 # add <core_path>/core.<pid> core.<pid> | |
10282
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
247 core_with_dir=`echo $core_locations | awk '{print $1}'` |
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
248 dir=`dirname $core_with_dir` |
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
249 core_with_pid=`echo $core_locations | awk '{print $2}'` |
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
250 if [ -n ${core_with_pid} ] |
10197 | 251 then |
10282
cd6f6fccd287
8014068: TEST_BUG: compiler/ciReplay/TestSA.sh fails on Windows: core wasn't generated
iignatyev
parents:
10197
diff
changeset
|
252 core_locations="$core_locations $dir${FS}$core_with_pid $core_with_pid" |
10197 | 253 fi |
254 fi | |
255 | |
256 echo "LOOKING FOR CORE IN ${core_locations}" | |
257 for core in $core_locations | |
258 do | |
259 if [ -r "$core" ] | |
260 then | |
261 core_file=$core | |
262 fi | |
263 done | |
264 | |
265 # core-file was found | |
266 if [ -n "$core_file" ] | |
267 then | |
268 ${MV} "${core_file}" test_core | |
269 core_file=test_core | |
270 fi | |
271 | |
272 ${RM} -f hs_err_pid*.log | |
273 } | |
274 |