summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2018-12-05 17:35:47 -0800
committerAlexei Starovoitov <ast@kernel.org>2018-12-05 18:48:40 -0800
commit84ecc1f98ca7ce28ede9bc5cc70a557fdfa09caa (patch)
treed1b34c120c66dd799428ca4e61bf8ed710f4ae3e /tools/testing
parent555249df711b146a2898949ac80503be29fe7340 (diff)
bpf: Expect !info.func_info and insn_off name changes in test_btf/libbpf/bpftool
Similar to info.jited_*, info.func_info could be 0 if bpf_dump_raw_ok() == false. This patch makes changes to test_btf and bpftool to expect info.func_info could be 0. This patch also makes the needed changes for s/insn_offset/insn_off/. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/bpf/test_btf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
index bae7308b7ec5..ff0952ea757a 100644
--- a/tools/testing/selftests/bpf/test_btf.c
+++ b/tools/testing/selftests/bpf/test_btf.c
@@ -3156,7 +3156,7 @@ static struct btf_func_type_test {
},
{
- .descr = "func_type (Incorrect bpf_func_info.insn_offset)",
+ .descr = "func_type (Incorrect bpf_func_info.insn_off)",
.raw_types = {
BTF_TYPE_INT_ENC(NAME_TBD, BTF_INT_SIGNED, 0, 32, 4), /* [1] */
BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 32, 4), /* [2] */
@@ -3303,6 +3303,12 @@ static int do_test_func_type(int test_num)
goto done;
}
+ if (CHECK(!info.func_info,
+ "info.func_info == 0. kernel.kptr_restrict is set?")) {
+ err = -1;
+ goto done;
+ }
+
finfo = func_info;
for (i = 0; i < 2; i++) {
if (CHECK(finfo->type_id != test->func_info[i][1],