Make a "Setup struct perf_event_attr" a shell test
Ian Rogers
reviewercover Make a "Setup struct perf_event_attr" a shell test
The path detection for "Setup struct perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup struct perf_event_attr" perf test: Remove C test wrapper for attr.py
perf test: Move attr files into shell directory where they are used
tools/perf/Makefile.perf | 5 +-
tools/perf/perf.c | 2 -
tools/perf/tests/Build | 1 -
tools/perf/tests/attr.c | 218 ------------------
tools/perf/tests/builtin-test.c | 1 -
tools/perf/tests/shell/attr.sh | 22 ++
tools/perf/tests/{ => shell}/attr/README | 0
tools/perf/tests/{ => shell}/attr/base-record | 0
.../tests/{ => shell}/attr/base-record-spe | 0
tools/perf/tests/{ => shell}/attr/base-stat | 0
.../tests/{ => shell}/attr/system-wide-dummy | 0
.../tests/{ => shell}/attr/test-record-C0 | 0
.../tests/{ => shell}/attr/test-record-basic | 0
.../{ => shell}/attr/test-record-branch-any | 0
.../attr/test-record-branch-filter-any | 0
.../attr/test-record-branch-filter-any_call | 0
.../attr/test-record-branch-filter-any_ret | 0
.../attr/test-record-branch-filter-hv | 0
.../attr/test-record-branch-filter-ind_call | 0
.../attr/test-record-branch-filter-k | 0
.../attr/test-record-branch-filter-u | 0
.../tests/{ => shell}/attr/test-record-count | 0
.../tests/{ => shell}/attr/test-record-data | 0
.../{ => shell}/attr/test-record-dummy-C0 | 0
.../tests/{ => shell}/attr/test-record-freq | 0
.../attr/test-record-graph-default | 0
.../attr/test-record-graph-default-aarch64 | 0
.../{ => shell}/attr/test-record-graph-dwarf | 0
.../{ => shell}/attr/test-record-graph-fp | 0
.../attr/test-record-graph-fp-aarch64 | 0
.../attr/test-record-group-sampling | 0
.../tests/{ => shell}/attr/test-record-group1 | 0
.../tests/{ => shell}/attr/test-record-group2 | 0
.../{ => shell}/attr/test-record-no-buffering | 0
.../{ => shell}/attr/test-record-no-inherit | 0
.../{ => shell}/attr/test-record-no-samples | 0
.../tests/{ => shell}/attr/test-record-period | 0
.../{ => shell}/attr/test-record-pfm-period | 0
.../tests/{ => shell}/attr/test-record-raw | 0
.../{ => shell}/attr/test-record-spe-period | 0
.../attr/test-record-spe-period-term | 0
.../attr/test-record-spe-physical-address | 0
.../attr/test-record-user-regs-no-sve-aarch64 | 0
.../test-record-user-regs-old-sve-aarch64 | 0
.../attr/test-record-user-regs-sve-aarch64 | 0
.../perf/tests/{ => shell}/attr/test-stat-C0 | 0
.../tests/{ => shell}/attr/test-stat-basic | 0
.../tests/{ => shell}/attr/test-stat-default | 0
.../{ => shell}/attr/test-stat-detailed-1 | 0
.../{ => shell}/attr/test-stat-detailed-2 | 0
.../{ => shell}/attr/test-stat-detailed-3 | 0
.../tests/{ => shell}/attr/test-stat-group1 | 0
.../{ => shell}/attr/test-stat-no-inherit | 0
tools/perf/tests/{ => shell/lib}/attr.py | 0
tools/perf/tests/tests.h | 1 -
tools/perf/util/evsel.c | 122 +++++++++-
tools/perf/util/util.h | 7 -
57 files changed, 142 insertions(+), 237 deletions(-)
delete mode 100644 tools/perf/tests/attr.c
create mode 100755 tools/perf/tests/shell/attr.sh
rename tools/perf/tests/{ => shell}/attr/README (100%)
rename tools/perf/tests/{ => shell}/attr/base-record (100%)
rename tools/perf/tests/{ => shell}/attr/base-record-spe (100%)
rename tools/perf/tests/{ => shell}/attr/base-stat (100%)
rename tools/perf/tests/{ => shell}/attr/system-wide-dummy (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-C0 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-basic (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-any (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_call (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_ret (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-hv (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-ind_call (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-k (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-u (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-count (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-data (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-freq (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-default (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-default-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-group1 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-group2 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-no-buffering (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-no-inherit (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-no-samples (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-period (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-pfm-period (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-raw (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-spe-period (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-spe-period-term (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-spe-physical-address (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-no-sve-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-old-sve-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-C0 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-basic (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-default (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-group1 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-no-inherit (100%)
rename tools/perf/tests/{ => shell/lib}/attr.py (100%)Signature · 1 line
2.46.1.824.gd892dcdcdd-goog
Ian Rogers
reviewerPATCH 1/3 perf test: Add a shell wrapper for "Setup struct perf_event_attr"
The "Setup struct perf_event_attr" test in attr.c does a bunch of directory finding to set up running a python test that in general is more brittle than similar logic we have in shell tests. Add a shell test that invokes and runs the tests in the python attr.py script.
--- tools/perf/tests/shell/attr.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/perf/tests/shell/attr.sh
tools/perf/tests/shell/attr.sh new file +22 -0
@@ -0,0 +1,22 @@ +#!/bin/bash +# Perf attribute expectations test +# SPDX-License-Identifier: GPL-2.0 + +err=0 + +cleanup() { + trap - EXIT TERM INT +} + +trap_cleanup() { + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + +shelldir=$(dirname "$0") +perf_path=$(which perf) +python "${shelldir}"/../attr.py -d "${shelldir}"/../attr -v -p "$perf_path" +cleanup +exit $err
Signature · 1 line
2.46.1.824.gd892dcdcdd-goog
Ian Rogers
reviewerPATCH 2/3 perf test: Remove C test wrapper for attr.py
In reply to Ian RogersRemove the C wrapper now a shell script wrapper exists. Move perf_event_attr dumping functions to evsel.c and reduce the scope of variables/defines. Use fprintf to avoid snprintf complexities in WRITE_ASS.
--- tools/perf/perf.c | 2 - tools/perf/tests/Build | 1 - tools/perf/tests/attr.c | 218 -------------------------------- tools/perf/tests/builtin-test.c | 1 - tools/perf/tests/tests.h | 1 - tools/perf/util/evsel.c | 122 +++++++++++++++++- tools/perf/util/util.h | 7 - 7 files changed, 118 insertions(+), 234 deletions(-) delete mode 100644 tools/perf/tests/attr.c
tools/perf/perf.c +0 -2
@@ -542,8 +542,6 @@ int main(int argc, const char **argv) } cmd = argv[0 ]; -test_attr__init (); -/* * We use PATH to find perf commands, but we prepend some higher * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH
tools/perf/tests/Build +0 -1
@@ -4,7 +4,6 @@ perf-test-y += builtin-test.o perf-test-y += tests-scripts.o perf-test-y += parse-events.o perf-test-y += dso-data.o -perf-test-y += attr.o perf-test-y += vmlinux-kallsyms.o perf-test-$(CONFIG_LIBTRACEEVENT) += openat-syscall.o perf-test-$(CONFIG_LIBTRACEEVENT) += openat-syscall-all-cpus.o
tools/perf/tests/attr.c deleted +0 -218
218 lines not on this page · raw message
tools/perf/tests/builtin-test.c +0 -1
@@ -79,7 +79,6 @@ static struct test_suite *generic_tests[] = { &suite__perf_evsel__tp_sched_test, &suite__syscall_openat_tp_fields, #endif - &suite__attr, &suite__hists_link, &suite__python_use, &suite__bp_signal,
tools/perf/tests/tests.h +0 -1
@@ -83,7 +83,6 @@ DECLARE_SUITE(perf_evsel__tp_sched_test);DECLARE_SUITE (syscall_openat_tp_fields);DECLARE_SUITE (pmu);DECLARE_SUITE (pmu_events); -DECLARE_SUITE (attr);DECLARE_SUITE (dso_data);DECLARE_SUITE (dso_data_cache);DECLARE_SUITE (dso_data_reopen);
tools/perf/util/evsel.c +118 -4
140 lines not on this page · raw message
tools/perf/util/util.h +0 -7
@@ -81,13 +81,6 @@ char *perf_exe(char *buf, int len);#endif #endif -extern bool test_attr__enabled; -void test_attr__ready (void ); -void test_attr__init (void ); -struct perf_event_attr ; -void test_attr__open (struct perf_event_attr *attr,pid_t pid,struct perf_cpu cpu, -int fd,int group_fd,unsigned long flags); -struct perf_debuginfod {const char *urls;bool set;
Signature · 1 line
2.46.1.824.gd892dcdcdd-goog
Ian Rogers
reviewerPATCH 3/3 perf test: Move attr files into shell directory where they are used
In reply to Ian RogersNow the attr tests are shell tests move the associated python and configuration files. Update the installation build rules for the new directories. Recycle the lib install rules for python files allowing the explicit attr.py install line to be dropped.
---
tools/perf/Makefile.perf | 5 ++---
tools/perf/tests/shell/attr.sh | 2 +-
tools/perf/tests/{ => shell}/attr/README | 0
tools/perf/tests/{ => shell}/attr/base-record | 0
tools/perf/tests/{ => shell}/attr/base-record-spe | 0
tools/perf/tests/{ => shell}/attr/base-stat | 0
tools/perf/tests/{ => shell}/attr/system-wide-dummy | 0
tools/perf/tests/{ => shell}/attr/test-record-C0 | 0
tools/perf/tests/{ => shell}/attr/test-record-basic | 0
tools/perf/tests/{ => shell}/attr/test-record-branch-any | 0
.../tests/{ => shell}/attr/test-record-branch-filter-any | 0
.../{ => shell}/attr/test-record-branch-filter-any_call | 0
.../tests/{ => shell}/attr/test-record-branch-filter-any_ret | 0
.../perf/tests/{ => shell}/attr/test-record-branch-filter-hv | 0
.../{ => shell}/attr/test-record-branch-filter-ind_call | 0
.../perf/tests/{ => shell}/attr/test-record-branch-filter-k | 0
.../perf/tests/{ => shell}/attr/test-record-branch-filter-u | 0
tools/perf/tests/{ => shell}/attr/test-record-count | 0
tools/perf/tests/{ => shell}/attr/test-record-data | 0
tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 | 0
tools/perf/tests/{ => shell}/attr/test-record-freq | 0
tools/perf/tests/{ => shell}/attr/test-record-graph-default | 0
.../tests/{ => shell}/attr/test-record-graph-default-aarch64 | 0
tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf | 0
tools/perf/tests/{ => shell}/attr/test-record-graph-fp | 0
.../perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 | 0
tools/perf/tests/{ => shell}/attr/test-record-group-sampling | 0
tools/perf/tests/{ => shell}/attr/test-record-group1 | 0
tools/perf/tests/{ => shell}/attr/test-record-group2 | 0
tools/perf/tests/{ => shell}/attr/test-record-no-buffering | 0
tools/perf/tests/{ => shell}/attr/test-record-no-inherit | 0
tools/perf/tests/{ => shell}/attr/test-record-no-samples | 0
tools/perf/tests/{ => shell}/attr/test-record-period | 0
tools/perf/tests/{ => shell}/attr/test-record-pfm-period | 0
tools/perf/tests/{ => shell}/attr/test-record-raw | 0
tools/perf/tests/{ => shell}/attr/test-record-spe-period | 0
.../perf/tests/{ => shell}/attr/test-record-spe-period-term | 0
.../tests/{ => shell}/attr/test-record-spe-physical-address | 0
.../{ => shell}/attr/test-record-user-regs-no-sve-aarch64 | 0
.../{ => shell}/attr/test-record-user-regs-old-sve-aarch64 | 0
.../tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 | 0
tools/perf/tests/{ => shell}/attr/test-stat-C0 | 0
tools/perf/tests/{ => shell}/attr/test-stat-basic | 0
tools/perf/tests/{ => shell}/attr/test-stat-default | 0
tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 | 0
tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 | 0
tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 | 0
tools/perf/tests/{ => shell}/attr/test-stat-group1 | 0
tools/perf/tests/{ => shell}/attr/test-stat-no-inherit | 0
tools/perf/tests/{ => shell/lib}/attr.py | 0
50 files changed, 3 insertions(+), 4 deletions(-)
rename tools/perf/tests/{ => shell}/attr/README (100%)
rename tools/perf/tests/{ => shell}/attr/base-record (100%)
rename tools/perf/tests/{ => shell}/attr/base-record-spe (100%)
rename tools/perf/tests/{ => shell}/attr/base-stat (100%)
rename tools/perf/tests/{ => shell}/attr/system-wide-dummy (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-C0 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-basic (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-any (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_call (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_ret (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-hv (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-ind_call (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-k (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-u (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-count (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-data (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-freq (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-default (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-default-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-group1 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-group2 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-no-buffering (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-no-inherit (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-no-samples (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-period (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-pfm-period (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-raw (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-spe-period (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-spe-period-term (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-spe-physical-address (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-no-sve-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-old-sve-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-C0 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-basic (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-default (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-group1 (100%)
rename tools/perf/tests/{ => shell}/attr/test-stat-no-inherit (100%)
rename tools/perf/tests/{ => shell/lib}/attr.py (100%)tools/perf/Makefile.perf +2 -3
@@ -1128,12 +1128,11 @@ endif install-tests: all install-gtk $(call QUIET_INSTALL, tests) \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ - $(INSTALL) tests/attr.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ $(INSTALL) tests/pe-file.exe* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \ - $(INSTALL) tests/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \ $(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \ + $(INSTALL) tests/shell/attr/* -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/attr'; \ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \ $(INSTALL) tests/shell/lib/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \ $(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
tools/perf/tests/shell/attr.sh +1 -1
@@ -17,6 +17,6 @@ trap trap_cleanup EXIT TERM INT shelldir=$(dirname "$0") perf_path=$(which perf) -python "${shelldir}"/../attr.py -d "${shelldir}"/../attr -v -p "$perf_path" +python "${shelldir}"/lib/attr.py -d "${shelldir}"/attr -v -p "$perf_path" cleanup exit $err
tools/perf/tests/shell/attr/README renamed from tools/perf/tests/attr/README +0 -0
tools/perf/tests/shell/attr/base-record renamed from tools/perf/tests/attr/base-record +0 -0
tools/perf/tests/shell/attr/base-record-spe renamed from tools/perf/tests/attr/base-record-spe +0 -0
tools/perf/tests/shell/attr/base-stat renamed from tools/perf/tests/attr/base-stat +0 -0
tools/perf/tests/shell/attr/system-wide-dummy renamed from tools/perf/tests/attr/system-wide-dummy +0 -0
tools/perf/tests/shell/attr/test-record-C0 renamed from tools/perf/tests/attr/test-record-C0 +0 -0
tools/perf/tests/shell/attr/test-record-basic renamed from tools/perf/tests/attr/test-record-basic +0 -0
tools/perf/tests/shell/attr/test-record-branch-any renamed from tools/perf/tests/attr/test-record-branch-any +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-any renamed from tools/perf/tests/attr/test-record-branch-filter-any +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-any_call renamed from tools/perf/tests/attr/test-record-branch-filter-any_call +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-any_ret renamed from tools/perf/tests/attr/test-record-branch-filter-any_ret +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-hv renamed from tools/perf/tests/attr/test-record-branch-filter-hv +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-ind_call renamed from tools/perf/tests/attr/test-record-branch-filter-ind_call +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-k renamed from tools/perf/tests/attr/test-record-branch-filter-k +0 -0
tools/perf/tests/shell/attr/test-record-branch-filter-u renamed from tools/perf/tests/attr/test-record-branch-filter-u +0 -0
tools/perf/tests/shell/attr/test-record-count renamed from tools/perf/tests/attr/test-record-count +0 -0
tools/perf/tests/shell/attr/test-record-data renamed from tools/perf/tests/attr/test-record-data +0 -0
tools/perf/tests/shell/attr/test-record-dummy-C0 renamed from tools/perf/tests/attr/test-record-dummy-C0 +0 -0
tools/perf/tests/shell/attr/test-record-freq renamed from tools/perf/tests/attr/test-record-freq +0 -0
tools/perf/tests/shell/attr/test-record-graph-default renamed from tools/perf/tests/attr/test-record-graph-default +0 -0
tools/perf/tests/shell/attr/test-record-graph-default-aarch64 renamed from tools/perf/tests/attr/test-record-graph-default-aarch64 +0 -0
tools/perf/tests/shell/attr/test-record-graph-dwarf renamed from tools/perf/tests/attr/test-record-graph-dwarf +0 -0
tools/perf/tests/shell/attr/test-record-graph-fp renamed from tools/perf/tests/attr/test-record-graph-fp +0 -0
tools/perf/tests/shell/attr/test-record-graph-fp-aarch64 renamed from tools/perf/tests/attr/test-record-graph-fp-aarch64 +0 -0
tools/perf/tests/shell/attr/test-record-group-sampling renamed from tools/perf/tests/attr/test-record-group-sampling +0 -0
tools/perf/tests/shell/attr/test-record-group1 renamed from tools/perf/tests/attr/test-record-group1 +0 -0
tools/perf/tests/shell/attr/test-record-group2 renamed from tools/perf/tests/attr/test-record-group2 +0 -0
tools/perf/tests/shell/attr/test-record-no-buffering renamed from tools/perf/tests/attr/test-record-no-buffering +0 -0
tools/perf/tests/shell/attr/test-record-no-inherit renamed from tools/perf/tests/attr/test-record-no-inherit +0 -0
tools/perf/tests/shell/attr/test-record-no-samples renamed from tools/perf/tests/attr/test-record-no-samples +0 -0
tools/perf/tests/shell/attr/test-record-period renamed from tools/perf/tests/attr/test-record-period +0 -0
tools/perf/tests/shell/attr/test-record-pfm-period renamed from tools/perf/tests/attr/test-record-pfm-period +0 -0
tools/perf/tests/shell/attr/test-record-raw renamed from tools/perf/tests/attr/test-record-raw +0 -0
tools/perf/tests/shell/attr/test-record-spe-period renamed from tools/perf/tests/attr/test-record-spe-period +0 -0
tools/perf/tests/shell/attr/test-record-spe-period-term renamed from tools/perf/tests/attr/test-record-spe-period-term +0 -0
tools/perf/tests/shell/attr/test-record-spe-physical-address renamed from tools/perf/tests/attr/test-record-spe-physical-address +0 -0
tools/perf/tests/shell/attr/test-record-user-regs-no-sve-aarch64 renamed from tools/perf/tests/attr/test-record-user-regs-no-sve-aarch64 +0 -0
tools/perf/tests/shell/attr/test-record-user-regs-old-sve-aarch64 renamed from tools/perf/tests/attr/test-record-user-regs-old-sve-aarch64 +0 -0
tools/perf/tests/shell/attr/test-record-user-regs-sve-aarch64 renamed from tools/perf/tests/attr/test-record-user-regs-sve-aarch64 +0 -0
tools/perf/tests/shell/attr/test-stat-C0 renamed from tools/perf/tests/attr/test-stat-C0 +0 -0
tools/perf/tests/shell/attr/test-stat-basic renamed from tools/perf/tests/attr/test-stat-basic +0 -0
tools/perf/tests/shell/attr/test-stat-default renamed from tools/perf/tests/attr/test-stat-default +0 -0
tools/perf/tests/shell/attr/test-stat-detailed-1 renamed from tools/perf/tests/attr/test-stat-detailed-1 +0 -0
tools/perf/tests/shell/attr/test-stat-detailed-2 renamed from tools/perf/tests/attr/test-stat-detailed-2 +0 -0
tools/perf/tests/shell/attr/test-stat-detailed-3 renamed from tools/perf/tests/attr/test-stat-detailed-3 +0 -0
tools/perf/tests/shell/attr/test-stat-group1 renamed from tools/perf/tests/attr/test-stat-group1 +0 -0
tools/perf/tests/shell/attr/test-stat-no-inherit renamed from tools/perf/tests/attr/test-stat-no-inherit +0 -0
tools/perf/tests/shell/lib/attr.py renamed from tools/perf/tests/attr.py +0 -0
Signature · 1 line
2.46.1.824.gd892dcdcdd-goog
Ian Rogers
reviewerQuoted 5 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.
Ping.
I think this is worthwhile cleanup for the attributes test. It should avoid problems like:
https://lore.kernel.org/lkml/ZroNTkdA8XDFaDks@x1/
Thanks,
Ian
Quoted 117 lines
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are usedtools/perf/Makefile.perf | 5 +- tools/perf/perf.c | 2 - tools/perf/tests/Build | 1 - tools/perf/tests/attr.c | 218 ------------------ tools/perf/tests/builtin-test.c | 1 - tools/perf/tests/shell/attr.sh | 22 ++ tools/perf/tests/{ => shell}/attr/README | 0 tools/perf/tests/{ => shell}/attr/base-record | 0 .../tests/{ => shell}/attr/base-record-spe | 0 tools/perf/tests/{ => shell}/attr/base-stat | 0 .../tests/{ => shell}/attr/system-wide-dummy | 0 .../tests/{ => shell}/attr/test-record-C0 | 0 .../tests/{ => shell}/attr/test-record-basic | 0 .../{ => shell}/attr/test-record-branch-any | 0 .../attr/test-record-branch-filter-any | 0 .../attr/test-record-branch-filter-any_call | 0 .../attr/test-record-branch-filter-any_ret | 0 .../attr/test-record-branch-filter-hv | 0 .../attr/test-record-branch-filter-ind_call | 0 .../attr/test-record-branch-filter-k | 0 .../attr/test-record-branch-filter-u | 0 .../tests/{ => shell}/attr/test-record-count | 0 .../tests/{ => shell}/attr/test-record-data | 0 .../{ => shell}/attr/test-record-dummy-C0 | 0 .../tests/{ => shell}/attr/test-record-freq | 0 .../attr/test-record-graph-default | 0 .../attr/test-record-graph-default-aarch64 | 0 .../{ => shell}/attr/test-record-graph-dwarf | 0 .../{ => shell}/attr/test-record-graph-fp | 0 .../attr/test-record-graph-fp-aarch64 | 0 .../attr/test-record-group-sampling | 0 .../tests/{ => shell}/attr/test-record-group1 | 0 .../tests/{ => shell}/attr/test-record-group2 | 0 .../{ => shell}/attr/test-record-no-buffering | 0 .../{ => shell}/attr/test-record-no-inherit | 0 .../{ => shell}/attr/test-record-no-samples | 0 .../tests/{ => shell}/attr/test-record-period | 0 .../{ => shell}/attr/test-record-pfm-period | 0 .../tests/{ => shell}/attr/test-record-raw | 0 .../{ => shell}/attr/test-record-spe-period | 0 .../attr/test-record-spe-period-term | 0 .../attr/test-record-spe-physical-address | 0 .../attr/test-record-user-regs-no-sve-aarch64 | 0 .../test-record-user-regs-old-sve-aarch64 | 0 .../attr/test-record-user-regs-sve-aarch64 | 0 .../perf/tests/{ => shell}/attr/test-stat-C0 | 0 .../tests/{ => shell}/attr/test-stat-basic | 0 .../tests/{ => shell}/attr/test-stat-default | 0 .../{ => shell}/attr/test-stat-detailed-1 | 0 .../{ => shell}/attr/test-stat-detailed-2 | 0 .../{ => shell}/attr/test-stat-detailed-3 | 0 .../tests/{ => shell}/attr/test-stat-group1 | 0 .../{ => shell}/attr/test-stat-no-inherit | 0 tools/perf/tests/{ => shell/lib}/attr.py | 0 tools/perf/tests/tests.h | 1 - tools/perf/util/evsel.c | 122 +++++++++- tools/perf/util/util.h | 7 - 57 files changed, 142 insertions(+), 237 deletions(-) delete mode 100644 tools/perf/tests/attr.c create mode 100755 tools/perf/tests/shell/attr.sh rename tools/perf/tests/{ => shell}/attr/README (100%) rename tools/perf/tests/{ => shell}/attr/base-record (100%) rename tools/perf/tests/{ => shell}/attr/base-record-spe (100%) rename tools/perf/tests/{ => shell}/attr/base-stat (100%) rename tools/perf/tests/{ => shell}/attr/system-wide-dummy (100%) rename tools/perf/tests/{ => shell}/attr/test-record-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_ret (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-hv (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-ind_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-k (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-u (100%) rename tools/perf/tests/{ => shell}/attr/test-record-count (100%) rename tools/perf/tests/{ => shell}/attr/test-record-data (100%) rename tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-freq (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group2 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-buffering (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-inherit (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-samples (100%) rename tools/perf/tests/{ => shell}/attr/test-record-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-pfm-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-raw (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period-term (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-physical-address (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-no-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-old-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-default (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-no-inherit (100%) rename tools/perf/tests/{ => shell/lib}/attr.py (100%)--
2.46.1.824.gd892dcdcdd-goog
Namhyung Kim
maintainerQuoted 7 lines · Ian Rogers
Quoted 5 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.
Quoted 5 lines
Ping.
I think this is worthwhile cleanup for the attributes test. It should avoid problems like:
https://lore.kernel.org/lkml/ZroNTkdA8XDFaDks@x1/
Sorry, it's not clear to me what was the problem. Can you please say it again briefly?
Thanks,
Namhyung
Quoted 118 lines
Quoted 118 lines
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are usedtools/perf/Makefile.perf | 5 +- tools/perf/perf.c | 2 - tools/perf/tests/Build | 1 - tools/perf/tests/attr.c | 218 ------------------ tools/perf/tests/builtin-test.c | 1 - tools/perf/tests/shell/attr.sh | 22 ++ tools/perf/tests/{ => shell}/attr/README | 0 tools/perf/tests/{ => shell}/attr/base-record | 0 .../tests/{ => shell}/attr/base-record-spe | 0 tools/perf/tests/{ => shell}/attr/base-stat | 0 .../tests/{ => shell}/attr/system-wide-dummy | 0 .../tests/{ => shell}/attr/test-record-C0 | 0 .../tests/{ => shell}/attr/test-record-basic | 0 .../{ => shell}/attr/test-record-branch-any | 0 .../attr/test-record-branch-filter-any | 0 .../attr/test-record-branch-filter-any_call | 0 .../attr/test-record-branch-filter-any_ret | 0 .../attr/test-record-branch-filter-hv | 0 .../attr/test-record-branch-filter-ind_call | 0 .../attr/test-record-branch-filter-k | 0 .../attr/test-record-branch-filter-u | 0 .../tests/{ => shell}/attr/test-record-count | 0 .../tests/{ => shell}/attr/test-record-data | 0 .../{ => shell}/attr/test-record-dummy-C0 | 0 .../tests/{ => shell}/attr/test-record-freq | 0 .../attr/test-record-graph-default | 0 .../attr/test-record-graph-default-aarch64 | 0 .../{ => shell}/attr/test-record-graph-dwarf | 0 .../{ => shell}/attr/test-record-graph-fp | 0 .../attr/test-record-graph-fp-aarch64 | 0 .../attr/test-record-group-sampling | 0 .../tests/{ => shell}/attr/test-record-group1 | 0 .../tests/{ => shell}/attr/test-record-group2 | 0 .../{ => shell}/attr/test-record-no-buffering | 0 .../{ => shell}/attr/test-record-no-inherit | 0 .../{ => shell}/attr/test-record-no-samples | 0 .../tests/{ => shell}/attr/test-record-period | 0 .../{ => shell}/attr/test-record-pfm-period | 0 .../tests/{ => shell}/attr/test-record-raw | 0 .../{ => shell}/attr/test-record-spe-period | 0 .../attr/test-record-spe-period-term | 0 .../attr/test-record-spe-physical-address | 0 .../attr/test-record-user-regs-no-sve-aarch64 | 0 .../test-record-user-regs-old-sve-aarch64 | 0 .../attr/test-record-user-regs-sve-aarch64 | 0 .../perf/tests/{ => shell}/attr/test-stat-C0 | 0 .../tests/{ => shell}/attr/test-stat-basic | 0 .../tests/{ => shell}/attr/test-stat-default | 0 .../{ => shell}/attr/test-stat-detailed-1 | 0 .../{ => shell}/attr/test-stat-detailed-2 | 0 .../{ => shell}/attr/test-stat-detailed-3 | 0 .../tests/{ => shell}/attr/test-stat-group1 | 0 .../{ => shell}/attr/test-stat-no-inherit | 0 tools/perf/tests/{ => shell/lib}/attr.py | 0 tools/perf/tests/tests.h | 1 - tools/perf/util/evsel.c | 122 +++++++++- tools/perf/util/util.h | 7 - 57 files changed, 142 insertions(+), 237 deletions(-) delete mode 100644 tools/perf/tests/attr.c create mode 100755 tools/perf/tests/shell/attr.sh rename tools/perf/tests/{ => shell}/attr/README (100%) rename tools/perf/tests/{ => shell}/attr/base-record (100%) rename tools/perf/tests/{ => shell}/attr/base-record-spe (100%) rename tools/perf/tests/{ => shell}/attr/base-stat (100%) rename tools/perf/tests/{ => shell}/attr/system-wide-dummy (100%) rename tools/perf/tests/{ => shell}/attr/test-record-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_ret (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-hv (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-ind_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-k (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-u (100%) rename tools/perf/tests/{ => shell}/attr/test-record-count (100%) rename tools/perf/tests/{ => shell}/attr/test-record-data (100%) rename tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-freq (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group2 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-buffering (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-inherit (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-samples (100%) rename tools/perf/tests/{ => shell}/attr/test-record-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-pfm-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-raw (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period-term (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-physical-address (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-no-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-old-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-default (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-no-inherit (100%) rename tools/perf/tests/{ => shell/lib}/attr.py (100%)--
2.46.1.824.gd892dcdcdd-goog
Ian Rogers
reviewerQuoted 9 lines · Namhyung Kim
Quoted 7 lines · Ian Rogers
Quoted 5 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.
Quoted 8 lines
Quoted 5 lines
Ping.
I think this is worthwhile cleanup for the attributes test. It should avoid problems like:
https://lore.kernel.org/lkml/ZroNTkdA8XDFaDks@x1/Sorry, it's not clear to me what was the problem. Can you please say it again briefly?
If you build perf like:
make -C tools/perf O=/tmp/perf
Then run the built perf test for the "Setup struct perf_event_attr" it skips (causing the tests to bitrot and fixes to be sent by Veronika):
``` $ sudo /tmp/perf/perf test -vv perf_event_attr capget syscall failed (No such file or directory - 2) fall back on root check 17: Setup struct perf_event_attr: 17: Setup struct perf_event_attr: --- start --- test child forked, pid 806601 Using CPUID GenuineIntel-6-8D-1 ---- end(-2) ---- 17: Setup struct perf_event_attr : Skip ```
The issue is around the path set up, the test has a few path expectations but they are brittle as shown above. While we could endeavour to set up the path in C code, it makes sense to migrate the test to a shell test due to the tests smaller size, ease of environment variable manipulation, existing perf test support for better path setup, etc. Ie let's not reinvent the shell test infrastructure that handles python tests for the sake of one C test. After this change:
``` $ sudo /tmp/perf/perf test attribute 76: Perf attribute expectations test : Ok ```
Thanks,
Ian
Quoted 118 lines
Quoted 118 lines
Quoted 118 lines
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are usedtools/perf/Makefile.perf | 5 +- tools/perf/perf.c | 2 - tools/perf/tests/Build | 1 - tools/perf/tests/attr.c | 218 ------------------ tools/perf/tests/builtin-test.c | 1 - tools/perf/tests/shell/attr.sh | 22 ++ tools/perf/tests/{ => shell}/attr/README | 0 tools/perf/tests/{ => shell}/attr/base-record | 0 .../tests/{ => shell}/attr/base-record-spe | 0 tools/perf/tests/{ => shell}/attr/base-stat | 0 .../tests/{ => shell}/attr/system-wide-dummy | 0 .../tests/{ => shell}/attr/test-record-C0 | 0 .../tests/{ => shell}/attr/test-record-basic | 0 .../{ => shell}/attr/test-record-branch-any | 0 .../attr/test-record-branch-filter-any | 0 .../attr/test-record-branch-filter-any_call | 0 .../attr/test-record-branch-filter-any_ret | 0 .../attr/test-record-branch-filter-hv | 0 .../attr/test-record-branch-filter-ind_call | 0 .../attr/test-record-branch-filter-k | 0 .../attr/test-record-branch-filter-u | 0 .../tests/{ => shell}/attr/test-record-count | 0 .../tests/{ => shell}/attr/test-record-data | 0 .../{ => shell}/attr/test-record-dummy-C0 | 0 .../tests/{ => shell}/attr/test-record-freq | 0 .../attr/test-record-graph-default | 0 .../attr/test-record-graph-default-aarch64 | 0 .../{ => shell}/attr/test-record-graph-dwarf | 0 .../{ => shell}/attr/test-record-graph-fp | 0 .../attr/test-record-graph-fp-aarch64 | 0 .../attr/test-record-group-sampling | 0 .../tests/{ => shell}/attr/test-record-group1 | 0 .../tests/{ => shell}/attr/test-record-group2 | 0 .../{ => shell}/attr/test-record-no-buffering | 0 .../{ => shell}/attr/test-record-no-inherit | 0 .../{ => shell}/attr/test-record-no-samples | 0 .../tests/{ => shell}/attr/test-record-period | 0 .../{ => shell}/attr/test-record-pfm-period | 0 .../tests/{ => shell}/attr/test-record-raw | 0 .../{ => shell}/attr/test-record-spe-period | 0 .../attr/test-record-spe-period-term | 0 .../attr/test-record-spe-physical-address | 0 .../attr/test-record-user-regs-no-sve-aarch64 | 0 .../test-record-user-regs-old-sve-aarch64 | 0 .../attr/test-record-user-regs-sve-aarch64 | 0 .../perf/tests/{ => shell}/attr/test-stat-C0 | 0 .../tests/{ => shell}/attr/test-stat-basic | 0 .../tests/{ => shell}/attr/test-stat-default | 0 .../{ => shell}/attr/test-stat-detailed-1 | 0 .../{ => shell}/attr/test-stat-detailed-2 | 0 .../{ => shell}/attr/test-stat-detailed-3 | 0 .../tests/{ => shell}/attr/test-stat-group1 | 0 .../{ => shell}/attr/test-stat-no-inherit | 0 tools/perf/tests/{ => shell/lib}/attr.py | 0 tools/perf/tests/tests.h | 1 - tools/perf/util/evsel.c | 122 +++++++++- tools/perf/util/util.h | 7 - 57 files changed, 142 insertions(+), 237 deletions(-) delete mode 100644 tools/perf/tests/attr.c create mode 100755 tools/perf/tests/shell/attr.sh rename tools/perf/tests/{ => shell}/attr/README (100%) rename tools/perf/tests/{ => shell}/attr/base-record (100%) rename tools/perf/tests/{ => shell}/attr/base-record-spe (100%) rename tools/perf/tests/{ => shell}/attr/base-stat (100%) rename tools/perf/tests/{ => shell}/attr/system-wide-dummy (100%) rename tools/perf/tests/{ => shell}/attr/test-record-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_ret (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-hv (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-ind_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-k (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-u (100%) rename tools/perf/tests/{ => shell}/attr/test-record-count (100%) rename tools/perf/tests/{ => shell}/attr/test-record-data (100%) rename tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-freq (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group2 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-buffering (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-inherit (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-samples (100%) rename tools/perf/tests/{ => shell}/attr/test-record-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-pfm-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-raw (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period-term (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-physical-address (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-no-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-old-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-default (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-no-inherit (100%) rename tools/perf/tests/{ => shell/lib}/attr.py (100%)--
2.46.1.824.gd892dcdcdd-goog
Namhyung Kim
maintainerQuoted 44 lines · Ian Rogers
Quoted 9 lines · Namhyung Kim
Quoted 7 lines · Ian Rogers
Quoted 5 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.Quoted 8 lines
Quoted 5 lines
Ping.
I think this is worthwhile cleanup for the attributes test. It should avoid problems like:
https://lore.kernel.org/lkml/ZroNTkdA8XDFaDks@x1/Sorry, it's not clear to me what was the problem. Can you please say it again briefly?
If you build perf like:
make -Ctools/perfO=/tmp/perfThen run the built perf test for the "Setup struct
perf_event_attr" it skips (causing the tests to bitrot and fixes to be sent by Veronika):``` $ sudo /tmp/perf/perf test -vv perf_event_attr capget syscall failed (No such file or directory - 2) fall back on root check 17: Setup struct perf_event_attr: 17: Setup struct perf_event_attr: --- start --- test child forked, pid 806601 Using CPUID GenuineIntel-6-8D-1 ---- end(-2) ---- 17: Setup struct perf_event_attr : Skip ```The issue is around the path set up, the test has a few path expectations but they are brittle as shown above. While we could endeavour to set up the path in C code, it makes sense to migrate the test to a shell test due to the tests smaller size, ease of environment variable manipulation, existing perf test support for better path setup, etc. Ie let's not reinvent the shell test infrastructure that handles python tests for the sake of one C test. After this change:
Quoted 4 lines
``` $ sudo /tmp/perf/perf test attribute 76: Perf attribute expectations test : Ok ```
Ok, thanks for the explanation!
Namhyung
Quoted 119 lines
Quoted 119 lines
Quoted 119 lines
Quoted 119 lines
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are usedtools/perf/Makefile.perf | 5 +- tools/perf/perf.c | 2 - tools/perf/tests/Build | 1 - tools/perf/tests/attr.c | 218 ------------------ tools/perf/tests/builtin-test.c | 1 - tools/perf/tests/shell/attr.sh | 22 ++ tools/perf/tests/{ => shell}/attr/README | 0 tools/perf/tests/{ => shell}/attr/base-record | 0 .../tests/{ => shell}/attr/base-record-spe | 0 tools/perf/tests/{ => shell}/attr/base-stat | 0 .../tests/{ => shell}/attr/system-wide-dummy | 0 .../tests/{ => shell}/attr/test-record-C0 | 0 .../tests/{ => shell}/attr/test-record-basic | 0 .../{ => shell}/attr/test-record-branch-any | 0 .../attr/test-record-branch-filter-any | 0 .../attr/test-record-branch-filter-any_call | 0 .../attr/test-record-branch-filter-any_ret | 0 .../attr/test-record-branch-filter-hv | 0 .../attr/test-record-branch-filter-ind_call | 0 .../attr/test-record-branch-filter-k | 0 .../attr/test-record-branch-filter-u | 0 .../tests/{ => shell}/attr/test-record-count | 0 .../tests/{ => shell}/attr/test-record-data | 0 .../{ => shell}/attr/test-record-dummy-C0 | 0 .../tests/{ => shell}/attr/test-record-freq | 0 .../attr/test-record-graph-default | 0 .../attr/test-record-graph-default-aarch64 | 0 .../{ => shell}/attr/test-record-graph-dwarf | 0 .../{ => shell}/attr/test-record-graph-fp | 0 .../attr/test-record-graph-fp-aarch64 | 0 .../attr/test-record-group-sampling | 0 .../tests/{ => shell}/attr/test-record-group1 | 0 .../tests/{ => shell}/attr/test-record-group2 | 0 .../{ => shell}/attr/test-record-no-buffering | 0 .../{ => shell}/attr/test-record-no-inherit | 0 .../{ => shell}/attr/test-record-no-samples | 0 .../tests/{ => shell}/attr/test-record-period | 0 .../{ => shell}/attr/test-record-pfm-period | 0 .../tests/{ => shell}/attr/test-record-raw | 0 .../{ => shell}/attr/test-record-spe-period | 0 .../attr/test-record-spe-period-term | 0 .../attr/test-record-spe-physical-address | 0 .../attr/test-record-user-regs-no-sve-aarch64 | 0 .../test-record-user-regs-old-sve-aarch64 | 0 .../attr/test-record-user-regs-sve-aarch64 | 0 .../perf/tests/{ => shell}/attr/test-stat-C0 | 0 .../tests/{ => shell}/attr/test-stat-basic | 0 .../tests/{ => shell}/attr/test-stat-default | 0 .../{ => shell}/attr/test-stat-detailed-1 | 0 .../{ => shell}/attr/test-stat-detailed-2 | 0 .../{ => shell}/attr/test-stat-detailed-3 | 0 .../tests/{ => shell}/attr/test-stat-group1 | 0 .../{ => shell}/attr/test-stat-no-inherit | 0 tools/perf/tests/{ => shell/lib}/attr.py | 0 tools/perf/tests/tests.h | 1 - tools/perf/util/evsel.c | 122 +++++++++- tools/perf/util/util.h | 7 - 57 files changed, 142 insertions(+), 237 deletions(-) delete mode 100644 tools/perf/tests/attr.c create mode 100755 tools/perf/tests/shell/attr.sh rename tools/perf/tests/{ => shell}/attr/README (100%) rename tools/perf/tests/{ => shell}/attr/base-record (100%) rename tools/perf/tests/{ => shell}/attr/base-record-spe (100%) rename tools/perf/tests/{ => shell}/attr/base-stat (100%) rename tools/perf/tests/{ => shell}/attr/system-wide-dummy (100%) rename tools/perf/tests/{ => shell}/attr/test-record-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-any_ret (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-hv (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-ind_call (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-k (100%) rename tools/perf/tests/{ => shell}/attr/test-record-branch-filter-u (100%) rename tools/perf/tests/{ => shell}/attr/test-record-count (100%) rename tools/perf/tests/{ => shell}/attr/test-record-data (100%) rename tools/perf/tests/{ => shell}/attr/test-record-dummy-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-freq (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-default-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-dwarf (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp (100%) rename tools/perf/tests/{ => shell}/attr/test-record-graph-fp-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-group2 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-buffering (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-inherit (100%) rename tools/perf/tests/{ => shell}/attr/test-record-no-samples (100%) rename tools/perf/tests/{ => shell}/attr/test-record-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-pfm-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-raw (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-period-term (100%) rename tools/perf/tests/{ => shell}/attr/test-record-spe-physical-address (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-no-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-old-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-record-user-regs-sve-aarch64 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-C0 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-basic (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-default (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-2 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-detailed-3 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-group1 (100%) rename tools/perf/tests/{ => shell}/attr/test-stat-no-inherit (100%) rename tools/perf/tests/{ => shell/lib}/attr.py (100%)--
2.46.1.824.gd892dcdcdd-goog
Quoted 11 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are used[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
Namhyung Kim
maintainerQuoted 6 lines · Namhyung Kim
Quoted 5 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.
Quoted 8 lines
Quoted 6 lines
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are used[...]
Applied to perf-tools-next, thanks!
Dropped from perf-tools-next due to build failures on PPC.
https://lore.kernel.org/r/[email protected]
Thanks,
Namhyung
Quoted 16 lines · Namhyung Kim
Quoted 11 lines · Namhyung Kim
Quoted 10 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are used
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
[...]
Applied to perf-tools-next, thanks!
Dropped from perf-tools-next due to build failures on PPC.
Hi Namhyung
I am checking this on powerpc. Will respond with the findings
Thanks
Athira
Quoted 4 lines
Thanks,
Namhyung
Athira Rajeev
Tested-byQuoted 26 lines · Athira Rajeev
Quoted 23 lines · Namhyung Kim
Quoted 6 lines · Namhyung Kim
Quoted 5 lines · Ian Rogers
The path detection for "Setup struct
perf_event_attr" test is brittle and leads to the test frequently not running. Running shell tests is reasonably robust, so make the test a shell test. Move the test files to reflect this.Quoted 8 lines
Quoted 6 lines
Ian Rogers (3):
perf test: Add a shell wrapper for "Setup structperf_event_attr" perf test: Remove C test wrapper forattr.py
perf test: Move attr files into shell directory where they are used[...]
Applied to perf-tools-next, thanks!
Dropped from perf-tools-next due to build failures on PPC.
Quoted 8 lines
Quoted 1 line
Hi Namhyung
I am checking this on powerpc. Will respond with the findings
Thanks
Athira
I tried on tmp.perf-tools-next branch from git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git
But hit a patch apply issue in second patch
error: patch failed: tools/perf/tests/tests.h:83
error: tools/perf/tests/tests.h: patch does not apply
Applied this change separately and hit the compilation error reported by Stephen
As suggested by Ian , tried below change and it did solve the compilation issue
tools/perf/util/evsel.c +4 -0
@@ -6,6 +6,11 @@* copyright notes. */ +/* Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select +* 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu. +*/ +#define __SANE_USERSPACE_TYPES__ +#include <byteswap.h> #include <errno.h> #include <inttypes.h>
I could also verify running the test as well
# ./perf test attribute 65: Perf attribute expectations test : Ok
With the change above,
Thanks
Athira
Quoted 3 lines
Quoted 3 lines
Thanks,
Namhyung