jdk/test/java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.sh
author ykantser
Thu, 07 May 2015 09:11:49 +0200
changeset 30376 2ccf2cf7ea48
parent 13576 850377563282
child 33402 1156d495a525
permissions -rw-r--r--
8078896: Add @modules as needed to the jdk_svc tests Reviewed-by: alanb, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13576
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     1
#
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 13576
diff changeset
     2
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
13576
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     4
#
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     7
# published by the Free Software Foundation.
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     8
#
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
     9
# This code is distributed in the hope that it will be useful, but WITHOUT
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    12
# version 2 for more details (a copy is included in the LICENSE file that
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    13
# accompanied this code).
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    14
#
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    15
# You should have received a copy of the GNU General Public License version
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    16
# 2 along with this work; if not, write to the Free Software Foundation,
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    17
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    18
#
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    19
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    20
# or visit www.oracle.com if you need additional information or have any
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    21
# questions.
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    22
#
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    23
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    24
#
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    25
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    26
# @test
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    27
# @bug 7064927
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    28
# @summary Verify LocalVariableTable (LVT) exists when passed to
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    29
# transform() on a retransform operation.
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    30
# @author Daniel D. Daugherty
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    31
#
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 13576
diff changeset
    32
# @modules java.instrument
13576
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    33
# @run build VerifyLocalVariableTableOnRetransformTest
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    34
# @run compile -g DummyClassWithLVT.java
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    35
# @run shell MakeJAR.sh retransformAgent
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    36
# @run shell VerifyLocalVariableTableOnRetransformTest.sh
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    37
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    38
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    39
if [ "${TESTJAVA}" = "" ]
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    40
then
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    41
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    42
  exit 1
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    43
fi
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    44
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    45
if [ "${TESTSRC}" = "" ]
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    46
then
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    47
  echo "TESTSRC not set.  Test cannot execute.  Failed."
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    48
  exit 1
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    49
fi
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    50
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    51
if [ "${TESTCLASSES}" = "" ]
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    52
then
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    53
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    54
  exit 1
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    55
fi
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    56
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    57
JAVA="${TESTJAVA}"/bin/java
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    58
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    59
"${JAVA}" ${TESTVMOPTS} -Dtest.classes="${TESTCLASSES}" \
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    60
    -javaagent:retransformAgent.jar \
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    61
    -classpath "${TESTCLASSES}" \
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    62
    VerifyLocalVariableTableOnRetransformTest \
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    63
    VerifyLocalVariableTableOnRetransformTest \
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    64
    > output.log 2>&1
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    65
cat output.log
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    66
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    67
MESG="did not match .class file"
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    68
grep "$MESG" output.log
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    69
result=$?
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    70
if [ "$result" = 0 ]; then
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    71
    echo "FAIL: found '$MESG' in the test output"
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    72
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    73
    echo "INFO: 'javap -v' comparison between the .class files:"
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    74
    ${JAVA}p -v -classpath "${TESTCLASSES}" DummyClassWithLVT > orig.javap
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    75
    ${JAVA}p -v DummyClassWithLVT > mismatched.javap
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    76
    diff orig.javap mismatched.javap
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    77
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    78
    result=1
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    79
else
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    80
    echo "PASS: did NOT find '$MESG' in the test output"
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    81
    result=0
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    82
fi
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    83
850377563282 7191322: add test for 7064927 to java.lang.instrument
dcubed
parents:
diff changeset
    84
exit $result