[PATCH v12 1/8] perf tests: Skip backward ring buffer on old kernel

From: Wang Nan
Date: Thu Jun 30 2016 - 22:27:25 EST


From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

'perf test backward' FAILED on old kernel:

[root@jouet ~]# perf test -v backward
45: Test backward reading from ring buffer :
--- start ---
<SNIP>
mmap size 1052672B
Unexpected counter: sample_count=0, comm_count=0
---- end ----
Test backward reading from ring buffer: FAILED!
[root@jouet ~]#

Reason: when kernel doesn't support 'attr.backward', perf_evsel__open() will
trim this bit and try again, unless evsel->overwrite is true.

Set evsel->overwrite in this test.

Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/tests/backward-ring-buffer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index e70313f..0731b0b 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -118,8 +118,10 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
perf_evlist__config(evlist, &opts, NULL);

/* Set backward bit, ring buffer should be writing from end */
- evlist__for_each_entry(evlist, evsel)
+ evlist__for_each_entry(evlist, evsel) {
+ evsel->overwrite = true;
evsel->attr.write_backward = 1;
+ }

err = perf_evlist__open(evlist);
if (err < 0) {
--
1.8.3.4