2 # perf pipe recording and injection test
3 # SPDX-License-Identifier: GPL-2.0
5 shelldir
=$
(dirname "$0")
6 # shellcheck source=lib/perf_has_symbol.sh
7 .
"${shelldir}"/lib
/perf_has_symbol.sh
11 skip_test_missing_symbol
${sym}
13 data
=$
(mktemp
/tmp
/perf.data.XXXXXX
)
14 data2
=$
(mktemp
/tmp
/perf.data2.XXXXXX
)
15 prog
="perf test -w noploop"
16 [ "$(uname -m)" = "s390x" ] && prog
="$prog 3"
31 echo "Unexpected signal in ${FUNCNAME[1]}"
35 trap trap_cleanup EXIT TERM INT
37 test_record_report
() {
39 echo "Record+report pipe test"
42 if ! perf record
-e task-clock
:u
-o - ${prog} | perf report
-i - --task |
grep -q ${task}
44 echo "Record+report pipe test [Failed - cannot find the test file in the perf report #1]"
49 if ! perf record
-g -e task-clock
:u
-o - ${prog} | perf report
-i - --task |
grep -q ${task}
51 echo "Record+report pipe test [Failed - cannot find the test file in the perf report #2]"
56 perf record
-g -e task-clock
:u
-o - ${prog} > ${data}
57 if ! perf report
-i ${data} --task |
grep -q ${task}
59 echo "Record+report pipe test [Failed - cannot find the test file in the perf report #3]"
64 echo "Record+report pipe test [Success]"
71 echo "Inject ${inject_opt} build-ids test"
73 if ! perf record
-e task-clock
:u
-o - ${prog} | perf inject ${inject_opt}| perf report -i - | grep -q ${sym}
75 echo "Inject build-ids test [Failed - cannot find noploop function in pipe #1]"
80 if ! perf record
-g -e task-clock
:u
-o - ${prog} | perf inject ${inject_opt} | perf report -i - | grep -q ${sym}
82 echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #2]"
87 perf record
-e task-clock
:u
-o - ${prog} | perf inject ${inject_opt} -o ${data}
88 if ! perf report
-i ${data} |
grep -q ${sym}; then
89 echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #3]"
94 perf record
-e task-clock
:u
-o ${data} ${prog}
95 if ! perf inject
${inject_opt} -i ${data} | perf report -i - | grep -q ${sym}; then
96 echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #4]"
101 perf record
-e task-clock
:u
-o - ${prog} > ${data}
102 if ! perf inject
${inject_opt} -i ${data} | perf report -i - | grep -q ${sym}; then
103 echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #5]"
108 perf record
-e task-clock
:u
-o - ${prog} > ${data}
109 perf inject
${inject_opt} -i ${data} -o ${data2}
110 if ! perf report
-i ${data2} |
grep -q ${sym}; then
111 echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #6]"
116 echo "Inject ${inject_opt} build-ids test [Success]"
122 test_inject_bids
--buildid-all
123 test_inject_bids
--mmap2-buildid-all