xref: /linux/tools/perf/tests/shell/pipe_test.sh (revision ae22a94997b8a03dcb3c922857c203246711f9d4)
1#!/bin/sh
2# perf pipe recording and injection test
3# SPDX-License-Identifier: GPL-2.0
4
5shelldir=$(dirname "$0")
6# shellcheck source=lib/perf_has_symbol.sh
7. "${shelldir}"/lib/perf_has_symbol.sh
8
9sym="noploop"
10
11skip_test_missing_symbol ${sym}
12
13data=$(mktemp /tmp/perf.data.XXXXXX)
14prog="perf test -w noploop"
15task="perf"
16
17if ! 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
20fi
21
22if ! 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
25fi
26
27perf record -e task-clock:u -o - ${prog} | perf inject -b -o ${data}
28if ! perf report -i ${data} | grep ${sym}; then
29	echo "cannot find noploop function in pipe #2"
30	exit 1
31fi
32
33perf record -e task-clock:u -o ${data} ${prog}
34if ! perf inject -b -i ${data} | perf report -i - | grep ${sym}; then
35	echo "cannot find noploop function in pipe #3"
36	exit 1
37fi
38
39
40rm -f ${data} ${data}.old
41exit 0
42