jdk/test/java/lang/instrument/RetransformBigClass.sh
author plevart
Fri, 17 May 2013 14:41:39 +0200
changeset 17698 ab37c47ff886
parent 15254 3997a6f357cb
child 18151 bd65ac25937c
permissions -rw-r--r--
8014477: (str) Race condition in String.contentEquals when comparing with StringBuffer Reviewed-by: alanb, mduigou, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     1
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     2
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     4
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     7
# published by the Free Software Foundation.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     8
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    13
# accompanied this code).
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    14
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    18
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    21
# questions.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    22
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    23
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    24
# @test
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    25
# @bug 7122253
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    26
# @ignore until the fix for 7122253 (from HotSpot) is in a promoted build
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    27
# @summary Retransform a big class.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    28
# @author Daniel D. Daugherty
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    29
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    30
# @run shell MakeJAR4.sh RetransformBigClassAgent SimpleIdentityTransformer 'Can-Retransform-Classes: true'
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    31
# @run build BigClass RetransformBigClassApp
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    32
# @run shell/timeout=600 RetransformBigClass.sh
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    33
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    34
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    35
if [ "${TESTJAVA}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    36
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    37
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    38
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    39
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    40
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    41
if [ "${COMPILEJAVA}" = "" ]
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    42
then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    43
  COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    44
fi
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    45
echo "COMPILEJAVA=${COMPILEJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    46
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    47
if [ "${TESTSRC}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    48
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    49
  echo "TESTSRC not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    50
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    51
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    52
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    53
if [ "${TESTCLASSES}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    54
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    55
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    56
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    57
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    58
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    59
JAVAC="${COMPILEJAVA}"/bin/javac
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    60
JAVA="${TESTJAVA}"/bin/java
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    61
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    62
"${JAVA}" ${TESTVMOPTS} \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    63
    -XX:TraceRedefineClasses=3 \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    64
    -javaagent:RetransformBigClassAgent.jar=BigClass.class \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    65
    -classpath "${TESTCLASSES}" RetransformBigClassApp \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    66
    > output.log 2>&1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    67
result=$?
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    68
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    69
cat output.log
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    70
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    71
if [ "$result" = 0 ]; then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    72
    echo "PASS: RetransformBigClassApp exited with status of 0."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    73
else
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    74
    echo "FAIL: RetransformBigClassApp exited with status of $result"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    75
    exit "$result"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    76
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    77
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    78
MESG="Exception"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    79
grep "$MESG" output.log
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    80
result=$?
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    81
if [ "$result" = 0 ]; then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    82
    echo "FAIL: found '$MESG' in the test output"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    83
    result=1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    84
else
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    85
    echo "PASS: did NOT find '$MESG' in the test output"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    86
    result=0
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    87
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    88
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    89
exit $result