author | ykantser |
Thu, 07 May 2015 09:11:49 +0200 | |
changeset 30376 | 2ccf2cf7ea48 |
parent 15254 | 3997a6f357cb |
child 33402 | 1156d495a525 |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
||
3 |
# |
|
30376
2ccf2cf7ea48
8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents:
15254
diff
changeset
|
4 |
# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 5 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6 |
# |
|
7 |
# This code is free software; you can redistribute it and/or modify it |
|
8 |
# under the terms of the GNU General Public License version 2 only, as |
|
9 |
# published by the Free Software Foundation. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
5506 | 21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
2 | 24 |
# |
25 |
||
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
26 |
|
2 | 27 |
# @test |
28 |
# @bug 6173575 6388987 |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
29 |
# @summary Unit tests for appendToBootstrapClassLoaderSearch and |
2 | 30 |
# appendToSystemClasLoaderSearch methods. |
31 |
# |
|
30376
2ccf2cf7ea48
8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents:
15254
diff
changeset
|
32 |
# @modules java.instrument |
2 | 33 |
# @build Agent AgentSupport BootSupport BasicTest PrematureLoadTest DynamicTest |
277
9d9c1747de00
6528548: 4/4 NativeMethodPrefixAgent.java times out intermittently in nightly
dcubed
parents:
276
diff
changeset
|
34 |
# @run shell/timeout=240 run_tests.sh |
2 | 35 |
|
36 |
if [ "${TESTSRC}" = "" ] |
|
37 |
then |
|
38 |
echo "TESTSRC not set. Test cannot execute. Failed." |
|
39 |
exit 1 |
|
40 |
fi |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
41 |
|
2 | 42 |
. ${TESTSRC}/CommonSetup.sh |
43 |
||
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
44 |
|
2 | 45 |
# Simple tests |
46 |
||
47 |
echo "Creating jar files for simple tests..." |
|
48 |
||
49 |
cd ${TESTCLASSES} |
|
50 |
||
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
51 |
"$JAR" ${TESTTOOLVMOPTS} -cfm Agent.jar "${TESTSRC}"/manifest.mf Agent.class |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
52 |
"$JAR" ${TESTTOOLVMOPTS} -cf AgentSupport.jar AgentSupport.class |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
53 |
"$JAR" ${TESTTOOLVMOPTS} -cf BootSupport.jar BootSupport.class |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
54 |
"$JAR" ${TESTTOOLVMOPTS} -cf SimpleTests.jar BasicTest.class PrematureLoadTest.class |
2 | 55 |
|
56 |
failures=0 |
|
57 |
||
58 |
go() { |
|
59 |
echo '' |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
60 |
sh -xc "$JAVA ${TESTVMOPTS} -javaagent:Agent.jar -classpath SimpleTests.jar $1 $2 $3" 2>&1 |
2 | 61 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
62 |
} |
|
63 |
||
64 |
go BasicTest |
|
65 |
go PrematureLoadTest |
|
66 |
||
67 |
# Functional tests |
|
68 |
||
69 |
echo '' |
|
70 |
echo "Setup for functional tests..." |
|
71 |
||
72 |
# Create org.tools.Tracer in temp directory so that it's not seen on the |
|
73 |
# system class path |
|
74 |
||
75 |
mkdir tmp |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
76 |
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d tmp "${TESTSRC}"/Tracer.java |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
77 |
(cd tmp; "${JAR}" ${TESTTOOLVMOPTS} cf ../Tracer.jar org/tools/Tracer.class) |
2 | 78 |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
79 |
# InstrumentedApplication is Application+instrmentation - don't copy as |
2 | 80 |
# we don't want the original file permission |
81 |
||
82 |
cat "${TESTSRC}"/InstrumentedApplication.java > ./Application.java |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
83 |
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -classpath Tracer.jar -d . Application.java |
2 | 84 |
mv Application.class InstrumentedApplication.bytes |
85 |
||
86 |
cp "${TESTSRC}"/Application.java . |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
5506
diff
changeset
|
87 |
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . Application.java |
2 | 88 |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
89 |
sh -xc "$JAVA ${TESTVMOPTS} -classpath . -javaagent:Agent.jar DynamicTest" 2>&1 |
2 | 90 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
91 |
||
92 |
# Repeat test with security manager |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
93 |
sh -xc "$JAVA ${TESTVMOPTS} -classpath . -javaagent:Agent.jar -Djava.security.manager DynamicTest" 2>&1 |
2 | 94 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
95 |
||
96 |
# |
|
97 |
# Results |
|
98 |
# |
|
99 |
echo '' |
|
100 |
if [ $failures -gt 0 ]; |
|
101 |
then echo "$failures test(s) failed"; |
|
102 |
else echo "All test(s) passed"; fi |
|
103 |
exit $failures |