drm/nouveau: consume the return of large GSP message
[drm/drm-misc.git] / tools / perf / tests / shell / pipe_test.sh
blobe459aa99a9515bc8ff9aae24ca267f3ebc3cd6cb
1 #!/bin/bash
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
9 sym="noploop"
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"
17 err=0
19 set -e
21 cleanup() {
22 rm -rf "${data}"
23 rm -rf "${data}".old
24 rm -rf "${data2}"
25 rm -rf "${data2}".old
27 trap - EXIT TERM INT
30 trap_cleanup() {
31 echo "Unexpected signal in ${FUNCNAME[1]}"
32 cleanup
33 exit 1
35 trap trap_cleanup EXIT TERM INT
37 test_record_report() {
38 echo
39 echo "Record+report pipe test"
41 task="perf"
42 if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep -q ${task}
43 then
44 echo "Record+report pipe test [Failed - cannot find the test file in the perf report #1]"
45 err=1
46 return
49 if ! perf record -g -e task-clock:u -o - ${prog} | perf report -i - --task | grep -q ${task}
50 then
51 echo "Record+report pipe test [Failed - cannot find the test file in the perf report #2]"
52 err=1
53 return
56 perf record -g -e task-clock:u -o - ${prog} > ${data}
57 if ! perf report -i ${data} --task | grep -q ${task}
58 then
59 echo "Record+report pipe test [Failed - cannot find the test file in the perf report #3]"
60 err=1
61 return
64 echo "Record+report pipe test [Success]"
67 test_inject_bids() {
68 inject_opt=$1
70 echo
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}
74 then
75 echo "Inject build-ids test [Failed - cannot find noploop function in pipe #1]"
76 err=1
77 return
80 if ! perf record -g -e task-clock:u -o - ${prog} | perf inject ${inject_opt} | perf report -i - | grep -q ${sym}
81 then
82 echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #2]"
83 err=1
84 return
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]"
90 err=1
91 return
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]"
97 err=1
98 return
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]"
104 err=1
105 return
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]"
112 err=1
113 return
116 echo "Inject ${inject_opt} build-ids test [Success]"
119 test_record_report
120 test_inject_bids -B
121 test_inject_bids -b
122 test_inject_bids --buildid-all
123 test_inject_bids --mmap2-buildid-all
125 cleanup
126 exit $err