author | jbachorik |
Tue, 21 Jan 2014 13:04:55 +0100 | |
changeset 22353 | d09e3ff5fd63 |
parent 21310 | 4595a9405051 |
child 30327 | 14a05668b003 |
permissions | -rw-r--r-- |
16021
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
1 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
2 |
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
4 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
8 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
9 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
10 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
11 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
12 |
# version 2 for more details (a copy is included in the LICENSE file that |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
13 |
# accompanied this code). |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
14 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
15 |
# You should have received a copy of the GNU General Public License version |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
16 |
# 2 along with this work; if not, write to the Free Software Foundation, |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
17 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
18 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
19 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
20 |
# or visit www.oracle.com if you need additional information or have any |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
21 |
# questions. |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
22 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
23 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
24 |
# @test |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
25 |
# @bug 7174978 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
26 |
# @summary Redefine a class with a method stored in a backtrace. |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
27 |
# @author Stefan Karlsson |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
28 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
29 |
# @run shell MakeJAR3.sh RedefineMethodInBacktraceAgent 'Can-Redefine-Classes: true' |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
30 |
# @run build RedefineMethodInBacktraceTarget RedefineMethodInBacktraceApp |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
31 |
# @run shell RedefineMethodInBacktrace.sh |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
32 |
# |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
33 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
34 |
if [ "${TESTJAVA}" = "" ] |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
35 |
then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
36 |
echo "TESTJAVA not set. Test cannot execute. Failed." |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
37 |
exit 1 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
38 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
39 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
40 |
if [ "${COMPILEJAVA}" = "" ] |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
41 |
then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
42 |
COMPILEJAVA="${TESTJAVA}" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
43 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
44 |
echo "COMPILEJAVA=${COMPILEJAVA}" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
45 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
46 |
if [ "${TESTSRC}" = "" ] |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
47 |
then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
48 |
echo "TESTSRC not set. Test cannot execute. Failed." |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
49 |
exit 1 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
50 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
51 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
52 |
if [ "${TESTCLASSES}" = "" ] |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
53 |
then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
54 |
echo "TESTCLASSES not set. Test cannot execute. Failed." |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
55 |
exit 1 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
56 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
57 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
58 |
JAVAC="${COMPILEJAVA}"/bin/javac |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
59 |
JAVA="${TESTJAVA}"/bin/java |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
60 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
61 |
cp "${TESTSRC}"/RedefineMethodInBacktraceTarget_2.java \ |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
62 |
RedefineMethodInBacktraceTarget.java |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
63 |
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodInBacktraceTarget.java |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
64 |
|
21310
4595a9405051
8025238: nsk/jvmti/scenarios/bcinstr/BI04/bi04t002 crashed with SIGSEGV
sla
parents:
16021
diff
changeset
|
65 |
cp "${TESTSRC}"/RedefineMethodInBacktraceTargetB_2.java \ |
4595a9405051
8025238: nsk/jvmti/scenarios/bcinstr/BI04/bi04t002 crashed with SIGSEGV
sla
parents:
16021
diff
changeset
|
66 |
RedefineMethodInBacktraceTargetB.java |
4595a9405051
8025238: nsk/jvmti/scenarios/bcinstr/BI04/bi04t002 crashed with SIGSEGV
sla
parents:
16021
diff
changeset
|
67 |
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodInBacktraceTargetB.java |
4595a9405051
8025238: nsk/jvmti/scenarios/bcinstr/BI04/bi04t002 crashed with SIGSEGV
sla
parents:
16021
diff
changeset
|
68 |
|
16021
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
69 |
"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodInBacktraceAgent.jar \ |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
70 |
-classpath "${TESTCLASSES}" RedefineMethodInBacktraceApp > output.log 2>&1 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
71 |
RUN_RESULT=$? |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
72 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
73 |
if [ $RUN_RESULT != 0 ]; then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
74 |
echo "FAIL: the run failed with exit code '$RUN_RESULT'" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
75 |
exit $RUN_RESULT |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
76 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
77 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
78 |
cat output.log |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
79 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
80 |
MESG="Exception" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
81 |
grep "$MESG" output.log |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
82 |
result=$? |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
83 |
if [ "$result" = 0 ]; then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
84 |
echo "FAIL: found '$MESG' in the test output" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
85 |
result=1 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
86 |
else |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
87 |
echo "PASS: did NOT find '$MESG' in the test output" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
88 |
result=0 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
89 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
90 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
91 |
exit $result |