138N/A#
2362N/A# Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
138N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
138N/A#
138N/A# This code is free software; you can redistribute it and/or modify it
138N/A# under the terms of the GNU General Public License version 2 only, as
138N/A# published by the Free Software Foundation.
138N/A#
138N/A# This code is distributed in the hope that it will be useful, but WITHOUT
138N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
138N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
138N/A# version 2 for more details (a copy is included in the LICENSE file that
138N/A# accompanied this code).
138N/A#
138N/A# You should have received a copy of the GNU General Public License version
138N/A# 2 along with this work; if not, write to the Free Software Foundation,
138N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
138N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
138N/A#
138N/A
138N/A# @test
138N/A# @bug 5003341 4917140 6545149
138N/A# @summary Redefine a class with a native method.
138N/A# @author Daniel D. Daugherty as modified from the test submitted by clovis@par.univie.ac.at
138N/A#
138N/A# @run shell MakeJAR3.sh RedefineClassWithNativeMethodAgent 'Can-Redefine-Classes: true'
138N/A# @run build RedefineClassWithNativeMethodApp
138N/A# @run shell RedefineClassWithNativeMethod.sh
138N/A#
138N/A
138N/Aif [ "${TESTJAVA}" = "" ]
138N/Athen
138N/A echo "TESTJAVA not set. Test cannot execute. Failed."
138N/A exit 1
138N/Afi
138N/A
138N/Aif [ "${TESTSRC}" = "" ]
138N/Athen
138N/A echo "TESTSRC not set. Test cannot execute. Failed."
138N/A exit 1
138N/Afi
138N/A
138N/Aif [ "${TESTCLASSES}" = "" ]
138N/Athen
138N/A echo "TESTCLASSES not set. Test cannot execute. Failed."
138N/A exit 1
138N/Afi
138N/A
138N/AJAVAC="${TESTJAVA}"/bin/javac
138N/AJAVA="${TESTJAVA}"/bin/java
138N/A
138N/A"${JAVA}" ${TESTVMOPTS} \
138N/A -javaagent:RedefineClassWithNativeMethodAgent.jar=java/lang/Thread.class \
138N/A -classpath "${TESTCLASSES}" RedefineClassWithNativeMethodApp \
138N/A > output.log 2>&1
138N/Aresult=$?
138N/A
138N/Acat output.log
138N/A
138N/Aif [ "$result" = 0 ]; then
138N/A echo "PASS: RedefineClassWithNativeMethodApp exited with status of 0."
138N/Aelse
138N/A echo "FAIL: RedefineClassWithNativeMethodApp exited with status of $result"
138N/A exit "$result"
138N/Afi
138N/A
138N/AMESG="Exception"
138N/Agrep "$MESG" output.log
138N/Aresult=$?
138N/Aif [ "$result" = 0 ]; then
138N/A echo "FAIL: found '$MESG' in the test output"
138N/A result=1
138N/Aelse
138N/A echo "PASS: did NOT find '$MESG' in the test output"
138N/A result=0
138N/Afi
138N/A
138N/Aexit $result