test/runtime/6878713/Test6878713.sh

Tue, 19 Mar 2013 11:33:11 -0700

author
rdurbin
date
Tue, 19 Mar 2013 11:33:11 -0700
changeset 4802
eca90b8a06eb
parent 4022
83b6305a5638
child 4832
d1897e7e0488
permissions
-rw-r--r--

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

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 ##
kamg@2589 37
kamg@2589 38 if [ "${TESTSRC}" = "" ]
kamg@2589 39 then TESTSRC=.
kamg@2589 40 fi
kamg@2589 41
kamg@2589 42 if [ "${TESTJAVA}" = "" ]
kamg@2589 43 then
kamg@2589 44 PARENT=`dirname \`which java\``
kamg@2589 45 TESTJAVA=`dirname ${PARENT}`
kamg@2589 46 echo "TESTJAVA not set, selecting " ${TESTJAVA}
kamg@2589 47 echo "If this is incorrect, try setting the variable manually."
kamg@2589 48 fi
kamg@2589 49
kamg@2589 50 if [ "${TESTCLASSES}" = "" ]
kamg@2589 51 then
kamg@2589 52 echo "TESTCLASSES not set. Test cannot execute. Failed."
kamg@2589 53 exit 1
kamg@2589 54 fi
kamg@2589 55
kamg@2589 56 # set platform-dependent variables
kamg@2589 57 OS=`uname -s`
kamg@2589 58 case "$OS" in
coleenp@3985 59 SunOS | Linux | Darwin )
kamg@2589 60 NULL=/dev/null
kamg@2589 61 PS=":"
kamg@2589 62 FS="/"
kamg@2589 63 ;;
kamg@2589 64 Windows_* )
kamg@2589 65 NULL=NUL
kamg@2589 66 PS=";"
kamg@2589 67 FS="\\"
kamg@2589 68 ;;
coleenp@4022 69 CYGWIN_* )
coleenp@4022 70 NULL=/dev/null
coleenp@4022 71 PS=";"
coleenp@4022 72 FS="/"
coleenp@4022 73 ;;
kamg@2589 74 * )
kamg@2589 75 echo "Unrecognized system!"
kamg@2589 76 exit 1;
kamg@2589 77 ;;
kamg@2589 78 esac
kamg@2589 79
rdurbin@4802 80 CLASSPATH=.${PS}${TESTCLASSES} ; export CLASSPATH
kamg@2589 81
kevinw@3777 82 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version
kamg@2589 83
rdurbin@4802 84 TARGET_CLASS=OOMCrashClass1960_2
kamg@2589 85
rdurbin@4802 86 echo "INFO: extracting the target class."
rdurbin@4802 87 ${TESTJAVA}${FS}bin${FS}jar xvf \
rdurbin@4802 88 ${TESTSRC}${FS}testcase.jar ${TARGET_CLASS}.class
kamg@2589 89
rdurbin@4802 90 # remove any hs_err_pid that might exist here
rdurbin@4802 91 rm -f hs_err_pid*.log
rdurbin@4802 92
rdurbin@4802 93 echo "INFO: checking for 32-bit versus 64-bit VM."
rdurbin@4802 94 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -version 2>&1 \
rdurbin@4802 95 | grep "64-Bit [^ ][^ ]* VM" > /dev/null 2>&1
rdurbin@4802 96 status="$?"
rdurbin@4802 97 if [ "$status" = 0 ]; then
rdurbin@4802 98 echo "INFO: testing a 64-bit VM."
rdurbin@4802 99 is_64_bit=true
kamg@2589 100 else
rdurbin@4802 101 echo "INFO: testing a 32-bit VM."
kamg@2589 102 fi
rdurbin@4802 103
rdurbin@4802 104 if [ "$is_64_bit" = true ]; then
rdurbin@4802 105 # limit is 768MB in 8-byte words (1024 * 1024 * 768 / 8) == 100663296
rdurbin@4802 106 MALLOC_MAX=100663296
rdurbin@4802 107 else
rdurbin@4802 108 # limit is 768MB in 4-byte words (1024 * 1024 * 768 / 4) == 201326592
rdurbin@4802 109 MALLOC_MAX=201326592
rdurbin@4802 110 fi
rdurbin@4802 111 echo "INFO: MALLOC_MAX=$MALLOC_MAX"
rdurbin@4802 112
rdurbin@4802 113 echo "INFO: executing the target class."
rdurbin@4802 114 # -XX:+PrintCommandLineFlags for debugging purposes
rdurbin@4802 115 # -XX:+IgnoreUnrecognizedVMOptions so test will run on a VM without
rdurbin@4802 116 # the new -XX:MallocMaxTestWords option
rdurbin@4802 117 # -XX:+UnlockDiagnosticVMOptions so we can use -XX:MallocMaxTestWords
rdurbin@4802 118 # -XX:MallocMaxTestWords limits malloc to $MALLOC_MAX
rdurbin@4802 119 ${TESTJAVA}${FS}bin${FS}java \
rdurbin@4802 120 -XX:+PrintCommandLineFlags \
rdurbin@4802 121 -XX:+IgnoreUnrecognizedVMOptions \
rdurbin@4802 122 -XX:+UnlockDiagnosticVMOptions \
rdurbin@4802 123 -XX:MallocMaxTestWords=$MALLOC_MAX \
rdurbin@4802 124 ${TESTVMOPTS} ${TARGET_CLASS} > test.out 2>&1
rdurbin@4802 125
rdurbin@4802 126 echo "INFO: begin contents of test.out:"
rdurbin@4802 127 cat test.out
rdurbin@4802 128 echo "INFO: end contents of test.out."
rdurbin@4802 129
rdurbin@4802 130 echo "INFO: checking for memory allocation error message."
rdurbin@4802 131 # We are looking for this specific memory allocation failure mesg so
rdurbin@4802 132 # we know we exercised the right allocation path with the test class:
rdurbin@4802 133 MESG1="Native memory allocation (malloc) failed to allocate 25696531[0-9][0-9] bytes"
rdurbin@4802 134 grep "$MESG1" test.out
rdurbin@4802 135 status="$?"
rdurbin@4802 136 if [ "$status" = 0 ]; then
rdurbin@4802 137 echo "INFO: found expected memory allocation error message."
rdurbin@4802 138 else
rdurbin@4802 139 echo "INFO: did not find expected memory allocation error message."
rdurbin@4802 140
rdurbin@4802 141 # If we didn't find MESG1 above, then there are several scenarios:
rdurbin@4802 142 # 1) -XX:MallocMaxTestWords is not supported by the current VM and we
rdurbin@4802 143 # didn't fail TARGET_CLASS's memory allocation attempt; instead
rdurbin@4802 144 # we failed to find TARGET_CLASS's main() method. The TARGET_CLASS
rdurbin@4802 145 # is designed to provoke a memory allocation failure during class
rdurbin@4802 146 # loading; we actually don't care about running the class which is
rdurbin@4802 147 # why it doesn't have a main() method.
rdurbin@4802 148 # 2) we failed a memory allocation, but not the one we were looking
rdurbin@4802 149 # so it might be that TARGET_CLASS no longer tickles the same
rdurbin@4802 150 # memory allocation code path
rdurbin@4802 151 # 3) TARGET_CLASS reproduces the failure mode (SIGSEGV) fixed by
rdurbin@4802 152 # 6878713 because the test is running on a pre-fix VM.
rdurbin@4802 153 echo "INFO: checking for no main() method message."
rdurbin@4802 154 MESG2="Error: Main method not found in class"
rdurbin@4802 155 grep "$MESG2" test.out
rdurbin@4802 156 status="$?"
rdurbin@4802 157 if [ "$status" = 0 ]; then
rdurbin@4802 158 echo "INFO: found no main() method message."
rdurbin@4802 159 else
rdurbin@4802 160 echo "FAIL: did not find no main() method message."
rdurbin@4802 161 # status is non-zero for exit below
rdurbin@4802 162
rdurbin@4802 163 if [ -s hs_err_pid*.log ]; then
rdurbin@4802 164 echo "INFO: begin contents of hs_err_pid file:"
rdurbin@4802 165 cat hs_err_pid*.log
rdurbin@4802 166 echo "INFO: end contents of hs_err_pid file."
rdurbin@4802 167 fi
rdurbin@4802 168 fi
rdurbin@4802 169 fi
rdurbin@4802 170
rdurbin@4802 171 if [ "$status" = 0 ]; then
rdurbin@4802 172 echo "PASS: test found one of the expected messages."
rdurbin@4802 173 fi
rdurbin@4802 174 exit "$status"

mercurial