Skip to contentSkip to conversation

perf: test 15 fix python error on empty result

PATCH In review Thomas Richter 2 participants 15 messages Aug 9, 2017 – Aug 10, 2017 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 perf: test 15 fix python error on empty result

Commit d78ada4a767 ("perf tests attr: Do not store failed events") does not create an event file in the /tmp directory when the perf_open_event() system call failed.
This can lead to a situation where not /tmp/event-xx-yy-zz result file exists at all (for example on a s390x virtual machine environment) where no CPUMF hardware is available.

The following command then fails with a python call back chain instead of printing failure:
[root@s8360046 perf]# /usr/bin/python2 ./tests/attr.py -d ./tests/attr/ \
-p ./perf -v -ttest-stat-basic
running './tests/attr//test-stat-basic'
Traceback (most recent call last):
File "./tests/attr.py", line 379, in <module>

    main()
  File "./tests/attr.py", line 370, in main
    run_tests(options)
  File "./tests/attr.py", line 311, in run_tests
    Test(f, options).run()

File "./tests/attr.py", line 300, in run
self.compare(self.expect, self.result)
File "./tests/attr.py", line 248, in compare
exp_event.diff(res_event)
UnboundLocalError: local variable 'res_event' referenced before assignment [root@s8360046 perf]#

This patch catches this pitfall and prints an error message instead:
[root@s8360047 perf]# /usr/bin/python2 ./tests/attr.py -d ./tests/attr/ \
-p ./perf -vvv -ttest-stat-basic
running './tests/attr//test-stat-basic'
loading expected events

    Event event:base-stat
      fd = 1
      group_fd = -1
      flags = 0|8
      [....]
      sample_regs_user = 0
      sample_stack_user = 0

'PERF_TEST_ATTR=/tmp/tmpJbMQMP ./perf stat -o /tmp/tmpJbMQMP/perf.data -e cycles kill >/dev/null 2>&1' ret '1', expected '1' loading result events
compare
matching [event:base-stat]
match: [event:base-stat] matches []
res_event is empty
FAILED './tests/attr//test-stat-basic' - match failure
[root@s8360047 perf]#

---
 tools/perf/tests/attr.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/tests/attr.py +5 -1
index 6bb50e8..a13cd78 100644
@@ -237,6 +237,7 @@ class Test(object):
         # events in result. Fail if there's not any.
         for exp_name, exp_event in expect.items():
             exp_list = []
+            res_event = {}
             log.debug("    matching [%s]" % exp_name)
             for res_name, res_event in result.items():
                 log.debug("      to [%s]" % res_name)
@@ -253,7 +254,10 @@ class Test(object):
                 if exp_event.optional():
                     log.debug("    %s does not match, but is optional" % exp_name)
                 else:
-                    exp_event.diff(res_event)
+                    if not res_event:
+                        log.debug("    res_event is empty");
+                    else:
+                        exp_event.diff(res_event)
                     raise Fail(self, 'match failure');
 
             match[exp_name] = exp_list
Signature · 1 line
2.9.3
#1 lore raw

PATCH 2/9 perf test: perf test case 15 result ignored

Command perf test -v 15 (Setup struct perf_event_attr test) always reports success even if the test case fails. It works correctly if you also specify -F (for don't fork).

root@s35lp76 perf]# ./perf test -v 15
15: Setup struct perf_event_attr :
--- start ---
running './tests/attr/test-record-no-delay'
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.002 MB /tmp/tmp4E1h7R/perf.data

     (1 samples) ]

expected task=0, got 1
expected precise_ip=0, got 3
expected wakeup_events=1, got 0
FAILED './tests/attr/test-record-no-delay' - match failure test child finished with 0
---- end ----
Setup struct perf_event_attr: Ok

The reason for the wrong error reporting is the return value of the system() library call. It is called in run_dir() file tests/attr.c and returns the exit status, in above case 0xff00.
This value is given as parameter to the exit() function which can only handle values 0-0xff.
The child process terminates with exit value of 0 and the parent does not detect any error.

This patch corrects the error reporting and prints the correct test result.

---
 tools/perf/tests/attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/attr.c +1 -1
index 84c0eb5..9d932c6 100644
@@ -166,7 +166,7 @@ static int run_dir(const char *d, const char *perf)
 	snprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s",
 		 d, d, perf, vcnt, v);
 
-	return system(cmd);
+	return system(cmd) ? TEST_FAIL : TEST_OK;
 }
 
 int test__attr(int subtest __maybe_unused)
Signature · 1 line
2.9.3
#2 lore raw

PATCH 3/9 perf: test 15 fix test-stat-group tests

In reply to Thomas Richter

Both test-stat-group and test-stat-group1 fail. The reason is an invalid check for the read_format return code. The submitted value is 15 and this value should be returned by the perf_event_open() call (which it is).
The comparison however is done against an invalid value of 3.
Fix this by setting the expected read_format value.

---
 tools/perf/tests/attr/test-stat-group  | 2 ++
 tools/perf/tests/attr/test-stat-group1 | 2 ++
 2 files changed, 4 insertions(+)
tools/perf/tests/attr/test-stat-group +2 -0
index fdc1596..8fb3a50 100644
@@ -6,10 +6,12 @@ ret     = 1
 [event-1:base-stat]
 fd=1
 group_fd=-1
+read_format=15
 
 [event-2:base-stat]
 fd=2
 group_fd=1
 config=1
 disabled=0
+read_format=15
 enable_on_exec=0
tools/perf/tests/attr/test-stat-group1 +2 -0
index 2a1f86e..086aa2f 100644
@@ -6,6 +6,7 @@ ret     = 1
 [event-1:base-stat]
 fd=1
 group_fd=-1
+read_format=15
 
 [event-2:base-stat]
 fd=2
@@ -13,3 +14,4 @@ group_fd=1
 config=1
 disabled=0
 enable_on_exec=0
+read_format=15
Signature · 1 line
2.9.3
#4 lore raw

PATCH 4/9 perf: test 15 add s390x support for stat test cases

In reply to Thomas Richter

The perf test 15 test cases test-stat-detailed[123] and test-stat-default fail for s390x.
The reason is missing support of the CPUMF facility for some of the test.

The tests are now marked optional. On s390x some of the individual tests still fail, but when marked as optional, do not cause the complete test to fail.

---
 tools/perf/tests/attr/test-stat-default    |  4 ++++
 tools/perf/tests/attr/test-stat-detailed-1 | 12 ++++++++++++
 tools/perf/tests/attr/test-stat-detailed-2 | 22 ++++++++++++++++++++++
 tools/perf/tests/attr/test-stat-detailed-3 | 22 ++++++++++++++++++++++
 4 files changed, 60 insertions(+)
tools/perf/tests/attr/test-stat-default +4 -0
index e911dbd..0dc3ef0 100644
@@ -54,13 +54,17 @@ type=0
 config=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+# Optional on s390x
 [event9:base-stat]
 fd=9
 type=0
 config=4
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+# Optional on s390x
 [event10:base-stat]
 fd=10
 type=0
 config=5
+optional=1
tools/perf/tests/attr/test-stat-detailed-1 +12 -0
index b39270a..14ec910 100644
@@ -55,49 +55,61 @@ type=0
 config=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+# Optional on s390x
 [event9:base-stat]
 fd=9
 type=0
 config=4
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+# Optional on s390x
 [event10:base-stat]
 fd=10
 type=0
 config=5
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event11:base-stat]
 fd=11
 type=3
 config=0
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event12:base-stat]
 fd=12
 type=3
 config=65536
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_LL                 <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event13:base-stat]
 fd=13
 type=3
 config=2
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_LL                 <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event14:base-stat]
 fd=14
 type=3
 config=65538
+optional=1
tools/perf/tests/attr/test-stat-detailed-2 +22 -0
index 45f8e6e..763e2f0 100644
@@ -55,52 +55,64 @@ type=0
 config=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+# Optional on s390x
 [event9:base-stat]
 fd=9
 type=0
 config=4
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+# Optional on s390x
 [event10:base-stat]
 fd=10
 type=0
 config=5
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event11:base-stat]
 fd=11
 type=3
 config=0
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event12:base-stat]
 fd=12
 type=3
 config=65536
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_LL                 <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event13:base-stat]
 fd=13
 type=3
 config=2
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_LL                 <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event14:base-stat]
 fd=14
 type=3
 config=65538
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
@@ -116,43 +128,53 @@ optional=1
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event16:base-stat]
 fd=16
 type=3
 config=65537
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_DTLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event17:base-stat]
 fd=17
 type=3
 config=3
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_DTLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event18:base-stat]
 fd=18
 type=3
 config=65539
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_ITLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event19:base-stat]
 fd=19
 type=3
 config=4
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_ITLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event20:base-stat]
 fd=20
 type=3
 config=65540
+optional=1
tools/perf/tests/attr/test-stat-detailed-3 +22 -0
index 30ae0fb..5ed7ce6 100644
@@ -55,52 +55,64 @@ type=0
 config=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_INSTRUCTIONS
+# Optional on s390x
 [event9:base-stat]
 fd=9
 type=0
 config=4
+optional=1
 
 # PERF_TYPE_HARDWARE / PERF_COUNT_HW_BRANCH_MISSES
+# Optional on s390x
 [event10:base-stat]
 fd=10
 type=0
 config=5
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event11:base-stat]
 fd=11
 type=3
 config=0
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event12:base-stat]
 fd=12
 type=3
 config=65536
+optional=1
 
 # PERF_TYPE_HW_CACHE /
 #  PERF_COUNT_HW_CACHE_LL                 <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event13:base-stat]
 fd=13
 type=3
 config=2
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_LL                 <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event14:base-stat]
 fd=14
 type=3
 config=65538
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
@@ -116,46 +128,56 @@ optional=1
 #  PERF_COUNT_HW_CACHE_L1I                <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event16:base-stat]
 fd=16
 type=3
 config=65537
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_DTLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event17:base-stat]
 fd=17
 type=3
 config=3
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_DTLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event18:base-stat]
 fd=18
 type=3
 config=65539
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_ITLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_ACCESS      << 16)
+# Optional on s390x
 [event19:base-stat]
 fd=19
 type=3
 config=4
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_ITLB               <<  0  |
 # (PERF_COUNT_HW_CACHE_OP_READ            <<  8) |
 # (PERF_COUNT_HW_CACHE_RESULT_MISS        << 16)
+# Optional on s390x
 [event20:base-stat]
 fd=20
 type=3
 config=65540
+optional=1
 
 # PERF_TYPE_HW_CACHE,
 #  PERF_COUNT_HW_CACHE_L1D                <<  0  |
Signature · 1 line
2.9.3
#7 lore raw

PATCH 5/9 perf test 15: disable test-record-group tests on s390x

In reply to Thomas Richter

On s390x the CPUMF supports sampling of only one hardware event, namely cycles. There grouping of multiple hardware events is not supported.
Disable these tests for s390x.

---
 tools/perf/tests/attr/test-record-group          | 1 +
 tools/perf/tests/attr/test-record-group-sampling | 1 +
 tools/perf/tests/attr/test-record-group1         | 1 +
 3 files changed, 3 insertions(+)
tools/perf/tests/attr/test-record-group +1 -0
index 6e7961f..aa3885d 100644
@@ -2,6 +2,7 @@
 command = record
 args    = --group -e cycles,instructions kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event-1:base-record]
 fd=1
tools/perf/tests/attr/test-record-group-sampling +1 -0
index ef59afd..332dc28 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -e '{cycles,cache-misses}:S' kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event-1:base-record]
 fd=1
tools/perf/tests/attr/test-record-group1 +1 -0
index 87a222d..1f5359d 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -e '{cycles,instructions}' kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event-1:base-record]
 fd=1
Signature · 1 line
2.9.3
#8 lore raw

PATCH 6/9 perf test 15: disable test-record-filter tests on s390x

In reply to Thomas Richter

On s390x the CPUMF does not support sampling of branch events. Disable these tests for s390x.

---
 tools/perf/tests/attr/test-record-branch-any             | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any      | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any_call | 1 +
 tools/perf/tests/attr/test-record-branch-filter-any_ret  | 1 +
 tools/perf/tests/attr/test-record-branch-filter-hv       | 1 +
 tools/perf/tests/attr/test-record-branch-filter-ind_call | 1 +
 tools/perf/tests/attr/test-record-branch-filter-k        | 1 +
 tools/perf/tests/attr/test-record-branch-filter-u        | 1 +
 8 files changed, 8 insertions(+)
tools/perf/tests/attr/test-record-branch-any +1 -0
index 81f839e..348bd18 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -b kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-any +1 -0
index 357421f..a99e743 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j any kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-any_call +1 -0
index dbc55f2..bb13ebe 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j any_call kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-any_ret +1 -0
index a0824ff..9d21181 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j any_ret kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-hv +1 -0
index f34d6f1..c1c412d 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j hv kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-ind_call +1 -0
index b86a352..187fa31 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j ind_call kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-k +1 -0
index d3fbc5e..236a2b0 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j k kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
tools/perf/tests/attr/test-record-branch-filter-u +1 -0
index a318f0d..518c823 100644
@@ -2,6 +2,7 @@
 command = record
 args    = -j u kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=2311
Signature · 1 line
2.9.3
#9 lore raw

PATCH 7/9 perf test 15: disable test-record-graph-dwarf test on s390x

In reply to Thomas Richter

There is currently no stack unwinding support for dwarf in the perf s390x architecture dependend code. Disable this test for s390x.

---
 tools/perf/tests/attr/test-record-graph-dwarf | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/tests/attr/test-record-graph-dwarf +2 -0
index da2fa73..c7a22d8 100644
@@ -2,6 +2,7 @@
 command = record
 args    = --call-graph dwarf -- kill >/dev/null 2>&1
 ret     = 1
+arch	= !s390x
 
 [event:base-record]
 sample_type=45359
@@ -10,3 +11,4 @@ sample_stack_user=8192
 # TODO different for each arch, no support for that now
 sample_regs_user=*
 mmap_data=1
+task=1
Signature · 1 line
2.9.3
#10 lore raw

PATCH 8/9 perf: test 15 change period and frequency for s390x

In reply to Thomas Richter

The perf record command can specify sampling period and frequency. For s390x both values are too slow and needs to be increased. On s390x there is a minimum value and when the specified command line value is too low, the perf_event_system call fails.
I have successfully tested these new values on Intel.

---
 tools/perf/tests/attr/test-record-count  | 4 ++--
 tools/perf/tests/attr/test-record-period | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/tests/attr/test-record-count +2 -2
index 34f6cc5..34788fe 100644
@@ -1,9 +1,9 @@
 [config]
 command = record
-args    = -c 123 kill >/dev/null 2>&1
+args    = -c 100000 kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=123
+sample_period=100000
 sample_type=7
 freq=0
tools/perf/tests/attr/test-record-period +2 -2
index 69bc748..6b53250 100644
@@ -1,8 +1,8 @@
 [config]
 command = record
-args    = -c 100 -P kill >/dev/null 2>&1
+args    = -c 100000 -P kill >/dev/null 2>&1
 ret     = 1
 
 [event:base-record]
-sample_period=100
+sample_period=100000
 freq=0
Signature · 1 line
2.9.3
#11 lore raw

PATCH 9/9 perf: test 15 fix expected task value.

In reply to Thomas Richter

Running perf test 15 (event attr test) the expected value for task is 1. This can be seen with:

[root@oc2666213455 ~]# perf record -vv -b -- sleep 1
------------------------------------------------------------
perf_event_attr:

  size                             104
  { sample_period, sample_freq }   4000
  sample_type                      IP|TID|TIME|PERIOD|BRANCH_STACK
  disabled                         1
  inherit                          1
  mmap                             1
  comm                             1
  freq                             1
  enable_on_exec                   1
  task                             1
  sample_id_all                    1
  exclude_guest                    1
  mmap2                            1
  comm_exec                        1

------------------------------------------------------------
[...]

Change the expected task value from 0 to 1 in the base-record file to match the correct results and report success for the test-record-* test cases.

---
 tools/perf/tests/attr/base-record | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/attr/base-record +1 -1
index 31e0b1d..3794066 100644
@@ -23,7 +23,7 @@ comm=1
 freq=1
 inherit_stat=0
 enable_on_exec=1
-task=0
+task=1
 watermark=0
 precise_ip=0|1|2|3
 mmap_data=0
Signature · 1 line
2.9.3
#13 lore raw
In reply to Thomas Richter
Quoted 6 lines · Thomas Richter

Commit d78ada4a767 ("perf tests attr: Do not store failed events") does not create an event file in the /tmp directory when the perf_open_event() system call failed.
This can lead to a situation where not /tmp/event-xx-yy-zz result file exists at all (for example on a s390x virtual machine environment) where no CPUMF hardware is available.

hi,
what's this patchset based on? I got 2nd patch failing to apply:

Applying: perf: test 15 fix python error on empty result
Applying: perf test: perf test case 15 result ignored
error: patch failed: tools/perf/tests/attr.c:166
error: tools/perf/tests/attr.c: patch does not apply Patch failed at 0002 perf test: perf test case 15 result ignored

any chance you have this on a git repo somewhere?

thanks,
jirka

#14 lore raw
Quoted 17 lines · Jiri Olsa
Quoted 6 lines · Thomas Richter

Commit d78ada4a767 ("perf tests attr: Do not store failed events") does not create an event file in the /tmp directory when the perf_open_event() system call failed.
This can lead to a situation where not /tmp/event-xx-yy-zz result file exists at all (for example on a s390x virtual machine environment) where no CPUMF hardware is available.

hi,
what's this patchset based on? I got 2nd patch failing to apply:

Applying: perf: test 15 fix python error on empty result
Applying: perf test: perf test case 15 result ignored
error: patch failed: tools/perf/tests/attr.c:166
error: tools/perf/tests/attr.c: patch does not apply Patch failed at 0002 perf test: perf test case 15 result ignored

Quoted 4 lines

any chance you have this on a git repo somewhere?

thanks,
jirka

Hi,

I have cloned branch perf/core from

url = git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

dated 27-July-2017 and last commit before my 9 patches is 6b7007a perf data: Add doc when no conversion support compiled

I have no git repository to clone from. But I can rebase the patches on the latest level and can send them again.

Thanks.

Signature · 5 lines
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
#12 lore raw

Re: [PATCH 9/9] perf: test 15 fix expected task value.

In reply to Thomas Richter
Quoted 2 lines · Thomas Richter

Running perf test 15 (event attr test) the expected value for task is 1. This can be seen with:

I just sent email to Arnaldo (you're in CC), fix for this was already posted

jirka

Quoted 46 lines

[root@oc2666213455 ~]# perf record -vv -b -- sleep 1
------------------------------------------------------------
perf_event_attr:

  size                             104
  { sample_period, sample_freq }   4000
  sample_type                      IP|TID|TIME|PERIOD|BRANCH_STACK
  disabled                         1
  inherit                          1
  mmap                             1
  comm                             1
  freq                             1
  enable_on_exec                   1
  task                             1
  sample_id_all                    1
  exclude_guest                    1
  mmap2                            1
  comm_exec                        1

------------------------------------------------------------
[...]

Change the expected task value from 0 to 1 in the base-record file to match the correct results and report success for the test-record-* test cases.

---
 tools/perf/tests/attr/base-record | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/attr/base-record +1 -1
index 31e0b1d..3794066 100644
@@ -23,7 +23,7 @@ comm=1
 freq=1
 inherit_stat=0
 enable_on_exec=1
-task=0
+task=1
 watermark=0
 precise_ip=0|1|2|3
 mmap_data=0
Signature · 1 line
2.9.3
#3 lore raw

Re: [PATCH 3/9] perf: test 15 fix test-stat-group tests

In reply to Thomas Richter
Quoted 20 lines · Thomas Richter

Both test-stat-group and test-stat-group1 fail. The reason is an invalid check for the read_format return code. The submitted value is 15 and this value should be returned by the perf_event_open() call (which it is).
The comparison however is done against an invalid value of 3.
Fix this by setting the expected read_format value.

---
 tools/perf/tests/attr/test-stat-group  | 2 ++
 tools/perf/tests/attr/test-stat-group1 | 2 ++
 2 files changed, 4 insertions(+)
tools/perf/tests/attr/test-stat-group +0 -0
index fdc1596..8fb3a50 100644

tools/perf/tests/attr/test-stat-group ret = 1 · line 9

Quoted 4 lines
tools/perf/tests/attr/test-stat-group +1 -0
@@ -6,10 +6,12 @@ ret     = 1
 [event-1:base-stat]
 fd=1
 group_fd=-1
+read_format=15

I suppose this is on new kernel, which now support group read it still passes on mine which doesn't supprot that ;-)

the fix needs to allow both values, so it works on older kernels, like:

read_format=3|15

thanks,
jirka

#5 lore raw

Re: [PATCH 4/9] perf: test 15 add s390x support for stat test cases

In reply to Thomas Richter
Quoted 8 lines · Thomas Richter

The perf test 15 test cases test-stat-detailed[123] and test-stat-default fail for s390x.
The reason is missing support of the CPUMF facility for some of the test.

The tests are now marked optional. On s390x some of the individual tests still fail, but when marked as optional, do not cause the complete test to fail.

hum I wonder we should switch the optional keyword with that arch support you introduced recently.. this way we 'disable' those tests for other archs

jirka

#6 lore raw

Re: [PATCH 4/9] perf: test 15 add s390x support for stat test cases

Quoted 6 lines · Jiri Olsa
Quoted 5 lines · Thomas Richter

The perf test 15 test cases test-stat-detailed[123] and test-stat-default fail for s390x.
The reason is missing support of the CPUMF facility for some of the test.

Quoted 7 lines
Quoted 3 lines

The tests are now marked optional. On s390x some of the individual tests still fail, but when marked as optional, do not cause the complete test to fail.

hum I wonder we should switch the optional keyword with that arch support you introduced recently.. this way we 'disable' those tests for other archs

This is correct.
Using the arch support requires several test case files. So we would have file
tools/perf/tests/attr/test-stat-default
with an arch = !s390x statement for all arch's that support it and another fle
tools/perf/tests/attr/test-stat-default-s390x
with an arch = s390x statement for 390x.

I am fine with this approach. If we all agree I can change the patch and resend it.

Thanks Thomas