@@ -76,6 +76,8 @@ struct bpf_test {
int fixup_percpu_cgroup_storage[MAX_FIXUPS];
const char *errstr;
const char *errstr_unpriv;
+ const char *infostr;
+ const char *infostr_unpriv;
uint32_t retval, retval_unpriv;
enum {
UNDEF,
@@ -14232,7 +14234,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
int prog_len, prog_type = test->prog_type;
struct bpf_insn *prog = test->insns;
int map_fds[MAX_NR_MAPS];
- const char *expected_err;
+ const char *expected_err, *expected_info;
uint32_t expected_val;
uint32_t retval;
int i, err;
@@ -14253,6 +14255,8 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
test->result_unpriv : test->result;
expected_err = unpriv && test->errstr_unpriv ?
test->errstr_unpriv : test->errstr;
+ expected_info = unpriv && test->infostr_unpriv ?
+ test->infostr_unpriv : test->infostr;
expected_val = unpriv && test->retval_unpriv ?
test->retval_unpriv : test->retval;
@@ -14272,6 +14276,11 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
strerror(errno));
goto fail_log;
}
+ if (expected_info && !strstr(bpf_vlog, expected_info)) {
+ printf("FAIL\nMissing expected info message!\n\tEXP: %s\n\tRES: %s\n",
+ expected_info, bpf_vlog);
+ goto fail_log;
+ }
} else {
if (fd_prog >= 0) {
printf("FAIL\nUnexpected success to load!\n");
This is needed to test that code is being patched when it should be. Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> --- tools/testing/selftests/bpf/test_verifier.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)