2
|
1 |
#!/bin/ksh -p
|
|
2 |
|
|
3 |
#
|
|
4 |
# Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
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 |
|
|
26 |
#
|
|
27 |
# @test SuspendNoFlagTest.sh
|
|
28 |
# @bug 4914611
|
|
29 |
# @summary Test for JDWP: -agentlib:jdwp=suspend=n hanging
|
|
30 |
# @author Kelly O'Hair
|
|
31 |
# Based on test/java/awt/TEMPLATE/AutomaticShellTest.sh
|
|
32 |
#
|
|
33 |
# @run compile -g HelloWorld.java
|
|
34 |
# @run shell/timeout=60 SuspendNoFlagTest.sh
|
|
35 |
#
|
|
36 |
|
|
37 |
# Beginning of subroutines:
|
|
38 |
status=1
|
|
39 |
|
|
40 |
#Call this from anywhere to fail the test with an error message
|
|
41 |
# usage: fail "reason why the test failed"
|
|
42 |
fail()
|
|
43 |
{ echo "The test failed :-("
|
|
44 |
echo "$*" 1>&2
|
|
45 |
echo "exit status was $status"
|
|
46 |
exit $status
|
|
47 |
} #end of fail()
|
|
48 |
|
|
49 |
#Call this from anywhere to pass the test with a message
|
|
50 |
# usage: pass "reason why the test passed if applicable"
|
|
51 |
pass()
|
|
52 |
{ echo "The test passed!!!"
|
|
53 |
echo "$*" 1>&2
|
|
54 |
exit 0
|
|
55 |
} #end of pass()
|
|
56 |
|
|
57 |
# end of subroutines
|
|
58 |
|
|
59 |
# The beginning of the script proper
|
|
60 |
|
|
61 |
TARGETCLASS="HelloWorld"
|
|
62 |
if [ -z "${TESTJAVA}" ] ; then
|
|
63 |
# TESTJAVA is not set, so the test is running stand-alone.
|
|
64 |
# TESTJAVA holds the path to the root directory of the build of the JDK
|
|
65 |
# to be tested. That is, any java files run explicitly in this shell
|
|
66 |
# should use TESTJAVA in the path to the java interpreter.
|
|
67 |
# So, we'll set this to the JDK spec'd on the command line. If none
|
|
68 |
# is given on the command line, tell the user that and use a default.
|
|
69 |
# THIS IS THE JDK BEING TESTED.
|
|
70 |
if [ -n "$1" ] ; then
|
|
71 |
TESTJAVA=$1
|
|
72 |
else
|
|
73 |
TESTJAVA=$JAVA_HOME
|
|
74 |
fi
|
|
75 |
TESTSRC=.
|
|
76 |
TESTCLASSES=.
|
|
77 |
#Deal with .class files:
|
|
78 |
${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
|
|
79 |
-classpath "${TESTCLASSES}" -g \
|
|
80 |
${TARGETCLASS}.java
|
|
81 |
fi
|
|
82 |
#
|
|
83 |
echo "JDK under test is: $TESTJAVA"
|
|
84 |
#
|
|
85 |
CP="-classpath \"${TESTCLASSES}\""
|
|
86 |
#
|
|
87 |
DEBUGEEFLAGS=
|
|
88 |
if [ -r $TESTCLASSES/@debuggeeVMOptions ] ; then
|
|
89 |
DEBUGEEFLAGS=`cat $TESTCLASSES/@debuggeeVMOptions`
|
|
90 |
elif [ -r $TESTCLASSES/../@debuggeeVMOptions ] ; then
|
|
91 |
DEBUGEEFLAGS=`cat $TESTCLASSES/../@debuggeeVMOptions`
|
|
92 |
fi
|
|
93 |
DEBUGEEFLAGS="$DEBUGEEFLAGS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n"
|
|
94 |
|
|
95 |
java=java
|
|
96 |
echo ${TESTJAVA}/bin/$java ${DEBUGEEFLAGS} ${CP} ${TARGETCLASS}
|
|
97 |
eval ${TESTJAVA}/bin/$java ${DEBUGEEFLAGS} ${CP} ${TARGETCLASS}
|
|
98 |
status=$?
|
|
99 |
echo "test status was: $status"
|
|
100 |
if [ $status -eq "0" ] ;
|
|
101 |
then pass "status = 0 and no timeout occured"
|
|
102 |
|
|
103 |
else fail "unspecified test failure (timed out or hung)"
|
|
104 |
fi
|