Skip to contentSkip to conversation

Make "Setup struct perf_event_attr" a shell test

PATCH Applied Ian Rogers 2 participants 5 messages Oct 15, 2024 – Oct 18, 2024 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

v2 cover Make "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.

Before, 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, fixes to be sent, etc.):

```
$ 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
```

v2: Add __SANE_USERSPACE_TYPES__ to fix PowerPC build, Tested-by
Athira Rajeev <[email protected]> and Stephen Rothwell <[email protected]>.

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
 .../attr/test-record-group-sampling1          |   0
 .../attr/test-record-group-sampling2          |   0
 .../tests/{ => shell}/attr/test-record-group1 |   0
 .../tests/{ => shell}/attr/test-record-group2 |   0
 .../tests/{ => shell}/attr/test-record-group3 |   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/util/evsel.c                       | 127 +++++++++-
 tools/perf/util/util.h                        |   7 -
 59 files changed, 147 insertions(+), 236 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-group-sampling1 (100%)
 rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling2 (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-group3 (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.47.0.rc1.288.g06298d1525-goog
author reviewer
#1 lore raw

PATCH v2 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
new file mode 100755
index 000000000000..e094f3baffb7
@@ -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.47.0.rc1.288.g06298d1525-goog
author reviewer
#2 lore raw

PATCH v2 2/3 perf test: Remove C test wrapper for attr.py

In reply to Ian Rogers

Remove 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.

Add __SANE_USERSPACE_TYPES__ to evsel.c to fix format flag issues on PowerPC triggered by moving attr.c functions to evsel.c.

---
 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/util/evsel.c         | 127 ++++++++++++++++++-
 tools/perf/util/util.h          |   7 -
 6 files changed, 123 insertions(+), 233 deletions(-)
 delete mode 100644 tools/perf/tests/attr.c
tools/perf/perf.c +0 -2
index 4def800f4089..a2987f2cfe1a 100644
@@ -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
index a771e4928247..03cbdf7c50a0 100644
@@ -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
index 3b30f258c395..50533446e747 100644
@@ -80,7 +80,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/util/evsel.c +123 -4

151 lines not on this page · raw message

tools/perf/util/util.h +0 -7
index 9966c21aaf04..14f2c70906be 100644
@@ -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.47.0.rc1.288.g06298d1525-goog
author reviewer
#3 lore raw

PATCH v2 3/3 perf test: Move attr files into shell directory where they are used

In reply to Ian Rogers

Now 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
 .../perf/tests/{ => shell}/attr/test-record-group-sampling1  | 0
 .../perf/tests/{ => shell}/attr/test-record-group-sampling2  | 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-group3         | 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
 53 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-group-sampling1 (100%)
 rename tools/perf/tests/{ => shell}/attr/test-record-group-sampling2 (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-group3 (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
index 9dd2e8d3f3c9..105f734b6820 100644
@@ -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
index e094f3baffb7..5a4e43b2471d 100755
@@ -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
similarity index 100%
rename from tools/perf/tests/attr/README
rename to tools/perf/tests/shell/attr/README
tools/perf/tests/shell/attr/base-record renamed from tools/perf/tests/attr/base-record +0 -0
similarity index 100%
rename from tools/perf/tests/attr/base-record
rename to tools/perf/tests/shell/attr/base-record
tools/perf/tests/shell/attr/base-record-spe renamed from tools/perf/tests/attr/base-record-spe +0 -0
similarity index 100%
rename from tools/perf/tests/attr/base-record-spe
rename to tools/perf/tests/shell/attr/base-record-spe
tools/perf/tests/shell/attr/base-stat renamed from tools/perf/tests/attr/base-stat +0 -0
similarity index 100%
rename from tools/perf/tests/attr/base-stat
rename to tools/perf/tests/shell/attr/base-stat
tools/perf/tests/shell/attr/system-wide-dummy renamed from tools/perf/tests/attr/system-wide-dummy +0 -0
similarity index 100%
rename from tools/perf/tests/attr/system-wide-dummy
rename to tools/perf/tests/shell/attr/system-wide-dummy
tools/perf/tests/shell/attr/test-record-C0 renamed from tools/perf/tests/attr/test-record-C0 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-C0
rename to tools/perf/tests/shell/attr/test-record-C0
tools/perf/tests/shell/attr/test-record-basic renamed from tools/perf/tests/attr/test-record-basic +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-basic
rename to tools/perf/tests/shell/attr/test-record-basic
tools/perf/tests/shell/attr/test-record-branch-any renamed from tools/perf/tests/attr/test-record-branch-any +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-any
rename to tools/perf/tests/shell/attr/test-record-branch-any
tools/perf/tests/shell/attr/test-record-branch-filter-any renamed from tools/perf/tests/attr/test-record-branch-filter-any +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-any
rename to tools/perf/tests/shell/attr/test-record-branch-filter-any
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
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-any_call
rename to tools/perf/tests/shell/attr/test-record-branch-filter-any_call
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
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-any_ret
rename to tools/perf/tests/shell/attr/test-record-branch-filter-any_ret
tools/perf/tests/shell/attr/test-record-branch-filter-hv renamed from tools/perf/tests/attr/test-record-branch-filter-hv +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-hv
rename to tools/perf/tests/shell/attr/test-record-branch-filter-hv
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
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-ind_call
rename to tools/perf/tests/shell/attr/test-record-branch-filter-ind_call
tools/perf/tests/shell/attr/test-record-branch-filter-k renamed from tools/perf/tests/attr/test-record-branch-filter-k +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-k
rename to tools/perf/tests/shell/attr/test-record-branch-filter-k
tools/perf/tests/shell/attr/test-record-branch-filter-u renamed from tools/perf/tests/attr/test-record-branch-filter-u +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-branch-filter-u
rename to tools/perf/tests/shell/attr/test-record-branch-filter-u
tools/perf/tests/shell/attr/test-record-count renamed from tools/perf/tests/attr/test-record-count +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-count
rename to tools/perf/tests/shell/attr/test-record-count
tools/perf/tests/shell/attr/test-record-data renamed from tools/perf/tests/attr/test-record-data +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-data
rename to tools/perf/tests/shell/attr/test-record-data
tools/perf/tests/shell/attr/test-record-dummy-C0 renamed from tools/perf/tests/attr/test-record-dummy-C0 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-dummy-C0
rename to tools/perf/tests/shell/attr/test-record-dummy-C0
tools/perf/tests/shell/attr/test-record-freq renamed from tools/perf/tests/attr/test-record-freq +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-freq
rename to tools/perf/tests/shell/attr/test-record-freq
tools/perf/tests/shell/attr/test-record-graph-default renamed from tools/perf/tests/attr/test-record-graph-default +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-graph-default
rename to tools/perf/tests/shell/attr/test-record-graph-default
tools/perf/tests/shell/attr/test-record-graph-default-aarch64 renamed from tools/perf/tests/attr/test-record-graph-default-aarch64 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-graph-default-aarch64
rename to tools/perf/tests/shell/attr/test-record-graph-default-aarch64
tools/perf/tests/shell/attr/test-record-graph-dwarf renamed from tools/perf/tests/attr/test-record-graph-dwarf +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-graph-dwarf
rename to tools/perf/tests/shell/attr/test-record-graph-dwarf
tools/perf/tests/shell/attr/test-record-graph-fp renamed from tools/perf/tests/attr/test-record-graph-fp +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-graph-fp
rename to tools/perf/tests/shell/attr/test-record-graph-fp
tools/perf/tests/shell/attr/test-record-graph-fp-aarch64 renamed from tools/perf/tests/attr/test-record-graph-fp-aarch64 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-graph-fp-aarch64
rename to tools/perf/tests/shell/attr/test-record-graph-fp-aarch64
tools/perf/tests/shell/attr/test-record-group-sampling renamed from tools/perf/tests/attr/test-record-group-sampling +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-group-sampling
rename to tools/perf/tests/shell/attr/test-record-group-sampling
tools/perf/tests/shell/attr/test-record-group-sampling1 renamed from tools/perf/tests/attr/test-record-group-sampling1 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-group-sampling1
rename to tools/perf/tests/shell/attr/test-record-group-sampling1
tools/perf/tests/shell/attr/test-record-group-sampling2 renamed from tools/perf/tests/attr/test-record-group-sampling2 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-group-sampling2
rename to tools/perf/tests/shell/attr/test-record-group-sampling2
tools/perf/tests/shell/attr/test-record-group1 renamed from tools/perf/tests/attr/test-record-group1 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-group1
rename to tools/perf/tests/shell/attr/test-record-group1
tools/perf/tests/shell/attr/test-record-group2 renamed from tools/perf/tests/attr/test-record-group2 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-group2
rename to tools/perf/tests/shell/attr/test-record-group2
tools/perf/tests/shell/attr/test-record-group3 renamed from tools/perf/tests/attr/test-record-group3 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-group3
rename to tools/perf/tests/shell/attr/test-record-group3
tools/perf/tests/shell/attr/test-record-no-buffering renamed from tools/perf/tests/attr/test-record-no-buffering +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-no-buffering
rename to tools/perf/tests/shell/attr/test-record-no-buffering
tools/perf/tests/shell/attr/test-record-no-inherit renamed from tools/perf/tests/attr/test-record-no-inherit +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-no-inherit
rename to tools/perf/tests/shell/attr/test-record-no-inherit
tools/perf/tests/shell/attr/test-record-no-samples renamed from tools/perf/tests/attr/test-record-no-samples +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-no-samples
rename to tools/perf/tests/shell/attr/test-record-no-samples
tools/perf/tests/shell/attr/test-record-period renamed from tools/perf/tests/attr/test-record-period +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-period
rename to tools/perf/tests/shell/attr/test-record-period
tools/perf/tests/shell/attr/test-record-pfm-period renamed from tools/perf/tests/attr/test-record-pfm-period +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-pfm-period
rename to tools/perf/tests/shell/attr/test-record-pfm-period
tools/perf/tests/shell/attr/test-record-raw renamed from tools/perf/tests/attr/test-record-raw +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-raw
rename to tools/perf/tests/shell/attr/test-record-raw
tools/perf/tests/shell/attr/test-record-spe-period renamed from tools/perf/tests/attr/test-record-spe-period +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-spe-period
rename to tools/perf/tests/shell/attr/test-record-spe-period
tools/perf/tests/shell/attr/test-record-spe-period-term renamed from tools/perf/tests/attr/test-record-spe-period-term +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-spe-period-term
rename to tools/perf/tests/shell/attr/test-record-spe-period-term
tools/perf/tests/shell/attr/test-record-spe-physical-address renamed from tools/perf/tests/attr/test-record-spe-physical-address +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-record-spe-physical-address
rename to tools/perf/tests/shell/attr/test-record-spe-physical-address
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
similarity index 100%
rename from tools/perf/tests/attr/test-record-user-regs-no-sve-aarch64
rename to tools/perf/tests/shell/attr/test-record-user-regs-no-sve-aarch64
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
similarity index 100%
rename from tools/perf/tests/attr/test-record-user-regs-old-sve-aarch64
rename to tools/perf/tests/shell/attr/test-record-user-regs-old-sve-aarch64
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
similarity index 100%
rename from tools/perf/tests/attr/test-record-user-regs-sve-aarch64
rename to tools/perf/tests/shell/attr/test-record-user-regs-sve-aarch64
tools/perf/tests/shell/attr/test-stat-C0 renamed from tools/perf/tests/attr/test-stat-C0 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-C0
rename to tools/perf/tests/shell/attr/test-stat-C0
tools/perf/tests/shell/attr/test-stat-basic renamed from tools/perf/tests/attr/test-stat-basic +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-basic
rename to tools/perf/tests/shell/attr/test-stat-basic
tools/perf/tests/shell/attr/test-stat-default renamed from tools/perf/tests/attr/test-stat-default +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-default
rename to tools/perf/tests/shell/attr/test-stat-default
tools/perf/tests/shell/attr/test-stat-detailed-1 renamed from tools/perf/tests/attr/test-stat-detailed-1 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-detailed-1
rename to tools/perf/tests/shell/attr/test-stat-detailed-1
tools/perf/tests/shell/attr/test-stat-detailed-2 renamed from tools/perf/tests/attr/test-stat-detailed-2 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-detailed-2
rename to tools/perf/tests/shell/attr/test-stat-detailed-2
tools/perf/tests/shell/attr/test-stat-detailed-3 renamed from tools/perf/tests/attr/test-stat-detailed-3 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-detailed-3
rename to tools/perf/tests/shell/attr/test-stat-detailed-3
tools/perf/tests/shell/attr/test-stat-group1 renamed from tools/perf/tests/attr/test-stat-group1 +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-group1
rename to tools/perf/tests/shell/attr/test-stat-group1
tools/perf/tests/shell/attr/test-stat-no-inherit renamed from tools/perf/tests/attr/test-stat-no-inherit +0 -0
similarity index 100%
rename from tools/perf/tests/attr/test-stat-no-inherit
rename to tools/perf/tests/shell/attr/test-stat-no-inherit
tools/perf/tests/shell/lib/attr.py renamed from tools/perf/tests/attr.py +0 -0
similarity index 100%
rename from tools/perf/tests/attr.py
rename to tools/perf/tests/shell/lib/attr.py
Signature · 1 line
2.47.0.rc1.288.g06298d1525-goog
maintainer Applied
#4 lore raw
In reply to Ian Rogers
Quoted 20 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.

Before, 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, fixes to be sent, etc.):

```
$ 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
```
Quoted 1 line

[...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung