diff options
author | Alexei Starovoitov <ast@kernel.org> | 2018-12-13 11:42:32 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-12-15 01:28:32 +0100 |
commit | 730ff40f80c5b09b2402958321f2762a3f852e30 (patch) | |
tree | 8f9343d755afbcef24f6761aaae75a5919a654c1 /tools | |
parent | b233920c97a6201eb47fbafd78365c6946e6d7b6 (diff) | |
download | linux-stable-730ff40f80c5b09b2402958321f2762a3f852e30.tar.gz linux-stable-730ff40f80c5b09b2402958321f2762a3f852e30.tar.bz2 linux-stable-730ff40f80c5b09b2402958321f2762a3f852e30.zip |
selftests/bpf: check insn processed in test_verifier
Teach test_verifier to parse verifier output for insn processed
and compare with expected number.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Edward Cree <ecree@solarflare.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/bpf/test_verifier.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index a08c67c8767e..82359cdbc805 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c @@ -76,7 +76,7 @@ struct bpf_test { int fixup_percpu_cgroup_storage[MAX_FIXUPS]; const char *errstr; const char *errstr_unpriv; - uint32_t retval, retval_unpriv; + uint32_t retval, retval_unpriv, insn_processed; enum { UNDEF, ACCEPT, @@ -14444,6 +14444,19 @@ static void do_test_single(struct bpf_test *test, bool unpriv, } } + if (test->insn_processed) { + uint32_t insn_processed; + char *proc; + + proc = strstr(bpf_vlog, "processed "); + insn_processed = atoi(proc + 10); + if (test->insn_processed != insn_processed) { + printf("FAIL\nUnexpected insn_processed %u vs %u\n", + insn_processed, test->insn_processed); + goto fail_log; + } + } + if (fd_prog >= 0) { __u8 tmp[TEST_DATA_LEN << 2]; __u32 size_tmp = sizeof(tmp); |