[bpf-next v3 06/12] selftests/bpf: Make sure that preexisting tests for perf event work

From: Krzesimir Nowak
Date: Mon Jul 08 2019 - 12:32:39 EST


We are going to introduce a test run implementation for perf event in
a later commit and it will not allow passing any data out or ctx out
to it, and requires their sizes to be specified to zero. To avoid test
failures when the feature is introduced, override the data out size to
zero. That will also cause NULL buffer to be sent to the kernel.

Signed-off-by: Krzesimir Nowak <krzesimir@xxxxxxxxxx>
---
.../testing/selftests/bpf/verifier/perf_event_sample_period.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/bpf/verifier/perf_event_sample_period.c b/tools/testing/selftests/bpf/verifier/perf_event_sample_period.c
index 471c1a5950d8..19f5d824b275 100644
--- a/tools/testing/selftests/bpf/verifier/perf_event_sample_period.c
+++ b/tools/testing/selftests/bpf/verifier/perf_event_sample_period.c
@@ -13,6 +13,7 @@
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_PERF_EVENT,
+ .override_data_out_len = true,
},
{
"check bpf_perf_event_data->sample_period half load permitted",
@@ -29,6 +30,7 @@
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_PERF_EVENT,
+ .override_data_out_len = true,
},
{
"check bpf_perf_event_data->sample_period word load permitted",
@@ -45,6 +47,7 @@
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_PERF_EVENT,
+ .override_data_out_len = true,
},
{
"check bpf_perf_event_data->sample_period dword load permitted",
@@ -56,4 +59,5 @@
},
.result = ACCEPT,
.prog_type = BPF_PROG_TYPE_PERF_EVENT,
+ .override_data_out_len = true,
},
--
2.20.1