~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/tests/shell/annotate.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/tests/shell/annotate.sh (Architecture i386) and /tools/perf/tests/shell/annotate.sh (Architecture mips)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # perf annotate basic tests                         2 # perf annotate basic tests
  3 # SPDX-License-Identifier: GPL-2.0                  3 # SPDX-License-Identifier: GPL-2.0
  4                                                     4 
  5 set -e                                              5 set -e
  6                                                     6 
  7 shelldir=$(dirname "$0")                            7 shelldir=$(dirname "$0")
  8                                                     8 
  9 # shellcheck source=lib/perf_has_symbol.sh          9 # shellcheck source=lib/perf_has_symbol.sh
 10 . "${shelldir}"/lib/perf_has_symbol.sh             10 . "${shelldir}"/lib/perf_has_symbol.sh
 11                                                    11 
 12 testsym="noploop"                                  12 testsym="noploop"
 13                                                    13 
 14 skip_test_missing_symbol ${testsym}                14 skip_test_missing_symbol ${testsym}
 15                                                    15 
 16 err=0                                              16 err=0
 17 perfdata=$(mktemp /tmp/__perf_test.perf.data.X     17 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
 18 perfout=$(mktemp /tmp/__perf_test.perf.out.XXX     18 perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
 19 testprog="perf test -w noploop"                    19 testprog="perf test -w noploop"
 20 # disassembly format: "percent : offset: instr     20 # disassembly format: "percent : offset: instruction (operands ...)"
 21 disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*"        21 disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*"
 22                                                    22 
 23 cleanup() {                                        23 cleanup() {
 24   rm -rf "${perfdata}" "${perfout}"                24   rm -rf "${perfdata}" "${perfout}"
 25   rm -rf "${perfdata}".old                         25   rm -rf "${perfdata}".old
 26                                                    26 
 27   trap - EXIT TERM INT                             27   trap - EXIT TERM INT
 28 }                                                  28 }
 29                                                    29 
 30 trap_cleanup() {                                   30 trap_cleanup() {
 31   echo "Unexpected signal in ${FUNCNAME[1]}"       31   echo "Unexpected signal in ${FUNCNAME[1]}"
 32   cleanup                                          32   cleanup
 33   exit 1                                           33   exit 1
 34 }                                                  34 }
 35 trap trap_cleanup EXIT TERM INT                    35 trap trap_cleanup EXIT TERM INT
 36                                                    36 
 37 test_basic() {                                     37 test_basic() {
 38   echo "Basic perf annotate test"                  38   echo "Basic perf annotate test"
 39   if ! perf record -o "${perfdata}" ${testprog     39   if ! perf record -o "${perfdata}" ${testprog} 2> /dev/null
 40   then                                             40   then
 41     echo "Basic annotate [Failed: perf record]     41     echo "Basic annotate [Failed: perf record]"
 42     err=1                                          42     err=1
 43     return                                         43     return
 44   fi                                               44   fi
 45                                                    45 
 46   # Generate the annotated output file             46   # Generate the annotated output file
 47   perf annotate -i "${perfdata}" --stdio 2> /d     47   perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
 48                                                    48 
 49   # check if it has the target symbol              49   # check if it has the target symbol
 50   if ! grep "${testsym}" "${perfout}"              50   if ! grep "${testsym}" "${perfout}"
 51   then                                             51   then
 52     echo "Basic annotate [Failed: missing targ     52     echo "Basic annotate [Failed: missing target symbol]"
 53     err=1                                          53     err=1
 54     return                                         54     return
 55   fi                                               55   fi
 56                                                    56 
 57   # check if it has the disassembly lines          57   # check if it has the disassembly lines
 58   if ! grep "${disasm_regex}" "${perfout}"         58   if ! grep "${disasm_regex}" "${perfout}"
 59   then                                             59   then
 60     echo "Basic annotate [Failed: missing disa     60     echo "Basic annotate [Failed: missing disasm output from default disassembler]"
 61     err=1                                          61     err=1
 62     return                                         62     return
 63   fi                                               63   fi
 64                                                    64 
 65   # check again with a target symbol name          65   # check again with a target symbol name
 66   if ! perf annotate -i "${perfdata}" "${tests     66   if ! perf annotate -i "${perfdata}" "${testsym}" 2> /dev/null | \
 67           grep -m 3 "${disasm_regex}"              67           grep -m 3 "${disasm_regex}"
 68   then                                             68   then
 69     echo "Basic annotate [Failed: missing disa     69     echo "Basic annotate [Failed: missing disasm output when specifying the target symbol]"
 70     err=1                                          70     err=1
 71     return                                         71     return
 72   fi                                               72   fi
 73                                                    73 
 74   # check one more with external objdump tool      74   # check one more with external objdump tool (forced by --objdump option)
 75   if ! perf annotate -i "${perfdata}" --objdum     75   if ! perf annotate -i "${perfdata}" --objdump=objdump 2> /dev/null | \
 76           grep -m 3 "${disasm_regex}"              76           grep -m 3 "${disasm_regex}"
 77   then                                             77   then
 78     echo "Basic annotate [Failed: missing disa     78     echo "Basic annotate [Failed: missing disasm output from non default disassembler (using --objdump)]"
 79     err=1                                          79     err=1
 80     return                                         80     return
 81   fi                                               81   fi
 82   echo "Basic annotate test [Success]"             82   echo "Basic annotate test [Success]"
 83 }                                                  83 }
 84                                                    84 
 85 test_basic                                         85 test_basic
 86                                                    86 
 87 cleanup                                            87 cleanup
 88 exit $err                                          88 exit $err
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php