1#!/bin/sh
2# perf pipe recording and injection test
3# SPDX-License-Identifier: GPL-2.0
4
5data=$(mktemp /tmp/perf.data.XXXXXX)
6prog="perf test -w noploop"
7task="perf"
8sym="noploop"
9
10if ! perf record -e task-clock:u -o - ${prog} | perf report -i - --task | grep ${task}; then
11	echo "cannot find the test file in the perf report"
12	exit 1
13fi
14
15if ! perf record -e task-clock:u -o - ${prog} | perf inject -b | perf report -i - | grep ${sym}; then
16	echo "cannot find noploop function in pipe #1"
17	exit 1
18fi
19
20perf record -e task-clock:u -o - ${prog} | perf inject -b -o ${data}
21if ! perf report -i ${data} | grep ${sym}; then
22	echo "cannot find noploop function in pipe #2"
23	exit 1
24fi
25
26perf record -e task-clock:u -o ${data} ${prog}
27if ! perf inject -b -i ${data} | perf report -i - | grep ${sym}; then
28	echo "cannot find noploop function in pipe #3"
29	exit 1
30fi
31
32
33rm -f ${data} ${data}.old
34exit 0
35