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 #
33
34 cleanup() {
35 kill_proc ${JSTATD_PID}
36 }
37
38 trap 'cleanup' 0 HUP INT QUIT TERM
39
40 JSTATD="${TESTJAVA}/bin/jstatd"
41 JPS="${TESTJAVA}/bin/jps"
42 JSTAT="${TESTJAVA}/bin/jstat"
43
44 HOSTNAME=`uname -n`
45 PORT=`freePort`
46 if [ "${PORT}" = "0" ] ; then
47 echo "Cannot get free port"
48 exit 1
49 fi
50
51 JSTATD_OUT="jstatd_$$.out"
52
53 ${JSTATD} -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT} 2>&1 > ${JSTATD_OUT} &
54 JSTATD_PID=$!
55
56 echo "jstatd started as pid ${JSTATD_PID} on port ${PORT}"
57 sleep 3
58
59 ${JPS} ${HOSTNAME}:${PORT} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk
60
61 if [ $? -ne 0 ]
62 then
63 echo "Output of jps differs from expected output. Failed."
64 cleanup
65 exit 1
66 fi
67
68 ${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
69 RC=$?
70
71 if [ ${RC} -ne 0 ]
72 then
73 echo "jstat output differs from expected output"
74 fi
75
76 if [ -s ${JSTATD_OUT} ]
77 then
78 echo "jstatd generated the following, unexpected output:"
79 RC=1
80 fi
81
82 cleanup
83
84 exit ${RC}
|
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 #
33
34 cleanup() {
35 kill_proc ${JSTATD_PID}
36 }
37
38 trap 'cleanup' 0 HUP INT QUIT TERM
39
40 JSTATD="${TESTJAVA}/bin/jstatd"
41 JPS="${TESTJAVA}/bin/jps"
42 JSTAT="${TESTJAVA}/bin/jstat"
43
44 HOSTNAME=`uname -n`
45 PORT=`freePort`
46 if [ "${PORT}" = "0" ] ; then
47 echo "Cannot get free port"
48 exit 1
49 fi
50
51 JSTATD_OUT="jstatd_$$.out"
52
53 ${JSTATD} -J-XX:+UsePerfData -J-Djava.security.policy=${TESTSRC}/all.policy -p ${PORT} 2>&1 > ${JSTATD_OUT} &
54 JSTATD_PID=$!
55
56 echo "jstatd started as pid ${JSTATD_PID} on port ${PORT}"
57 sleep 3
58
59 ${JPS} -J-XX:+UsePerfData ${HOSTNAME}:${PORT} 2>&1 | tee jps.out | awk -f ${TESTSRC}/jpsOutput1.awk
60
61 if [ $? -ne 0 ]
62 then
63 echo "Output of jps differs from expected output. Failed."
64 cleanup
65 exit 1
66 fi
67
68 ${JSTAT} -J-XX:+UsePerfData -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
69 RC=$?
70
71 if [ ${RC} -ne 0 ]
72 then
73 echo "jstat output differs from expected output"
74 fi
75
76 if [ -s ${JSTATD_OUT} ]
77 then
78 echo "jstatd generated the following, unexpected output:"
79 RC=1
80 fi
81
82 cleanup
83
84 exit ${RC}
|