test/serviceability/7170638/SDTProbesGNULinuxTest.sh

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

     1 # 
     2 #  Copyright (c) 2012, Red Hat, Inc.
     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 # 
    24 # @test SDTProbesGNULinuxTest.sh
    25 # @bug 7170638
    26 # @summary Test SDT probes available on GNU/Linux when DTRACE_ENABLED
    27 # @run shell SDTProbesGNULinuxTest.sh
    29 # This test only matters on GNU/Linux, others trivially PASS.
    30 OS=`uname -s`
    31 case "$OS" in
    32   Linux )
    33     ;;
    34   *)
    35     echo "Not testing on anything but GNU/Linux. PASSED"
    36     exit 0;
    37     ;;
    38 esac
    40 # Where is our java (parent) directory? 
    41 if [ "${TESTJAVA}" = "" ]; then
    42   PARENT=$(dirname $(readlink -f $(which java)))
    43   TESTJAVA=`dirname ${PARENT}`
    44   echo "TESTJAVA directory not set, using " ${TESTJAVA}
    45 fi
    47 # This test only matters when build with DTRACE_ENABLED. 
    48 ${TESTJAVA}/bin/java -XX:+ExtendedDTraceProbes -version
    49 if [ "$?" != "0" ]; then
    50   echo "Not build using DTRACE_ENABLED. PASSED"
    51   exit 0
    52 fi
    54 # Test all available libjvm.so variants
    55 for libjvm in $(find ${TESTJAVA} -name libjvm.so); do
    56   echo "Testing ${libjvm}"
    57   # Check whether the SDT probes are compiled in.
    58   readelf -S ${libjvm} | grep '.note.stapsdt'
    59   if [ "$?" != "0" ]; then
    60     echo "Failed: ${libjvm} doesn't contain SDT probes."
    61     exit 1
    62   fi
    63   # We could iterate over all SDT probes and test them individually
    64   # with readelf -n, but older readelf versions don't understand them.
    65 done
    67 echo "Passed."
    68 exit 0

mercurial