author | coleenp |
Wed, 17 Apr 2013 12:50:45 -0400 | |
changeset 16924 | 8a86b4fa429b |
parent 16021 | 471eee27e770 |
child 21310 | 4595a9405051 |
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 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
65 |
"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodInBacktraceAgent.jar \ |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
66 |
-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
|
67 |
RUN_RESULT=$? |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
68 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
69 |
if [ $RUN_RESULT != 0 ]; then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
70 |
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
|
71 |
exit $RUN_RESULT |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
72 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
73 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
74 |
cat output.log |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
75 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
76 |
MESG="Exception" |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
77 |
grep "$MESG" output.log |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
78 |
result=$? |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
79 |
if [ "$result" = 0 ]; then |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
80 |
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
|
81 |
result=1 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
82 |
else |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
83 |
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
|
84 |
result=0 |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
85 |
fi |
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
86 |
|
471eee27e770
8006506: Add test for redefining methods in backtraces to java/lang/instrument tests
stefank
parents:
diff
changeset
|
87 |
exit $result |