1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/runtime/RedefineTests/test8178870.sh Thu Sep 12 15:15:22 2019 -0400 1.3 @@ -0,0 +1,87 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +# 1.7 +# Copyright (c) 2019, Red Hat, Inc. All rights reserved. 1.8 +# 1.9 +# This code is free software; you can redistribute it and/or modify it 1.10 +# under the terms of the GNU General Public License version 2 only, as 1.11 +# published by the Free Software Foundation. 1.12 +# 1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 +# version 2 for more details (a copy is included in the LICENSE file that 1.17 +# accompanied this code). 1.18 +# 1.19 +# You should have received a copy of the GNU General Public License version 1.20 +# 2 along with this work; if not, write to the Free Software Foundation, 1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 +# 1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 +# or visit www.oracle.com if you need additional information or have any 1.25 +# questions. 1.26 +# 1.27 +# 1.28 + 1.29 +## @test test.sh 1.30 +## @bug 8178870 1.31 +## @summary test instrumentation.retransformClasses 1.32 +## @run shell test.sh 1.33 + 1.34 +if [ "${TESTSRC}" = "" ] 1.35 +then 1.36 + TESTSRC=${PWD} 1.37 + echo "TESTSRC not set. Using "${TESTSRC}" as default" 1.38 +fi 1.39 +echo "TESTSRC=${TESTSRC}" 1.40 +## Adding common setup Variables for running shell tests. 1.41 +. ${TESTSRC}/../../test_env.sh 1.42 + 1.43 +LIB_SRC=${TESTSRC}/../../testlibrary/ 1.44 + 1.45 +# set platform-dependent variables 1.46 +OS=`uname -s` 1.47 +echo "Testing on " $OS 1.48 +case "$OS" in 1.49 + Linux) 1.50 + cc_cmd=`which gcc` 1.51 + if [ "x$cc_cmd" == "x" ]; then 1.52 + echo "WARNING: gcc not found. Cannot execute test." 2>&1 1.53 + exit 0; 1.54 + fi 1.55 + ;; 1.56 + Solaris) 1.57 + cc_cmd=`which cc` 1.58 + if [ "x$cc_cmd" == "x" ]; then 1.59 + echo "WARNING: cc not found. Cannot execute test." 2>&1 1.60 + exit 0; 1.61 + fi 1.62 + ;; 1.63 + *) 1.64 + echo "Test passed. Only on Linux and Solaris" 1.65 + exit 0; 1.66 + ;; 1.67 +esac 1.68 + 1.69 +THIS_DIR=. 1.70 + 1.71 +cp ${TESTSRC}/RedefineDoubleDelete.java ${THIS_DIR} 1.72 +mkdir -p ${THIS_DIR}/classes 1.73 +${TESTJAVA}/bin/javac -sourcepath ${LIB_SRC} -d ${THIS_DIR}/classes ${LIB_SRC}RedefineClassHelper.java 1.74 +${TESTJAVA}/bin/javac -cp .:${THIS_DIR}/classes:${TESTJAVA}/lib/tools.jar -d ${THIS_DIR} RedefineDoubleDelete.java 1.75 + 1.76 +$cc_cmd -fPIC -shared -o ${THIS_DIR}${FS}libRedefineDoubleDelete.so \ 1.77 + -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \ 1.78 + ${TESTSRC}/libRedefineDoubleDelete.c 1.79 + 1.80 +LD_LIBRARY_PATH=${THIS_DIR} 1.81 +echo LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} 1.82 +export LD_LIBRARY_PATH 1.83 + 1.84 +# Install redefineagent.jar 1.85 +${TESTJAVA}/bin${FS}java -cp ${THIS_DIR}/classes RedefineClassHelper 1.86 + 1.87 +echo 1.88 +echo ${TESTJAVA}/bin/java -agentlib:RedefineDoubleDelete RedefineDoubleDelete 1.89 +${TESTJAVA}/bin/java -cp .:${THIS_DIR}${FS}classes -javaagent:redefineagent.jar -agentlib:RedefineDoubleDelete RedefineDoubleDelete 1.90 +