1 #
2 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
37 }
38
39 trap 'cleanup' 0 HUP INT QUIT TERM
40
41 JSTATD="${TESTJAVA}/bin/jstatd"
42 JPS="${TESTJAVA}/bin/jps"
43 JSTAT="${TESTJAVA}/bin/jstat"
44
45 HOSTNAME=`uname -n`
46 PORT_1=`freePort`
47 if [ "${PORT_1}" = "0" ] ; then
48 echo "ERROR: No free port"
49 exit 1
50 fi
51 PORT_2=`expr ${PORT_1} '+' 1`
52 SERVERNAME="SecondJstatdServer"
53
54 JSTATD_1_OUT="jstatd_$$_1.out"
55 JSTATD_2_OUT="jstatd_$$_2.out"
56
57 ${JSTATD} -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_1} 2>&1 > ${JSTATD_1_OUT} &
58 JSTATD_1_PID=$!
59
60 echo "first jstatd started as pid ${JSTATD_1_PID} on port ${PORT_1} with default server name"
61 sleep 3
62
63 ${JSTATD} -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_2} -n ${SERVERNAME} 2>&1 > ${JSTATD_2_OUT} &
64 JSTATD_2_PID=$!
65
66 echo "second jstatd started as pid ${JSTATD_2_PID} on port ${PORT_2} with name ${SERVERNAME}"
67 sleep 3
68
69 echo "running: ${JPS} ${HOSTNAME}:${PORT_1}"
70 ${JPS} ${HOSTNAME}:${PORT_1} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
71
72 if [ $? -ne 0 ]
73 then
74 echo "Output of jps differs from expected output. Failed."
75 cleanup
76 exit 1
77 fi
78
79 echo "running: ${JPS} ${HOSTNAME}:${PORT_2}/${SERVERNAME}"
80 ${JPS} ${HOSTNAME}:${PORT_2}/${SERVERNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
81
82 if [ $? -ne 0 ]
83 then
84 echo "Output of jps differs from expected output. Failed."
85 cleanup
86 exit 1
87 fi
88
89 echo "running: ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5"
90 ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
91 RC=$?
92
93 if [ ${RC} -ne 0 ]
94 then
95 echo "jstat output differs from expected output"
96 fi
97
98 echo "running: ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
99 ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
100 RC=$?
101
102 if [ ${RC} -ne 0 ]
103 then
104 echo "jstat output differs from expected output"
105 fi
106
107 if [ -s ${JSTATD_1_OUT} ]
108 then
109 echo "first jstatd generated the following, unexpected output:"
110 RC=1
111 fi
112
113 if [ -s ${JSTATD_2_OUT} ]
114 then
115 echo "second jstatd generated the following, unexpected output:"
116 RC=1
117 fi
118
119 cleanup
|
1 #
2 # Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
37 }
38
39 trap 'cleanup' 0 HUP INT QUIT TERM
40
41 JSTATD="${TESTJAVA}/bin/jstatd"
42 JPS="${TESTJAVA}/bin/jps"
43 JSTAT="${TESTJAVA}/bin/jstat"
44
45 HOSTNAME=`uname -n`
46 PORT_1=`freePort`
47 if [ "${PORT_1}" = "0" ] ; then
48 echo "ERROR: No free port"
49 exit 1
50 fi
51 PORT_2=`expr ${PORT_1} '+' 1`
52 SERVERNAME="SecondJstatdServer"
53
54 JSTATD_1_OUT="jstatd_$$_1.out"
55 JSTATD_2_OUT="jstatd_$$_2.out"
56
57 ${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_1} 2>&1 > ${JSTATD_1_OUT} &
58 JSTATD_1_PID=$!
59
60 echo "first jstatd started as pid ${JSTATD_1_PID} on port ${PORT_1} with default server name"
61 sleep 3
62
63 ${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT_2} -n ${SERVERNAME} 2>&1 > ${JSTATD_2_OUT} &
64 JSTATD_2_PID=$!
65
66 echo "second jstatd started as pid ${JSTATD_2_PID} on port ${PORT_2} with name ${SERVERNAME}"
67 sleep 3
68
69 echo "running: ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_1}"
70 ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_1} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
71
72 if [ $? -ne 0 ]
73 then
74 echo "Output of jps differs from expected output. Failed."
75 cleanup
76 exit 1
77 fi
78
79 echo "running: ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_2}/${SERVERNAME}"
80 ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT_2}/${SERVERNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
81
82 if [ $? -ne 0 ]
83 then
84 echo "Output of jps differs from expected output. Failed."
85 cleanup
86 exit 1
87 fi
88
89 echo "running: ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5"
90 ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
91 RC=$?
92
93 if [ ${RC} -ne 0 ]
94 then
95 echo "jstat output differs from expected output"
96 fi
97
98 echo "running: ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
99 ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
100 RC=$?
101
102 if [ ${RC} -ne 0 ]
103 then
104 echo "jstat output differs from expected output"
105 fi
106
107 if [ -s ${JSTATD_1_OUT} ]
108 then
109 echo "first jstatd generated the following, unexpected output:"
110 RC=1
111 fi
112
113 if [ -s ${JSTATD_2_OUT} ]
114 then
115 echo "second jstatd generated the following, unexpected output:"
116 RC=1
117 fi
118
119 cleanup
|