[PATCH 3/6] perf test: Test record with --threads option

From: Namhyung Kim
Date: Wed Sep 07 2022 - 02:47:12 EST


To verify per-thread mode is working with multi-thread recording.
Use two software events for testing to check event set-output handling.
Also update the cleanup routine because threads recording produces data
in a directory.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/tests/shell/record.sh | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index cea3c7b7e2cd..3331fb092654 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -11,8 +11,8 @@ testsym="test_loop"
testopt="-D 3"

cleanup() {
- rm -f ${perfdata}
- rm -f ${perfdata}.old
+ rm -rf ${perfdata}
+ rm -rf ${perfdata}.old

if [ "${testprog}" != "true" ]; then
rm -f ${testprog}
@@ -90,6 +90,19 @@ test_per_thread() {
err=1
return
fi
+ if ! perf record -e cpu-clock,cs --per-thread --threads=core ${testopt} \
+ -o ${perfdata} ${testprog} 2> /dev/null
+ then
+ echo "Per-thread record with --threads [Failed]"
+ err=1
+ return
+ fi
+ if ! perf report -i ${perfdata} -q | egrep -q ${testsym}
+ then
+ echo "Per-thread record with --threads [Failed missing output]"
+ err=1
+ return
+ fi
echo "Basic --per-thread mode test [Success]"
}

--
2.37.2.789.g6183377224-goog