selftests/bpf: allow BTF specs and func infos in test_verifier tests
authorEduard Zingerman <eddyz87@gmail.com>
Mon, 20 Jun 2022 23:53:41 +0000 (02:53 +0300)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Jun 2022 00:40:51 +0000 (17:40 -0700)
commit7a42008ca5c700819e4b3003025e5e1695fd1f86
tree54db99e20fe60b2de5383c0e517fafc26be04745
parent933ff53191eb7a8492370bad6339a1ca6da2d939
selftests/bpf: allow BTF specs and func infos in test_verifier tests

The BTF and func_info specification for test_verifier tests follows
the same notation as in prog_tests/btf.c tests. E.g.:

  ...
  .func_info = { { 0, 6 }, { 8, 7 } },
  .func_info_cnt = 2,
  .btf_strings = "\0int\0",
  .btf_types = {
    BTF_TYPE_INT_ENC(1, BTF_INT_SIGNED, 0, 32, 4),
    BTF_PTR_ENC(1),
  },
  ...

The BTF specification is loaded only when specified.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/r/20220620235344.569325-3-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/btf.c
tools/testing/selftests/bpf/test_btf.h
tools/testing/selftests/bpf/test_verifier.c