test/runtime/8233197/Test8233197.sh

changeset 9925
30fb8c8cceb9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/runtime/8233197/Test8233197.sh	Fri Jun 12 02:59:56 2020 +0100
     1.3 @@ -0,0 +1,153 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     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 +## @test Test8233197.sh
    1.29 +## @bug 8233197
    1.30 +## @summary Check that JFR subsystem can be initialized from VMStart JVMTI event
    1.31 +## @compile T.java
    1.32 +## @run shell Test8233197.sh
    1.33 +##
    1.34 +
    1.35 +set -x
    1.36 +if [ "${TESTSRC}" = "" ]
    1.37 +then
    1.38 +  TESTSRC=${PWD}
    1.39 +  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
    1.40 +fi
    1.41 +echo "TESTSRC=${TESTSRC}"
    1.42 +## Adding common setup Variables for running shell tests.
    1.43 +. ${TESTSRC}/../../test_env.sh
    1.44 +
    1.45 +# set platform-dependent variables
    1.46 +OS=`uname -s`
    1.47 +case "$OS" in
    1.48 +  Linux)
    1.49 +    gcc_cmd=`which gcc`
    1.50 +    if [ "x$gcc_cmd" == "x" ]; then
    1.51 +        echo "WARNING: gcc not found. Cannot execute test." 2>&1
    1.52 +        exit 0;
    1.53 +    fi
    1.54 +    NULL=/dev/null
    1.55 +    PS=":"
    1.56 +    FS="/"
    1.57 +    ;;
    1.58 +  * )
    1.59 +    echo "Test passed; only valid for Linux"
    1.60 +    exit 0;
    1.61 +    ;;
    1.62 +esac
    1.63 +
    1.64 +${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1
    1.65 +
    1.66 +# Bitness:
    1.67 +# Cannot simply look at TESTVMOPTS as -d64 is not
    1.68 +# passed if there is only a 64-bit JVM available.
    1.69 +
    1.70 +grep "64-Bit" vm_version.out > ${NULL}
    1.71 +if [ "$?" = "0" ]
    1.72 +then
    1.73 +  COMP_FLAG="-m64"
    1.74 +else
    1.75 +  COMP_FLAG="-m32"
    1.76 +fi
    1.77 +
    1.78 +
    1.79 +# Architecture:
    1.80 +# Translate uname output to JVM directory name, but permit testing
    1.81 +# 32-bit x86 on an x64 platform.
    1.82 +ARCH=`uname -m`
    1.83 +case "$ARCH" in
    1.84 +  x86_64)
    1.85 +    if [ "$COMP_FLAG" = "-m32" ]; then
    1.86 +      ARCH=i386
    1.87 +    else
    1.88 +      ARCH=amd64
    1.89 +    fi
    1.90 +    ;;
    1.91 +  ppc64)
    1.92 +    if [ "$COMP_FLAG" = "-m32" ]; then
    1.93 +      ARCH=ppc
    1.94 +    else
    1.95 +      ARCH=ppc64
    1.96 +    fi
    1.97 +    ;;
    1.98 +  sparc64)
    1.99 +    if [ "$COMP_FLAG" = "-m32" ]; then
   1.100 +      ARCH=sparc
   1.101 +    else
   1.102 +      ARCH=sparc64
   1.103 +    fi
   1.104 +    ;;
   1.105 +  arm*)
   1.106 +    # 32-bit ARM machine: compiler may not recognise -m32
   1.107 +    COMP_FLAG=""
   1.108 +    ARCH=arm
   1.109 +    ;;
   1.110 +  aarch64)
   1.111 +    # 64-bit arm machine, could be testing 32 or 64-bit:
   1.112 +    if [ "$COMP_FLAG" = "-m32" ]; then
   1.113 +      ARCH=arm
   1.114 +    else
   1.115 +      ARCH=aarch64
   1.116 +    fi
   1.117 +    ;;
   1.118 +  i586)
   1.119 +    ARCH=i386
   1.120 +    ;;
   1.121 +  i686)
   1.122 +    ARCH=i386
   1.123 +    ;;
   1.124 +  # Assuming other ARCH values need no translation
   1.125 +esac
   1.126 +
   1.127 +
   1.128 +# VM type: need to know server or client
   1.129 +VMTYPE=client
   1.130 +grep Server vm_version.out > ${NULL}
   1.131 +if [ "$?" = "0" ]
   1.132 +then
   1.133 +  VMTYPE=server
   1.134 +fi
   1.135 +
   1.136 +
   1.137 +LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE}:/usr/lib:$LD_LIBRARY_PATH
   1.138 +export LD_LIBRARY_PATH
   1.139 +
   1.140 +cp ${TESTSRC}${FS}libJvmtiAgent.c .
   1.141 +
   1.142 +# Copy the result of our @compile action:
   1.143 +cp ${TESTCLASSES}${FS}T.class .
   1.144 +
   1.145 +echo "Architecture: ${ARCH}"
   1.146 +echo "Compilation flag: ${COMP_FLAG}"
   1.147 +echo "VM type: ${VMTYPE}"
   1.148 +
   1.149 +$gcc_cmd -DLINUX ${COMP_FLAG} -Wl, -g -fno-strict-aliasing -fPIC -fno-omit-frame-pointer -W -Wall  -Wno-unused -Wno-parentheses -c -o libJvmtiAgent.o \
   1.150 +    -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
   1.151 +    -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
   1.152 +    libJvmtiAgent.c
   1.153 +$gcc_cmd -shared -o libJvmtiAgent.so libJvmtiAgent.o
   1.154 +
   1.155 +"$TESTJAVA/bin/java" $TESTVMOPTS -agentlib:JvmtiAgent -cp $(pwd) T > T.out
   1.156 +exit $?
   1.157 \ No newline at end of file

mercurial