jdk/test/java/lang/instrument/RedefineBigClass.sh
author ykantser
Wed, 22 Jul 2015 09:51:40 +0200
changeset 32018 91c91b3d50a0
parent 31909 8cbbb77c5826
child 33402 1156d495a525
permissions -rw-r--r--
8132094: Mark intermittently failuring core-svc tests Reviewed-by: jbachorik, sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
     1
#
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 26193
diff changeset
     2
# Copyright (c) 2011, 2015 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: 15254
diff changeset
    25
# @bug 7121600 8016838
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    26
# @summary Redefine 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
#
32018
91c91b3d50a0 8132094: Mark intermittently failuring core-svc tests
ykantser
parents: 31909
diff changeset
    29
# @key intermittent
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 26193
diff changeset
    30
# @modules java.instrument
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    31
# @run shell MakeJAR3.sh RedefineBigClassAgent 'Can-Redefine-Classes: true'
26193
09edb0e9f15a 8055677: java/lang/instrument/RedefineBigClass.sh RetransformBigClass.sh start failing after JDK-8055012
sla
parents: 21347
diff changeset
    32
# @run build BigClass RedefineBigClassApp NMTHelper
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    33
# @run shell/timeout=600 RedefineBigClass.sh
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    34
#
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    35
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    36
if [ "${TESTJAVA}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    37
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    38
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    39
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    40
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    41
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    42
if [ "${COMPILEJAVA}" = "" ]
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    43
then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    44
  COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    45
fi
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    46
echo "COMPILEJAVA=${COMPILEJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    47
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    48
if [ "${TESTSRC}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    49
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    50
  echo "TESTSRC not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    51
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    52
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    53
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    54
if [ "${TESTCLASSES}" = "" ]
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    55
then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    56
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    57
  exit 1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    58
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    59
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 11359
diff changeset
    60
JAVAC="${COMPILEJAVA}"/bin/javac
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    61
JAVA="${TESTJAVA}"/bin/java
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    62
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
    63
# 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
    64
"${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
    65
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
    66
    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
    67
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
    68
    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
    69
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
    70
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    71
"${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
    72
    -XX:TraceRedefineClasses=3 ${NMT} \
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    73
    -javaagent:RedefineBigClassAgent.jar=BigClass.class \
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    74
    -classpath "${TESTCLASSES}" RedefineBigClassApp \
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
    75
    > output.log 2>&1 
11359
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    76
result=$?
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    77
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    78
cat output.log
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    79
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    80
if [ "$result" = 0 ]; then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    81
    echo "PASS: RedefineBigClassApp exited with status of 0."
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    82
else
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    83
    echo "FAIL: RedefineBigClassApp exited with status of $result"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    84
    exit "$result"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    85
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    86
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    87
MESG="Exception"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    88
grep "$MESG" output.log
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    89
result=$?
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    90
if [ "$result" = 0 ]; then
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    91
    echo "FAIL: found '$MESG' in the test output"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    92
    result=1
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    93
else
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    94
    echo "PASS: did NOT find '$MESG' in the test output"
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    95
    result=0
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    96
fi
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    97
9e53808b2128 7121600: Instrumentation.redefineClasses() leaks class bytes
dcubed
parents:
diff changeset
    98
exit $result