jdk/test/java/lang/instrument/RetransformBigClass.sh
author sla
Thu, 21 Aug 2014 13:09:28 +0200
changeset 26193 09edb0e9f15a
parent 21596 0e3a39f29dbc
child 30376 2ccf2cf7ea48
permissions -rw-r--r--
8055677: java/lang/instrument/RedefineBigClass.sh RetransformBigClass.sh start failing after JDK-8055012 Summary: Write dcmd output to separate files so it does not confuse the output. Reviewed-by: ctornqvi, mgronlun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     1
#
21596
0e3a39f29dbc 8027696: Incorrect copyright header in the tests
serb
parents: 21347
diff changeset
     2
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
11359
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
19039
accceacb7fa7 8016838: improvement of RedefineBigClass and RetransformBigClass tests
igerasim
parents: 18151
diff changeset
    25
# @bug 7122253 8016838
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    26
# @summary Retransform a big class.
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    27
# @author Daniel D. Daugherty
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    28
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    29
# @run shell MakeJAR4.sh RetransformBigClassAgent SimpleIdentityTransformer 'Can-Retransform-Classes: true'
26193
09edb0e9f15a 8055677: java/lang/instrument/RedefineBigClass.sh RetransformBigClass.sh start failing after JDK-8055012
sla
parents: 21596
diff changeset
    30
# @run build BigClass RetransformBigClassApp NMTHelper
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    31
# @run shell/timeout=600 RetransformBigClass.sh
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    32
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    33
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    34
if [ "${TESTJAVA}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    35
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    36
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    37
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    38
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    39
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    40
if [ "${COMPILEJAVA}" = "" ]
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    41
then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    42
  COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    43
fi
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    44
echo "COMPILEJAVA=${COMPILEJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    45
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    46
if [ "${TESTSRC}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    47
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    48
  echo "TESTSRC not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    49
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    50
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    51
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    52
if [ "${TESTCLASSES}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    53
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    54
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    55
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    56
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    57
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    58
JAVAC="${COMPILEJAVA}"/bin/javac
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    59
JAVA="${TESTJAVA}"/bin/java
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    60
21347
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    61
# Does this VM support the 'detail' level of NMT?
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    62
"${JAVA}" ${TESTVMOPTS} -XX:NativeMemoryTracking=detail -version
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    63
if [ "$?" = 0 ]; then
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    64
    NMT=-XX:NativeMemoryTracking=detail
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    65
else
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    66
    NMT=-XX:NativeMemoryTracking=summary
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    67
fi
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    68
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    69
"${JAVA}" ${TESTVMOPTS} \
21347
21c6a82adf04 8026789: Update test/java/lang/instrument/Re(transform|define)BigClass.sh test to use NMT for memory leak detection
sla
parents: 19039
diff changeset
    70
    -XX:TraceRedefineClasses=3 ${NMT} \
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    71
    -javaagent:RetransformBigClassAgent.jar=BigClass.class \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    72
    -classpath "${TESTCLASSES}" RetransformBigClassApp \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    73
    > output.log 2>&1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    74
result=$?
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    75
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    76
cat output.log
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    77
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    78
if [ "$result" = 0 ]; then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    79
    echo "PASS: RetransformBigClassApp exited with status of 0."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    80
else
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    81
    echo "FAIL: RetransformBigClassApp exited with status of $result"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    82
    exit "$result"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    83
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    84
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    85
MESG="Exception"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    86
grep "$MESG" output.log
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    87
result=$?
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    88
if [ "$result" = 0 ]; then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    89
    echo "FAIL: found '$MESG' in the test output"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    90
    result=1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    91
else
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    92
    echo "PASS: did NOT find '$MESG' in the test output"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    93
    result=0
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    94
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    95
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    96
exit $result