[PATCH v1 12/17] perf tests timechart: Exercise the report options

From: Arnaldo Carvalho de Melo

Date: Tue Nov 24 2026 - 13:47:17 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

Run the report with width, process count, topology, highlight,
process, power and tasks only, io and force options.

Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/tests/shell/timechart.sh | 46 +++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

diff --git a/tools/perf/tests/shell/timechart.sh b/tools/perf/tests/shell/timechart.sh
index 40072b32171a9a1c..ec592e304cdedfd8 100755
--- a/tools/perf/tests/shell/timechart.sh
+++ b/tools/perf/tests/shell/timechart.sh
@@ -59,6 +59,33 @@ test_timechart() {
echo "perf timechart ${NAME} test [Success]"
}

+test_timechart_report_option() {
+ NAME=$1
+
+ shift 1
+ echo "perf timechart report ${NAME} test"
+
+ if ! perf timechart -i "${perfdata}" -o "${output}" "$@" > /dev/null 2>&1; then
+ echo "perf timechart report ${NAME} test [Failed: perf timechart command failed]"
+ err=1
+ return
+ fi
+
+ if [ ! -s "${output}" ]; then
+ echo "perf timechart report ${NAME} test [Failed: output file is empty or missing]"
+ err=1
+ return
+ fi
+
+ if ! grep -q "svg" "${output}"; then
+ echo "perf timechart report ${NAME} test [Failed: output doesn't look like SVG]"
+ err=1
+ return
+ fi
+
+ echo "perf timechart report ${NAME} test [Success]"
+}
+
if ! perf check feature -q libtraceevent ; then
echo "perf timechart is not supported. Skip."
cleanup
@@ -69,5 +96,24 @@ test_timechart "Basic" ""
test_timechart "IO-only" "-I"
test_timechart "Backtrace" "-g"

+if [ ! -s "${perfdata}" ]; then
+ echo "perf timechart report options [Skipped: no recorded data]"
+ cleanup
+ exit 0
+fi
+
+# Reuse the data recorded by the last test to exercise the report options.
+test_timechart_report_option "width" -w 1024
+test_timechart_report_option "proc-num" -n 4
+test_timechart_report_option "topology" -t
+test_timechart_report_option "highlight time" --highlight 1
+test_timechart_report_option "highlight name" --highlight true
+test_timechart_report_option "process" -p true
+test_timechart_report_option "power-only" -P
+test_timechart_report_option "tasks-only" -T
+test_timechart_report_option "io options" --io-min-time 1us \
+ --io-merge-dist 1us --io-skip-eagain
+test_timechart_report_option "force" -f
+
cleanup
exit $err
--
2.56.0