Thu, 16 May 2013 12:14:19 -0700
Added tag jdk8-b90 for changeset 1ae0472ff3a0
kamg@2589 | 1 | #!/bin/sh |
kamg@2589 | 2 | |
rdurbin@4802 | 3 | # |
rdurbin@4802 | 4 | # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
rdurbin@4802 | 5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
rdurbin@4802 | 6 | # |
rdurbin@4802 | 7 | # This code is free software; you can redistribute it and/or modify it |
rdurbin@4802 | 8 | # under the terms of the GNU General Public License version 2 only, as |
rdurbin@4802 | 9 | # published by the Free Software Foundation. |
rdurbin@4802 | 10 | # |
rdurbin@4802 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
rdurbin@4802 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
rdurbin@4802 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
rdurbin@4802 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
rdurbin@4802 | 15 | # accompanied this code). |
rdurbin@4802 | 16 | # |
rdurbin@4802 | 17 | # You should have received a copy of the GNU General Public License version |
rdurbin@4802 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
rdurbin@4802 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
rdurbin@4802 | 20 | # |
rdurbin@4802 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
rdurbin@4802 | 22 | # or visit www.oracle.com if you need additional information or have any |
rdurbin@4802 | 23 | # questions. |
rdurbin@4802 | 24 | # |
rdurbin@4802 | 25 | |
rdurbin@4802 | 26 | |
rdurbin@4802 | 27 | |
kamg@2589 | 28 | ## |
kamg@2589 | 29 | ## @test |
kamg@2589 | 30 | ## @bug 6878713 |
rdurbin@4802 | 31 | ## @bug 7030610 |
rdurbin@4802 | 32 | ## @bug 7037122 |
rdurbin@4802 | 33 | ## @bug 7123945 |
kamg@2589 | 34 | ## @summary Verifier heap corruption, relating to backward jsrs |
rdurbin@4802 | 35 | ## @run shell Test6878713.sh |
kamg@2589 | 36 | ## |
collins@4831 | 37 | ## some tests require path to find test source dir |
collins@4831 | 38 | if [ "${TESTSRC}" = "" ] |
collins@4831 | 39 | then |
collins@4831 | 40 | TESTSRC=${PWD} |
collins@4831 | 41 | echo "TESTSRC not set. Using "${TESTSRC}" as default" |
collins@4831 | 42 | fi |
collins@4831 | 43 | echo "TESTSRC=${TESTSRC}" |
collins@4831 | 44 | ## Adding common setup Variables for running shell tests. |
collins@4831 | 45 | . ${TESTSRC}/../../test_env.sh |
kamg@2589 | 46 | |
rdurbin@4802 | 47 | TARGET_CLASS=OOMCrashClass1960_2 |
kamg@2589 | 48 | |
rdurbin@4802 | 49 | echo "INFO: extracting the target class." |
collins@4832 | 50 | ${COMPILEJAVA}${FS}bin${FS}jar xvf \ |
rdurbin@4802 | 51 | ${TESTSRC}${FS}testcase.jar ${TARGET_CLASS}.class |
kamg@2589 | 52 | |
rdurbin@4802 | 53 | # remove any hs_err_pid that might exist here |
rdurbin@4802 | 54 | rm -f hs_err_pid*.log |
rdurbin@4802 | 55 | |
rdurbin@4802 | 56 | echo "INFO: checking for 32-bit versus 64-bit VM." |
rdurbin@4802 | 57 | ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version 2>&1 \ |
rdurbin@4802 | 58 | | grep "64-Bit [^ ][^ ]* VM" > /dev/null 2>&1 |
rdurbin@4802 | 59 | status="$?" |
rdurbin@4802 | 60 | if [ "$status" = 0 ]; then |
rdurbin@4802 | 61 | echo "INFO: testing a 64-bit VM." |
rdurbin@4802 | 62 | is_64_bit=true |
kamg@2589 | 63 | else |
rdurbin@4802 | 64 | echo "INFO: testing a 32-bit VM." |
kamg@2589 | 65 | fi |
rdurbin@4802 | 66 | |
rdurbin@4802 | 67 | if [ "$is_64_bit" = true ]; then |
rdurbin@4802 | 68 | # limit is 768MB in 8-byte words (1024 * 1024 * 768 / 8) == 100663296 |
rdurbin@4802 | 69 | MALLOC_MAX=100663296 |
rdurbin@4802 | 70 | else |
rdurbin@4802 | 71 | # limit is 768MB in 4-byte words (1024 * 1024 * 768 / 4) == 201326592 |
rdurbin@4802 | 72 | MALLOC_MAX=201326592 |
rdurbin@4802 | 73 | fi |
rdurbin@4802 | 74 | echo "INFO: MALLOC_MAX=$MALLOC_MAX" |
rdurbin@4802 | 75 | |
rdurbin@4802 | 76 | echo "INFO: executing the target class." |
rdurbin@4802 | 77 | # -XX:+PrintCommandLineFlags for debugging purposes |
rdurbin@4802 | 78 | # -XX:+IgnoreUnrecognizedVMOptions so test will run on a VM without |
rdurbin@4802 | 79 | # the new -XX:MallocMaxTestWords option |
rdurbin@4802 | 80 | # -XX:+UnlockDiagnosticVMOptions so we can use -XX:MallocMaxTestWords |
rdurbin@4802 | 81 | # -XX:MallocMaxTestWords limits malloc to $MALLOC_MAX |
rdurbin@4802 | 82 | ${TESTJAVA}${FS}bin${FS}java \ |
rdurbin@4802 | 83 | -XX:+PrintCommandLineFlags \ |
rdurbin@4802 | 84 | -XX:+IgnoreUnrecognizedVMOptions \ |
rdurbin@4802 | 85 | -XX:+UnlockDiagnosticVMOptions \ |
rdurbin@4802 | 86 | -XX:MallocMaxTestWords=$MALLOC_MAX \ |
rdurbin@4802 | 87 | ${TESTVMOPTS} ${TARGET_CLASS} > test.out 2>&1 |
rdurbin@4802 | 88 | |
rdurbin@4802 | 89 | echo "INFO: begin contents of test.out:" |
rdurbin@4802 | 90 | cat test.out |
rdurbin@4802 | 91 | echo "INFO: end contents of test.out." |
rdurbin@4802 | 92 | |
rdurbin@4802 | 93 | echo "INFO: checking for memory allocation error message." |
rdurbin@4802 | 94 | # We are looking for this specific memory allocation failure mesg so |
rdurbin@4802 | 95 | # we know we exercised the right allocation path with the test class: |
rdurbin@4802 | 96 | MESG1="Native memory allocation (malloc) failed to allocate 25696531[0-9][0-9] bytes" |
rdurbin@4802 | 97 | grep "$MESG1" test.out |
rdurbin@4802 | 98 | status="$?" |
rdurbin@4802 | 99 | if [ "$status" = 0 ]; then |
rdurbin@4802 | 100 | echo "INFO: found expected memory allocation error message." |
rdurbin@4802 | 101 | else |
rdurbin@4802 | 102 | echo "INFO: did not find expected memory allocation error message." |
rdurbin@4802 | 103 | |
rdurbin@4802 | 104 | # If we didn't find MESG1 above, then there are several scenarios: |
rdurbin@4802 | 105 | # 1) -XX:MallocMaxTestWords is not supported by the current VM and we |
rdurbin@4802 | 106 | # didn't fail TARGET_CLASS's memory allocation attempt; instead |
rdurbin@4802 | 107 | # we failed to find TARGET_CLASS's main() method. The TARGET_CLASS |
rdurbin@4802 | 108 | # is designed to provoke a memory allocation failure during class |
rdurbin@4802 | 109 | # loading; we actually don't care about running the class which is |
rdurbin@4802 | 110 | # why it doesn't have a main() method. |
rdurbin@4802 | 111 | # 2) we failed a memory allocation, but not the one we were looking |
rdurbin@4802 | 112 | # so it might be that TARGET_CLASS no longer tickles the same |
rdurbin@4802 | 113 | # memory allocation code path |
rdurbin@4802 | 114 | # 3) TARGET_CLASS reproduces the failure mode (SIGSEGV) fixed by |
rdurbin@4802 | 115 | # 6878713 because the test is running on a pre-fix VM. |
rdurbin@4802 | 116 | echo "INFO: checking for no main() method message." |
rdurbin@4802 | 117 | MESG2="Error: Main method not found in class" |
rdurbin@4802 | 118 | grep "$MESG2" test.out |
rdurbin@4802 | 119 | status="$?" |
rdurbin@4802 | 120 | if [ "$status" = 0 ]; then |
rdurbin@4802 | 121 | echo "INFO: found no main() method message." |
rdurbin@4802 | 122 | else |
rdurbin@4802 | 123 | echo "FAIL: did not find no main() method message." |
rdurbin@4802 | 124 | # status is non-zero for exit below |
rdurbin@4802 | 125 | |
rdurbin@4802 | 126 | if [ -s hs_err_pid*.log ]; then |
rdurbin@4802 | 127 | echo "INFO: begin contents of hs_err_pid file:" |
rdurbin@4802 | 128 | cat hs_err_pid*.log |
rdurbin@4802 | 129 | echo "INFO: end contents of hs_err_pid file." |
rdurbin@4802 | 130 | fi |
rdurbin@4802 | 131 | fi |
rdurbin@4802 | 132 | fi |
rdurbin@4802 | 133 | |
rdurbin@4802 | 134 | if [ "$status" = 0 ]; then |
rdurbin@4802 | 135 | echo "PASS: test found one of the expected messages." |
rdurbin@4802 | 136 | fi |
rdurbin@4802 | 137 | exit "$status" |