提交 8b26fd26 编写于 作者: M Martin KaFai Lau 提交者: Greg Kroah-Hartman

tools/bpf: fix two test_btf unit test cases

[ Upstream commit 8800cd031af085807028656c6ba7eb7908d78262 ]

There are two unit test cases, which should encode
TYPEDEF type, but instead encode PTR type.
The error is flagged out after enforcing name
checking in the previous patch.

Fixes: c0fa1b6c ("bpf: btf: Add BTF tests")
Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
Signed-off-by: NYonghong Song <yhs@fb.com>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 a58fb834
...@@ -431,11 +431,11 @@ static struct btf_raw_test raw_tests[] = { ...@@ -431,11 +431,11 @@ static struct btf_raw_test raw_tests[] = {
/* const void* */ /* [3] */ /* const void* */ /* [3] */
BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 2), BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 2),
/* typedef const void * const_void_ptr */ /* typedef const void * const_void_ptr */
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 3), BTF_TYPEDEF_ENC(NAME_TBD, 3), /* [4] */
/* struct A { */ /* [4] */ /* struct A { */ /* [5] */
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), sizeof(void *)), BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_STRUCT, 0, 1), sizeof(void *)),
/* const_void_ptr m; */ /* const_void_ptr m; */
BTF_MEMBER_ENC(NAME_TBD, 3, 0), BTF_MEMBER_ENC(NAME_TBD, 4, 0),
/* } */ /* } */
BTF_END_RAW, BTF_END_RAW,
}, },
...@@ -493,10 +493,10 @@ static struct btf_raw_test raw_tests[] = { ...@@ -493,10 +493,10 @@ static struct btf_raw_test raw_tests[] = {
BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 0), BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_CONST, 0, 0), 0),
/* const void* */ /* [3] */ /* const void* */ /* [3] */
BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 2), BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 2),
/* typedef const void * const_void_ptr */ /* [4] */ /* typedef const void * const_void_ptr */
BTF_TYPE_ENC(NAME_TBD, BTF_INFO_ENC(BTF_KIND_PTR, 0, 0), 3), BTF_TYPEDEF_ENC(NAME_TBD, 3), /* [4] */
/* const_void_ptr[4] */ /* [5] */ /* const_void_ptr[4] */
BTF_TYPE_ARRAY_ENC(3, 1, 4), BTF_TYPE_ARRAY_ENC(4, 1, 4), /* [5] */
BTF_END_RAW, BTF_END_RAW,
}, },
.str_sec = "\0const_void_ptr", .str_sec = "\0const_void_ptr",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册