Skip to content

Commit 730ff40

Browse files
Alexei Starovoitovborkmann
authored andcommitted
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>
1 parent b233920 commit 730ff40

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tools/testing/selftests/bpf/test_verifier.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct bpf_test {
7676
int fixup_percpu_cgroup_storage[MAX_FIXUPS];
7777
const char *errstr;
7878
const char *errstr_unpriv;
79-
uint32_t retval, retval_unpriv;
79+
uint32_t retval, retval_unpriv, insn_processed;
8080
enum {
8181
UNDEF,
8282
ACCEPT,
@@ -14444,6 +14444,19 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
1444414444
}
1444514445
}
1444614446

14447+
if (test->insn_processed) {
14448+
uint32_t insn_processed;
14449+
char *proc;
14450+
14451+
proc = strstr(bpf_vlog, "processed ");
14452+
insn_processed = atoi(proc + 10);
14453+
if (test->insn_processed != insn_processed) {
14454+
printf("FAIL\nUnexpected insn_processed %u vs %u\n",
14455+
insn_processed, test->insn_processed);
14456+
goto fail_log;
14457+
}
14458+
}
14459+
1444714460
if (fd_prog >= 0) {
1444814461
__u8 tmp[TEST_DATA_LEN << 2];
1444914462
__u32 size_tmp = sizeof(tmp);

0 commit comments

Comments
 (0)