perf sched stats: Add basic 'perf sched stats' test

Add basic test for 'perf sched stats {record|report|diff}' subcommand.

Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Anubhav Shelat <ashelat@redhat.com>
Cc: Ben Gainey <ben.gainey@arm.com>
Cc: Blake Jones <blakejones@google.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: David Vernet <void@manifault.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Gautham Shenoy <gautham.shenoy@amd.com>
Cc: Graham Woodward <graham.woodward@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Santosh Shukla <santosh.shukla@amd.com>
Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Yang Jihong <yangjihong@bytedance.com>
Cc: Yujie Liu <yujie.liu@intel.com>
Cc: Zhongqiu Han <quic_zhonhan@quicinc.com>
Link: https://lore.kernel.org/r/20260119175833.340369-10-swapnil.sapkal@amd.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Swapnil Sapkal
2026-01-19 17:58:31 +00:00
committed by Arnaldo Carvalho de Melo
parent 064790a3d4
commit c6b1f57075

View File

@@ -0,0 +1,64 @@
#!/bin/sh
# perf sched stats tests
# SPDX-License-Identifier: GPL-2.0
set -e
err=0
test_perf_sched_stats_record() {
echo "Basic perf sched stats record test"
if ! perf sched stats record true 2>&1 | \
grep -E -q "[ perf sched stats: Wrote samples to perf.data ]"
then
echo "Basic perf sched stats record test [Failed]"
err=1
return
fi
echo "Basic perf sched stats record test [Success]"
}
test_perf_sched_stats_report() {
echo "Basic perf sched stats report test"
perf sched stats record true > /dev/null
if ! perf sched stats report 2>&1 | grep -E -q "Description"
then
echo "Basic perf sched stats report test [Failed]"
err=1
rm perf.data
return
fi
rm perf.data
echo "Basic perf sched stats report test [Success]"
}
test_perf_sched_stats_live() {
echo "Basic perf sched stats live mode test"
if ! perf sched stats true 2>&1 | grep -E -q "Description"
then
echo "Basic perf sched stats live mode test [Failed]"
err=1
return
fi
echo "Basic perf sched stats live mode test [Success]"
}
test_perf_sched_stats_diff() {
echo "Basic perf sched stats diff test"
perf sched stats record true > /dev/null
perf sched stats record true > /dev/null
if ! perf sched stats diff > /dev/null
then
echo "Basic perf sched stats diff test [Failed]"
err=1
rm perf.data.old perf.data
return
fi
rm perf.data.old perf.data
echo "Basic perf sched stats diff test [Success]"
}
test_perf_sched_stats_record
test_perf_sched_stats_report
test_perf_sched_stats_live
test_perf_sched_stats_diff
exit $err