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