author | xdono |
Wed, 02 Jul 2008 12:55:45 -0700 | |
changeset 715 | f16baef3a20e |
parent 277 | 9d9c1747de00 |
child 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
2 | 1 |
#!/bin/sh |
2 |
||
3 |
# |
|
715 | 4 |
# Copyright 2005-2008 Sun Microsystems, Inc. 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 |
# |
|
21 |
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
# CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
# have any questions. |
|
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 |
# |
|
32 |
# @build Agent AgentSupport BootSupport BasicTest PrematureLoadTest DynamicTest |
|
277
9d9c1747de00
6528548: 4/4 NativeMethodPrefixAgent.java times out intermittently in nightly
dcubed
parents:
276
diff
changeset
|
33 |
# @run shell/timeout=240 run_tests.sh |
2 | 34 |
|
35 |
if [ "${TESTSRC}" = "" ] |
|
36 |
then |
|
37 |
echo "TESTSRC not set. Test cannot execute. Failed." |
|
38 |
exit 1 |
|
39 |
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
|
40 |
|
2 | 41 |
. ${TESTSRC}/CommonSetup.sh |
42 |
||
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
43 |
|
2 | 44 |
# Simple tests |
45 |
||
46 |
echo "Creating jar files for simple tests..." |
|
47 |
||
48 |
cd ${TESTCLASSES} |
|
49 |
||
50 |
"$JAR" -cfm Agent.jar "${TESTSRC}"/manifest.mf Agent.class |
|
51 |
"$JAR" -cf AgentSupport.jar AgentSupport.class |
|
52 |
"$JAR" -cf BootSupport.jar BootSupport.class |
|
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
53 |
"$JAR" -cf SimpleTests.jar BasicTest.class PrematureLoadTest.class |
2 | 54 |
|
55 |
failures=0 |
|
56 |
||
57 |
go() { |
|
58 |
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
|
59 |
sh -xc "$JAVA ${TESTVMOPTS} -javaagent:Agent.jar -classpath SimpleTests.jar $1 $2 $3" 2>&1 |
2 | 60 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
61 |
} |
|
62 |
||
63 |
go BasicTest |
|
64 |
go PrematureLoadTest |
|
65 |
||
66 |
# Functional tests |
|
67 |
||
68 |
echo '' |
|
69 |
echo "Setup for functional tests..." |
|
70 |
||
71 |
# Create org.tools.Tracer in temp directory so that it's not seen on the |
|
72 |
# system class path |
|
73 |
||
74 |
mkdir tmp |
|
75 |
"${JAVAC}" -d tmp "${TESTSRC}"/Tracer.java |
|
76 |
(cd tmp; "${JAR}" cf ../Tracer.jar org/tools/Tracer.class) |
|
77 |
||
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
78 |
# InstrumentedApplication is Application+instrmentation - don't copy as |
2 | 79 |
# we don't want the original file permission |
80 |
||
81 |
cat "${TESTSRC}"/InstrumentedApplication.java > ./Application.java |
|
82 |
"${JAVAC}" -classpath Tracer.jar -d . Application.java |
|
83 |
mv Application.class InstrumentedApplication.bytes |
|
84 |
||
85 |
cp "${TESTSRC}"/Application.java . |
|
86 |
"${JAVAC}" -d . Application.java |
|
87 |
||
276
57cf064fc997
6491461: 3/3 TEST: java/lang/instrument .sh tests need to use $TESTVMOPTS in their java commands
dcubed
parents:
2
diff
changeset
|
88 |
sh -xc "$JAVA ${TESTVMOPTS} -classpath . -javaagent:Agent.jar DynamicTest" 2>&1 |
2 | 89 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
90 |
||
91 |
# 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
|
92 |
sh -xc "$JAVA ${TESTVMOPTS} -classpath . -javaagent:Agent.jar -Djava.security.manager DynamicTest" 2>&1 |
2 | 93 |
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi |
94 |
||
95 |
# |
|
96 |
# Results |
|
97 |
# |
|
98 |
echo '' |
|
99 |
if [ $failures -gt 0 ]; |
|
100 |
then echo "$failures test(s) failed"; |
|
101 |
else echo "All test(s) passed"; fi |
|
102 |
exit $failures |