diff options
| author | Dmitrii Dolgov <9erthalion6@gmail.com> | 2026-02-08 13:22:26 +0100 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-02-08 19:16:28 -0300 |
| commit | 335047109d7d488bf5ad32a4076e1a011994cd0e (patch) | |
| tree | 5c71203186d3114aef382da40b5ff069fbd107af /tools/perf/tests/shell | |
| parent | f60a5c22967b845d5319d4f447cb28190021795c (diff) | |
perf tests: Test annotate with data type profiling and C
Exercise the annotate command with data type profiling feature with C.
For that extend the existing data type profiling shell test to profile
the datasym workload, then annotate the result expecting to see some
data structures from the C code.
Committer testing:
root@number:~# perf test 'perf data type profiling tests'
83: perf data type profiling tests : Ok
root@number:~# perf test -vv 'perf data type profiling tests'
83: perf data type profiling tests:
--- start ---
test child forked, pid 125028
Basic Rust perf annotate test
Basic annotate test [Success]
Pipe Rust perf annotate test
Pipe annotate test [Success]
Basic C perf annotate test
Basic annotate test [Success]
Pipe C perf annotate test
Pipe annotate test [Success]
---- end(0) ----
83: perf data type profiling tests : Ok
root@number:~#
Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/shell')
| -rwxr-xr-x | tools/perf/tests/shell/data_type_profiling.sh | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/tools/perf/tests/shell/data_type_profiling.sh b/tools/perf/tests/shell/data_type_profiling.sh index cdc9adb7d708..a230f5d4c42c 100755 --- a/tools/perf/tests/shell/data_type_profiling.sh +++ b/tools/perf/tests/shell/data_type_profiling.sh @@ -6,12 +6,14 @@ set -e # The logic below follows the same line as the annotate test, but looks for a # data type profiling manifestation -testtype="# data-type: struct Buf" + +# Values in testtypes and testprogs should match +testtypes=("# data-type: struct Buf" "# data-type: struct _buf") +testprogs=("perf test -w code_with_type" "perf test -w datasym") err=0 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX) -testprog="perf test -w code_with_type" cleanup() { rm -rf "${perfdata}" "${perfout}" @@ -29,12 +31,23 @@ trap trap_cleanup EXIT TERM INT test_basic_annotate() { mode=$1 - echo "${mode} perf annotate test" + runtime=$2 + + echo "${mode} ${runtime} perf annotate test" + + case "x${runtime}" in + "xRust") + index=0 ;; + + "xC") + index=1 ;; + esac + if [ "x${mode}" == "xBasic" ] then - perf mem record -o "${perfdata}" ${testprog} 2> /dev/null + perf mem record -o "${perfdata}" ${testprogs[$index]} 2> /dev/null else - perf mem record -o - ${testprog} 2> /dev/null > "${perfdata}" + perf mem record -o - ${testprogs[$index]} 2> /dev/null > "${perfdata}" fi if [ "x$?" != "x0" ] then @@ -52,7 +65,7 @@ test_basic_annotate() { fi # check if it has the target data type - if ! grep -q "${testtype}" "${perfout}" + if ! grep -q "${testtypes[$index]}" "${perfout}" then echo "${mode} annotate [Failed: missing target data type]" cat "${perfout}" @@ -62,8 +75,10 @@ test_basic_annotate() { echo "${mode} annotate test [Success]" } -test_basic_annotate Basic -test_basic_annotate Pipe +test_basic_annotate Basic Rust +test_basic_annotate Pipe Rust +test_basic_annotate Basic C +test_basic_annotate Pipe C cleanup exit $err |
