Basic.sh 2.8 KB
Newer Older
D
duke 已提交
1 2 3
#!/bin/sh

#
4
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
21 22 23
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
D
duke 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37
#


# @test
# @bug 6402766
# @summary Unit test for jinfo utility
#
# @library ../common
# @build SimpleApplication ShutdownSimpleApplication
# @run shell Basic.sh

. ${TESTSRC}/../common/CommonSetup.sh
. ${TESTSRC}/../common/ApplicationSetup.sh

38
# Start application and use PORTFILE for coordination
D
duke 已提交
39
PORTFILE="${TESTCLASSES}"/shutdown.port
40 41 42 43
startApplication SimpleApplication "${PORTFILE}"

# all return statuses are checked in this test
set +e
D
duke 已提交
44 45 46

failed=0

47 48 49 50 51 52 53 54 55 56 57 58 59
runSA=true

if [ $isLinux = true ]; then
    # Some Linux systems disable non-child ptrace (see 7050524)
    ptrace_scope=`/sbin/sysctl -n kernel.yama.ptrace_scope`
    if [ $? = 0 ]; then
        if [ $ptrace_scope = 1 ]; then
            runSA=false
        fi
    fi
fi

if [ $runSA = true ]; then
D
duke 已提交
60
    # -sysprops option
61
    ${JINFO} -J-XX:+UsePerfData -sysprops $appJavaPid
D
duke 已提交
62 63 64
    if [ $? != 0 ]; then failed=1; fi

    # -flags option
65
    ${JINFO} -J-XX:+UsePerfData -flags $appJavaPid
D
duke 已提交
66 67 68
    if [ $? != 0 ]; then failed=1; fi

    # no option
69
    ${JINFO} -J-XX:+UsePerfData $appJavaPid
D
duke 已提交
70 71 72 73 74 75
    if [ $? != 0 ]; then failed=1; fi

fi


# -flag option
76
${JINFO} -J-XX:+UsePerfData -flag +PrintGC $appJavaPid
D
duke 已提交
77 78
if [ $? != 0 ]; then failed=1; fi 

79
${JINFO} -J-XX:+UsePerfData -flag -PrintGC $appJavaPid
D
duke 已提交
80 81
if [ $? != 0 ]; then failed=1; fi

82
${JINFO} -J-XX:+UsePerfData -flag PrintGC $appJavaPid
D
duke 已提交
83 84
if [ $? != 0 ]; then failed=1; fi

85
if $isSolaris; then
D
duke 已提交
86

87
    ${JINFO} -J-XX:+UsePerfData -flag +ExtendedDTraceProbes $appJavaPid
D
duke 已提交
88 89
    if [ $? != 0 ]; then failed=1; fi

90
    ${JINFO} -J-XX:+UsePerfData -flag -ExtendedDTraceProbes $appJavaPid
D
duke 已提交
91 92
    if [ $? != 0 ]; then failed=1; fi

93
    ${JINFO} -J-XX:+UsePerfData -flag ExtendedDTraceProbes $appJavaPid
D
duke 已提交
94 95 96 97
    if [ $? != 0 ]; then failed=1; fi

fi

98
set -e
D
duke 已提交
99

100 101
stopApplication "${PORTFILE}"
waitForApplication
D
duke 已提交
102

103
exit $failed