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