4094N/A#
4094N/A# Copyright (c) 2012, Red Hat, Inc.
4094N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4094N/A#
4094N/A# This code is free software; you can redistribute it and/or modify it
4094N/A# under the terms of the GNU General Public License version 2 only, as
4094N/A# published by the Free Software Foundation.
4094N/A#
4094N/A# This code is distributed in the hope that it will be useful, but WITHOUT
4094N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4094N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4094N/A# version 2 for more details (a copy is included in the LICENSE file that
4094N/A# accompanied this code).
4094N/A#
4094N/A# You should have received a copy of the GNU General Public License version
4094N/A# 2 along with this work; if not, write to the Free Software Foundation,
4094N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4094N/A#
4094N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4094N/A# or visit www.oracle.com if you need additional information or have any
4094N/A# questions.
4094N/A#
4094N/A
4094N/A# @test SDTProbesGNULinuxTest.sh
4094N/A# @bug 7170638
4094N/A# @summary Test SDT probes available on GNU/Linux when DTRACE_ENABLED
4094N/A# @run shell SDTProbesGNULinuxTest.sh
4094N/A
4094N/A# This test only matters on GNU/Linux, others trivially PASS.
4094N/AOS=`uname -s`
4094N/Acase "$OS" in
4094N/A Linux )
4094N/A ;;
4094N/A *)
4094N/A echo "Not testing on anything but GNU/Linux. PASSED"
4094N/A exit 0;
4094N/A ;;
4094N/Aesac
4094N/A
4094N/A# Where is our java (parent) directory?
4094N/Aif [ "${TESTJAVA}" = "" ]; then
4094N/A PARENT=$(dirname $(readlink -f $(which java)))
4094N/A TESTJAVA=`dirname ${PARENT}`
4094N/A echo "TESTJAVA directory not set, using " ${TESTJAVA}
4094N/Afi
4094N/A
4094N/A# This test only matters when build with DTRACE_ENABLED.
4094N/A${TESTJAVA}/bin/java -XX:+ExtendedDTraceProbes -version
4094N/Aif [ "$?" != "0" ]; then
4094N/A echo "Not build using DTRACE_ENABLED. PASSED"
4094N/A exit 0
4094N/Afi
4094N/A
4094N/A# Test all available libjvm.so variants
4094N/Afor libjvm in $(find ${TESTJAVA} -name libjvm.so); do
4094N/A echo "Testing ${libjvm}"
4094N/A # Check whether the SDT probes are compiled in.
4094N/A readelf -S ${libjvm} | grep '.note.stapsdt'
4094N/A if [ "$?" != "0" ]; then
4094N/A echo "Failed: ${libjvm} doesn't contain SDT probes."
4094N/A exit 1
4094N/A fi
4094N/A # We could iterate over all SDT probes and test them individually
4094N/A # with readelf -n, but older readelf versions don't understand them.
4094N/Adone
4094N/A
4094N/Aecho "Passed."
4094N/Aexit 0