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