test/runtime/8233197/Test8233197.sh

changeset 9925
30fb8c8cceb9
equal deleted inserted replaced
9924:89fb452b3688 9925:30fb8c8cceb9
1 #!/bin/sh
2
3 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # This code is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License version 2 only, as
8 # published by the Free Software Foundation.
9 #
10 # This code is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # version 2 for more details (a copy is included in the LICENSE file that
14 # accompanied this code).
15 #
16 # You should have received a copy of the GNU General Public License version
17 # 2 along with this work; if not, write to the Free Software Foundation,
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 #
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 # or visit www.oracle.com if you need additional information or have any
22 # questions.
23
24 ##
25 ## @test Test8233197.sh
26 ## @bug 8233197
27 ## @summary Check that JFR subsystem can be initialized from VMStart JVMTI event
28 ## @compile T.java
29 ## @run shell Test8233197.sh
30 ##
31
32 set -x
33 if [ "${TESTSRC}" = "" ]
34 then
35 TESTSRC=${PWD}
36 echo "TESTSRC not set. Using "${TESTSRC}" as default"
37 fi
38 echo "TESTSRC=${TESTSRC}"
39 ## Adding common setup Variables for running shell tests.
40 . ${TESTSRC}/../../test_env.sh
41
42 # set platform-dependent variables
43 OS=`uname -s`
44 case "$OS" in
45 Linux)
46 gcc_cmd=`which gcc`
47 if [ "x$gcc_cmd" == "x" ]; then
48 echo "WARNING: gcc not found. Cannot execute test." 2>&1
49 exit 0;
50 fi
51 NULL=/dev/null
52 PS=":"
53 FS="/"
54 ;;
55 * )
56 echo "Test passed; only valid for Linux"
57 exit 0;
58 ;;
59 esac
60
61 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1
62
63 # Bitness:
64 # Cannot simply look at TESTVMOPTS as -d64 is not
65 # passed if there is only a 64-bit JVM available.
66
67 grep "64-Bit" vm_version.out > ${NULL}
68 if [ "$?" = "0" ]
69 then
70 COMP_FLAG="-m64"
71 else
72 COMP_FLAG="-m32"
73 fi
74
75
76 # Architecture:
77 # Translate uname output to JVM directory name, but permit testing
78 # 32-bit x86 on an x64 platform.
79 ARCH=`uname -m`
80 case "$ARCH" in
81 x86_64)
82 if [ "$COMP_FLAG" = "-m32" ]; then
83 ARCH=i386
84 else
85 ARCH=amd64
86 fi
87 ;;
88 ppc64)
89 if [ "$COMP_FLAG" = "-m32" ]; then
90 ARCH=ppc
91 else
92 ARCH=ppc64
93 fi
94 ;;
95 sparc64)
96 if [ "$COMP_FLAG" = "-m32" ]; then
97 ARCH=sparc
98 else
99 ARCH=sparc64
100 fi
101 ;;
102 arm*)
103 # 32-bit ARM machine: compiler may not recognise -m32
104 COMP_FLAG=""
105 ARCH=arm
106 ;;
107 aarch64)
108 # 64-bit arm machine, could be testing 32 or 64-bit:
109 if [ "$COMP_FLAG" = "-m32" ]; then
110 ARCH=arm
111 else
112 ARCH=aarch64
113 fi
114 ;;
115 i586)
116 ARCH=i386
117 ;;
118 i686)
119 ARCH=i386
120 ;;
121 # Assuming other ARCH values need no translation
122 esac
123
124
125 # VM type: need to know server or client
126 VMTYPE=client
127 grep Server vm_version.out > ${NULL}
128 if [ "$?" = "0" ]
129 then
130 VMTYPE=server
131 fi
132
133
134 LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE}:/usr/lib:$LD_LIBRARY_PATH
135 export LD_LIBRARY_PATH
136
137 cp ${TESTSRC}${FS}libJvmtiAgent.c .
138
139 # Copy the result of our @compile action:
140 cp ${TESTCLASSES}${FS}T.class .
141
142 echo "Architecture: ${ARCH}"
143 echo "Compilation flag: ${COMP_FLAG}"
144 echo "VM type: ${VMTYPE}"
145
146 $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 \
147 -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
148 -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
149 libJvmtiAgent.c
150 $gcc_cmd -shared -o libJvmtiAgent.so libJvmtiAgent.o
151
152 "$TESTJAVA/bin/java" $TESTVMOPTS -agentlib:JvmtiAgent -cp $(pwd) T > T.out
153 exit $?

mercurial