Re: [PATCH v8 bpf-next 2/2] selftests/bpf: add bpf_read_branch_records() selftest

From: Alexei Starovoitov
Date: Wed Feb 19 2020 - 18:03:52 EST


On Wed, Feb 19, 2020 at 2:47 PM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Mon, Feb 17, 2020 at 7:04 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
> >
> > Add a selftest to test:
> >
> > * default bpf_read_branch_records() behavior
> > * BPF_F_GET_BRANCH_RECORDS_SIZE flag behavior
> > * error path on non branch record perf events
> > * using helper to write to stack
> > * using helper to write to global
> >
> > On host with hardware counter support:
> >
> > # ./test_progs -t perf_branches
> > #27/1 perf_branches_hw:OK
> > #27/2 perf_branches_no_hw:OK
> > #27 perf_branches:OK
> > Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED
> >
> > On host without hardware counter support (VM):
> >
> > # ./test_progs -t perf_branches
> > #27/1 perf_branches_hw:OK
> > #27/2 perf_branches_no_hw:OK
> > #27 perf_branches:OK
> > Summary: 1/2 PASSED, 1 SKIPPED, 0 FAILED
>
> That's not what I see:
> ./test_progs -t perf_branches
> test_perf_branches_hw:FAIL:perf_event_open err -1
> #27/1 perf_branches_hw:FAIL
> #27/2 perf_branches_no_hw:OK
> #27 perf_branches:FAIL
> Summary: 0/1 PASSED, 0 SKIPPED, 2 FAILED
>
> I remember previous version used to work, but something changed.

Looks like the error code has changed.
I've added
if (errno == ENOENT || errno == EOPNOTSUPP)
and applied.
Please test your patches more carefully next time.