Linux 6.9-rc1
[linux-2.6-microblaze.git] / tools / perf / tests / shell / pipe_test.sh
1 #!/bin/sh
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 prog="perf test -w noploop"
15 task="perf"
16
17 if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep ${task}; then
18         echo "cannot find the test file in the perf report"
19         exit 1
20 fi
21
22 if ! perf record -e task-clock:u -o - ${prog} | perf inject -b | perf report -i - | grep ${sym}; then
23         echo "cannot find noploop function in pipe #1"
24         exit 1
25 fi
26
27 perf record -e task-clock:u -o - ${prog} | perf inject -b -o ${data}
28 if ! perf report -i ${data} | grep ${sym}; then
29         echo "cannot find noploop function in pipe #2"
30         exit 1
31 fi
32
33 perf record -e task-clock:u -o ${data} ${prog}
34 if ! perf inject -b -i ${data} | perf report -i - | grep ${sym}; then
35         echo "cannot find noploop function in pipe #3"
36         exit 1
37 fi
38
39
40 rm -f ${data} ${data}.old
41 exit 0