1 #!/bin/sh 2 # 3 # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 # 6 # This code is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 only, as 8 # published by the Free Software Foundation. 9 # 10 # This code is distributed in the hope that it will be useful, but WITHOUT 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 # version 2 for more details (a copy is included in the LICENSE file that 14 # accompanied this code). 15 # 16 # You should have received a copy of the GNU General Public License version 17 # 2 along with this work; if not, write to the Free Software Foundation, 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 # 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # or visit www.oracle.com if you need additional information or have any 22 # questions. 23 # 24 25 26 # @test 27 # @bug 6402766 28 # @summary Unit test for jinfo utility 29 # 30 # @library ../common 31 # @build SimpleApplication ShutdownSimpleApplication 32 # @run shell Basic.sh 33 34 . ${TESTSRC}/../common/CommonSetup.sh 35 . ${TESTSRC}/../common/ApplicationSetup.sh 36 37 # Start application and use PORTFILE for coordination 38 PORTFILE="${TESTCLASSES}"/shutdown.port 39 startApplication SimpleApplication "${PORTFILE}" 40 41 # all return statuses are checked in this test 42 set +e 43 44 failed=0 45 46 runSA=true 47 48 if [ $isMacos = true -o $isAIX = true -o `uname -m` = ppc64 ]; then 49 runSA=false 50 fi 51 52 if [ $isLinux = true ]; then 53 # Some Linux systems disable non-child ptrace (see 7050524) 54 ptrace_scope=`/sbin/sysctl -n kernel.yama.ptrace_scope` 55 if [ $? = 0 ]; then 56 if [ $ptrace_scope = 1 ]; then 57 runSA=false 58 fi 59 fi 60 fi 61 62 if [ $runSA = true ]; then 63 # -sysprops option 64 ${JINFO} -J-XX:+UsePerfData -sysprops $appJavaPid 65 if [ $? != 0 ]; then failed=1; fi 66 67 # -flags option 68 ${JINFO} -J-XX:+UsePerfData -flags $appJavaPid 69 if [ $? != 0 ]; then failed=1; fi 70 71 # no option 72 ${JINFO} -J-XX:+UsePerfData $appJavaPid 73 if [ $? != 0 ]; then failed=1; fi 74 75 fi 76 77 78 # -flag option 79 ${JINFO} -J-XX:+UsePerfData -flag +PrintGC $appJavaPid 80 if [ $? != 0 ]; then failed=1; fi 81 82 ${JINFO} -J-XX:+UsePerfData -flag -PrintGC $appJavaPid 83 if [ $? != 0 ]; then failed=1; fi 84 85 ${JINFO} -J-XX:+UsePerfData -flag PrintGC $appJavaPid 86 if [ $? != 0 ]; then failed=1; fi 87 88 if $isSolaris; then 89 90 ${JINFO} -J-XX:+UsePerfData -flag +ExtendedDTraceProbes $appJavaPid 91 if [ $? != 0 ]; then failed=1; fi 92 93 ${JINFO} -J-XX:+UsePerfData -flag -ExtendedDTraceProbes $appJavaPid 94 if [ $? != 0 ]; then failed=1; fi 95 96 ${JINFO} -J-XX:+UsePerfData -flag ExtendedDTraceProbes $appJavaPid 97 if [ $? != 0 ]; then failed=1; fi 98 99 fi 100 101 set -e 102 103 stopApplication "${PORTFILE}" 104 waitForApplication 105 106 exit $failed