comparison test/runtime/7020373/Test7020373.sh @ 3862:52e4ba46751f

7020373: JSR rewriting can overflow memory address size variables Summary: Abort if incoming classfile's parameters would cause overflows Reviewed-by: coleenp, dcubed, never
author kamg
date Tue, 12 Apr 2011 16:42:26 -0400
parents
children a884a8b0ec6d
comparison
equal deleted inserted replaced
3861:8b135e6129d6 3862:52e4ba46751f
1 #!/bin/sh
2
3 ##
4 ## @test
5 ## @bug 7020373
6 ## @key cte_test
7 ## @summary JSR rewriting can overflow memory address size variables
8 ## @run shell Test7020373.sh
9 ##
10
11 if [ "${TESTSRC}" = "" ]
12 then TESTSRC=.
13 fi
14
15 if [ "${TESTJAVA}" = "" ]
16 then
17 PARENT=`dirname \`which java\``
18 TESTJAVA=`dirname ${PARENT}`
19 echo "TESTJAVA not set, selecting " ${TESTJAVA}
20 echo "If this is incorrect, try setting the variable manually."
21 fi
22
23 if [ "${TESTCLASSES}" = "" ]
24 then
25 echo "TESTCLASSES not set. Test cannot execute. Failed."
26 exit 1
27 fi
28
29 BIT_FLAG=""
30
31 # set platform-dependent variables
32 OS=`uname -s`
33 case "$OS" in
34 SunOS | Linux )
35 NULL=/dev/null
36 PS=":"
37 FS="/"
38 ## for solaris, linux it's HOME
39 FILE_LOCATION=$HOME
40 if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
41 then
42 BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT | grep -v '^#'`
43 fi
44 ;;
45 Windows_* )
46 NULL=NUL
47 PS=";"
48 FS="\\"
49 ;;
50 * )
51 echo "Unrecognized system!"
52 exit 1;
53 ;;
54 esac
55
56 JEMMYPATH=${CPAPPEND}
57 CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
58
59 THIS_DIR=`pwd`
60
61 ${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version
62
63 ${TESTJAVA}${FS}bin${FS}jar xvf ${TESTSRC}${FS}testcase.jar
64
65 ${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} OOMCrashClass4000_1 > test.out 2>&1
66
67 cat test.out
68
69 egrep "SIGSEGV|An unexpected error has been detected" test.out
70
71 if [ $? = 0 ]
72 then
73 echo "Test Failed"
74 exit 1
75 else
76 grep "java.lang.LinkageError" test.out
77 if [ $? = 0 ]
78 then
79 echo "Test Passed"
80 exit 0
81 else
82 echo "Test Failed"
83 exit 1
84 fi
85 fi