Mercurial > hg > graal-jvmci-8
comparison test/runtime/6878713/Test6878713.sh @ 8802:eca90b8a06eb
7030610: runtime/6878713/Test6878713.sh fails Error. failed to clean up files after test
7123945: runtime/6878713/Test6878713.sh require about 2G of native memory, swaps and times out
Summary: Add new diagnostic option -XX:MallocMaxTestWords=NNN and fix Test6878713.sh.
Reviewed-by: dcubed, coleenp, dholmes, iklam
author | rdurbin |
---|---|
date | Tue, 19 Mar 2013 11:33:11 -0700 |
parents | 83b6305a5638 |
children | d1897e7e0488 |
comparison
equal
deleted
inserted
replaced
8756:686916dc0439 | 8802:eca90b8a06eb |
---|---|
1 #!/bin/sh | 1 #!/bin/sh |
2 | |
3 # | |
4 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. | |
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
6 # | |
7 # This code is free software; you can redistribute it and/or modify it | |
8 # under the terms of the GNU General Public License version 2 only, as | |
9 # published by the Free Software Foundation. | |
10 # | |
11 # This code is distributed in the hope that it will be useful, but WITHOUT | |
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 # version 2 for more details (a copy is included in the LICENSE file that | |
15 # accompanied this code). | |
16 # | |
17 # You should have received a copy of the GNU General Public License version | |
18 # 2 along with this work; if not, write to the Free Software Foundation, | |
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
20 # | |
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
22 # or visit www.oracle.com if you need additional information or have any | |
23 # questions. | |
24 # | |
25 | |
26 | |
2 | 27 |
3 ## | 28 ## |
4 ## @test | 29 ## @test |
5 ## @bug 6878713 | 30 ## @bug 6878713 |
31 ## @bug 7030610 | |
32 ## @bug 7037122 | |
33 ## @bug 7123945 | |
6 ## @summary Verifier heap corruption, relating to backward jsrs | 34 ## @summary Verifier heap corruption, relating to backward jsrs |
7 ## @run shell/timeout=120 Test6878713.sh | 35 ## @run shell Test6878713.sh |
8 ## | 36 ## |
9 | 37 |
10 if [ "${TESTSRC}" = "" ] | 38 if [ "${TESTSRC}" = "" ] |
11 then TESTSRC=. | 39 then TESTSRC=. |
12 fi | 40 fi |
47 echo "Unrecognized system!" | 75 echo "Unrecognized system!" |
48 exit 1; | 76 exit 1; |
49 ;; | 77 ;; |
50 esac | 78 esac |
51 | 79 |
52 JEMMYPATH=${CPAPPEND} | 80 CLASSPATH=.${PS}${TESTCLASSES} ; export CLASSPATH |
53 CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH | |
54 | |
55 THIS_DIR=`pwd` | |
56 | 81 |
57 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version | 82 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version |
58 | 83 |
59 ${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar | 84 TARGET_CLASS=OOMCrashClass1960_2 |
60 | 85 |
61 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} OOMCrashClass1960_2 > test.out 2>&1 | 86 echo "INFO: extracting the target class." |
87 ${TESTJAVA}${FS}bin${FS}jar xvf \ | |
88 ${TESTSRC}${FS}testcase.jar ${TARGET_CLASS}.class | |
62 | 89 |
63 if [ -s core -o -s "hs_*.log" ] | 90 # remove any hs_err_pid that might exist here |
64 then | 91 rm -f hs_err_pid*.log |
65 cat hs*.log | 92 |
66 echo "Test Failed" | 93 echo "INFO: checking for 32-bit versus 64-bit VM." |
67 exit 1 | 94 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version 2>&1 \ |
95 | grep "64-Bit [^ ][^ ]* VM" > /dev/null 2>&1 | |
96 status="$?" | |
97 if [ "$status" = 0 ]; then | |
98 echo "INFO: testing a 64-bit VM." | |
99 is_64_bit=true | |
68 else | 100 else |
69 echo "Test Passed" | 101 echo "INFO: testing a 32-bit VM." |
70 exit 0 | |
71 fi | 102 fi |
103 | |
104 if [ "$is_64_bit" = true ]; then | |
105 # limit is 768MB in 8-byte words (1024 * 1024 * 768 / 8) == 100663296 | |
106 MALLOC_MAX=100663296 | |
107 else | |
108 # limit is 768MB in 4-byte words (1024 * 1024 * 768 / 4) == 201326592 | |
109 MALLOC_MAX=201326592 | |
110 fi | |
111 echo "INFO: MALLOC_MAX=$MALLOC_MAX" | |
112 | |
113 echo "INFO: executing the target class." | |
114 # -XX:+PrintCommandLineFlags for debugging purposes | |
115 # -XX:+IgnoreUnrecognizedVMOptions so test will run on a VM without | |
116 # the new -XX:MallocMaxTestWords option | |
117 # -XX:+UnlockDiagnosticVMOptions so we can use -XX:MallocMaxTestWords | |
118 # -XX:MallocMaxTestWords limits malloc to $MALLOC_MAX | |
119 ${TESTJAVA}${FS}bin${FS}java \ | |
120 -XX:+PrintCommandLineFlags \ | |
121 -XX:+IgnoreUnrecognizedVMOptions \ | |
122 -XX:+UnlockDiagnosticVMOptions \ | |
123 -XX:MallocMaxTestWords=$MALLOC_MAX \ | |
124 ${TESTVMOPTS} ${TARGET_CLASS} > test.out 2>&1 | |
125 | |
126 echo "INFO: begin contents of test.out:" | |
127 cat test.out | |
128 echo "INFO: end contents of test.out." | |
129 | |
130 echo "INFO: checking for memory allocation error message." | |
131 # We are looking for this specific memory allocation failure mesg so | |
132 # we know we exercised the right allocation path with the test class: | |
133 MESG1="Native memory allocation (malloc) failed to allocate 25696531[0-9][0-9] bytes" | |
134 grep "$MESG1" test.out | |
135 status="$?" | |
136 if [ "$status" = 0 ]; then | |
137 echo "INFO: found expected memory allocation error message." | |
138 else | |
139 echo "INFO: did not find expected memory allocation error message." | |
140 | |
141 # If we didn't find MESG1 above, then there are several scenarios: | |
142 # 1) -XX:MallocMaxTestWords is not supported by the current VM and we | |
143 # didn't fail TARGET_CLASS's memory allocation attempt; instead | |
144 # we failed to find TARGET_CLASS's main() method. The TARGET_CLASS | |
145 # is designed to provoke a memory allocation failure during class | |
146 # loading; we actually don't care about running the class which is | |
147 # why it doesn't have a main() method. | |
148 # 2) we failed a memory allocation, but not the one we were looking | |
149 # so it might be that TARGET_CLASS no longer tickles the same | |
150 # memory allocation code path | |
151 # 3) TARGET_CLASS reproduces the failure mode (SIGSEGV) fixed by | |
152 # 6878713 because the test is running on a pre-fix VM. | |
153 echo "INFO: checking for no main() method message." | |
154 MESG2="Error: Main method not found in class" | |
155 grep "$MESG2" test.out | |
156 status="$?" | |
157 if [ "$status" = 0 ]; then | |
158 echo "INFO: found no main() method message." | |
159 else | |
160 echo "FAIL: did not find no main() method message." | |
161 # status is non-zero for exit below | |
162 | |
163 if [ -s hs_err_pid*.log ]; then | |
164 echo "INFO: begin contents of hs_err_pid file:" | |
165 cat hs_err_pid*.log | |
166 echo "INFO: end contents of hs_err_pid file." | |
167 fi | |
168 fi | |
169 fi | |
170 | |
171 if [ "$status" = 0 ]; then | |
172 echo "PASS: test found one of the expected messages." | |
173 fi | |
174 exit "$status" |