On Tue, Jul 26, 2022 at 5:40 AM Jiri Olsa <olsajiri@xxxxxxxxx> wrote: > > On Mon, Jul 25, 2022 at 08:31:01AM +0100, Alan Maguire wrote: > > add tests that verify bpf_snprintf_btf() behaviour with strings that > > > > - exactly fit the buffer (string size + null terminator == buffer_size) > > - overrun the buffer (string size + null terminator == buffer size + 1) > > - overrun the buffer (string size + null terminator == buffer size + 2) > > > > These tests require [1] ("bpf: btf: Fix vsnprintf return value check") > > > > ...which has not landed yet. > > patch looks good, but I have the test passing even without [1], > it should fail, right? > > #151 snprintf_btf:OK > The way that test is structured it's essentially impossible to communicate a test failure back, as each subsequent test case overrides common ret variable, if I understand it correctly. Alan, can you please update the test to store results for each individual test case separately, e.g., in an array? Meanwhile I've applied that trivial fix from Fedor anyway. > jirka > > > > > [1] https://lore.kernel.org/bpf/20220711211317.GA1143610@laptop/ > > > > Suggested-by: Jiri Olsa <jolsa@xxxxxxxxxx> > > Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx> > > --- > > .../selftests/bpf/progs/netif_receive_skb.c | 41 ++++++++++++++++++++-- > > 1 file changed, 38 insertions(+), 3 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/progs/netif_receive_skb.c b/tools/testing/selftests/bpf/progs/netif_receive_skb.c > > index 1d8918d..9fc48e4 100644 > > --- a/tools/testing/selftests/bpf/progs/netif_receive_skb.c > > +++ b/tools/testing/selftests/bpf/progs/netif_receive_skb.c > > @@ -49,7 +49,7 @@ static int __strncmp(const void *m1, const void *m2, size_t len) > > } > > [...]