author | chegar |
Tue, 09 Aug 2011 16:39:04 +0100 | |
changeset 10150 | dee4cb73adc3 |
parent 5506 | 202f599c92aa |
child 15254 | 3997a6f357cb |
permissions | -rw-r--r-- |
278
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
1 |
# |
5506 | 2 |
# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
278
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
4 |
# |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
8 |
# |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
9 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
10 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
11 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
12 |
# version 2 for more details (a copy is included in the LICENSE file that |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
13 |
# accompanied this code). |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
14 |
# |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
15 |
# You should have received a copy of the GNU General Public License version |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
16 |
# 2 along with this work; if not, write to the Free Software Foundation, |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
17 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
18 |
# |
5506 | 19 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
# or visit www.oracle.com if you need additional information or have any |
|
21 |
# questions. |
|
278
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
22 |
# |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
23 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
24 |
# @test |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
25 |
# @bug 5003341 4917140 6545149 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
26 |
# @summary Redefine a class with a native method. |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
27 |
# @author Daniel D. Daugherty as modified from the test submitted by clovis@par.univie.ac.at |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
28 |
# |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
29 |
# @run shell MakeJAR3.sh RedefineClassWithNativeMethodAgent 'Can-Redefine-Classes: true' |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
30 |
# @run build RedefineClassWithNativeMethodApp |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
31 |
# @run shell RedefineClassWithNativeMethod.sh |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
32 |
# |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
33 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
34 |
if [ "${TESTJAVA}" = "" ] |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
35 |
then |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
36 |
echo "TESTJAVA not set. Test cannot execute. Failed." |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
37 |
exit 1 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
38 |
fi |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
39 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
40 |
if [ "${TESTSRC}" = "" ] |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
41 |
then |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
42 |
echo "TESTSRC not set. Test cannot execute. Failed." |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
43 |
exit 1 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
44 |
fi |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
45 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
46 |
if [ "${TESTCLASSES}" = "" ] |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
47 |
then |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
48 |
echo "TESTCLASSES not set. Test cannot execute. Failed." |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
49 |
exit 1 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
50 |
fi |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
51 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
52 |
JAVAC="${TESTJAVA}"/bin/javac |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
53 |
JAVA="${TESTJAVA}"/bin/java |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
54 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
55 |
"${JAVA}" ${TESTVMOPTS} \ |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
56 |
-javaagent:RedefineClassWithNativeMethodAgent.jar=java/lang/Thread.class \ |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
57 |
-classpath "${TESTCLASSES}" RedefineClassWithNativeMethodApp \ |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
58 |
> output.log 2>&1 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
59 |
result=$? |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
60 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
61 |
cat output.log |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
62 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
63 |
if [ "$result" = 0 ]; then |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
64 |
echo "PASS: RedefineClassWithNativeMethodApp exited with status of 0." |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
65 |
else |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
66 |
echo "FAIL: RedefineClassWithNativeMethodApp exited with status of $result" |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
67 |
exit "$result" |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
68 |
fi |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
69 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
70 |
MESG="Exception" |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
71 |
grep "$MESG" output.log |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
72 |
result=$? |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
73 |
if [ "$result" = 0 ]; then |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
74 |
echo "FAIL: found '$MESG' in the test output" |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
75 |
result=1 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
76 |
else |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
77 |
echo "PASS: did NOT find '$MESG' in the test output" |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
78 |
result=0 |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
79 |
fi |
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
80 |
|
b6cec9b83669
6545149: 4/4 JLI Instrumentation.redefineClasses SIGSEGVs on java/lang/Thread
dcubed
parents:
diff
changeset
|
81 |
exit $result |