Skip to content

Commit

Permalink
selftests/bpf: check insn processed in test_verifier
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexei Starovoitov authored and borkmann committed Dec 15, 2018
1 parent b233920 commit 730ff40
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/testing/selftests/bpf/test_verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 730ff40

Please sign in to comment.