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

TOMOYO Linux Cross Reference
Linux/tools/perf/tests/shell/pipe_test.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 ] ~

  1 #!/bin/bash
  2 # perf pipe recording and injection test
  3 # SPDX-License-Identifier: GPL-2.0
  4 
  5 shelldir=$(dirname "$0")
  6 # shellcheck source=lib/perf_has_symbol.sh
  7 . "${shelldir}"/lib/perf_has_symbol.sh
  8 
  9 sym="noploop"
 10 
 11 skip_test_missing_symbol ${sym}
 12 
 13 data=$(mktemp /tmp/perf.data.XXXXXX)
 14 data2=$(mktemp /tmp/perf.data2.XXXXXX)
 15 prog="perf test -w noploop"
 16 err=0
 17 
 18 set -e
 19 
 20 cleanup() {
 21   rm -rf "${data}"
 22   rm -rf "${data}".old
 23   rm -rf "${data2}"
 24   rm -rf "${data2}".old
 25 
 26   trap - EXIT TERM INT
 27 }
 28 
 29 trap_cleanup() {
 30   echo "Unexpected signal in ${FUNCNAME[1]}"
 31   cleanup
 32   exit 1
 33 }
 34 trap trap_cleanup EXIT TERM INT
 35 
 36 test_record_report() {
 37   echo
 38   echo "Record+report pipe test"
 39 
 40   task="perf"
 41   if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep -q ${task}
 42   then
 43     echo "Record+report pipe test [Failed - cannot find the test file in the perf report #1]"
 44     err=1
 45     return
 46   fi
 47 
 48   if ! perf record -g -e task-clock:u -o - ${prog} | perf report -i - --task | grep -q ${task}
 49   then
 50     echo "Record+report pipe test [Failed - cannot find the test file in the perf report #2]"
 51     err=1
 52     return
 53   fi
 54 
 55   perf record -g -e task-clock:u -o - ${prog} > ${data}
 56   if ! perf report -i ${data} --task | grep -q ${task}
 57   then
 58     echo "Record+report pipe test [Failed - cannot find the test file in the perf report #3]"
 59     err=1
 60     return
 61   fi
 62 
 63   echo "Record+report pipe test [Success]"
 64 }
 65 
 66 test_inject_bids() {
 67   inject_opt=$1
 68 
 69   echo
 70   echo "Inject ${inject_opt} build-ids test"
 71 
 72   if ! perf record -e task-clock:u -o - ${prog} | perf inject ${inject_opt}| perf report -i - | grep -q ${sym}
 73   then
 74     echo "Inject build-ids test [Failed - cannot find noploop function in pipe #1]"
 75     err=1
 76     return
 77   fi
 78 
 79   if ! perf record -g -e task-clock:u -o - ${prog} | perf inject ${inject_opt} | perf report -i - | grep -q ${sym}
 80   then
 81     echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #2]"
 82     err=1
 83     return
 84   fi
 85 
 86   perf record -e task-clock:u -o - ${prog} | perf inject ${inject_opt} -o ${data}
 87   if ! perf report -i ${data} | grep -q ${sym}; then
 88     echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #3]"
 89     err=1
 90     return
 91   fi
 92 
 93   perf record -e task-clock:u -o ${data} ${prog}
 94   if ! perf inject ${inject_opt} -i ${data} | perf report -i - | grep -q ${sym}; then
 95     echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #4]"
 96     err=1
 97     return
 98   fi
 99 
100   perf record -e task-clock:u -o - ${prog} > ${data}
101   if ! perf inject ${inject_opt} -i ${data} | perf report -i - | grep -q ${sym}; then
102     echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #5]"
103     err=1
104     return
105   fi
106 
107   perf record -e task-clock:u -o - ${prog} > ${data}
108   perf inject ${inject_opt} -i ${data} -o ${data2}
109   if ! perf report -i ${data2} | grep -q ${sym}; then
110     echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #6]"
111     err=1
112     return
113   fi
114 
115   echo "Inject ${inject_opt} build-ids test [Success]"
116 }
117 
118 test_record_report
119 test_inject_bids -B
120 test_inject_bids -b
121 test_inject_bids --buildid-all
122 test_inject_bids --mmap2-buildid-all
123 
124 cleanup
125 exit $err
126 

~ [ 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