Re: [PATCH bpf-next 06/12] selftests/bpf: Fix selftests failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 1, 2022 at 12:00 PM Yonghong Song <yhs@xxxxxx> wrote:
>
> The kflag is supported now for BTF_KIND_ENUM.
> So remove the test which tests verifier failure
> due to existence of kflag.
>
> With enum64 support in kernel and libbpf,
> selftest btf_dump/btf_dump failed with
> no-enum64 support llvm for the following
> enum definition:
>  enum e2 {
>         C = 100,
>         D = 4294967295,
>         E = 0,
>  };
>
> With the no-enum64 support llvm, the signedness is
> 'signed' by default, and D (4294967295 = 0xffffffff)
> will print as -1. With enum64 support llvm, the signedness
> is 'unsigned' and the value of D will print as 4294967295.
> To support both old and new compilers, this patch
> changed the value to 268435455 = 0xfffffff which works
> with both enum64 or non-enum64 support llvm.
>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---
>  tools/testing/selftests/bpf/prog_tests/btf.c  | 20 -------------------
>  .../bpf/progs/btf_dump_test_case_syntax.c     |  2 +-
>  2 files changed, 1 insertion(+), 21 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c
> index ba5bde53d418..8e068e06b3e8 100644
> --- a/tools/testing/selftests/bpf/prog_tests/btf.c
> +++ b/tools/testing/selftests/bpf/prog_tests/btf.c
> @@ -2896,26 +2896,6 @@ static struct btf_raw_test raw_tests[] = {
>         .err_str = "Invalid btf_info kind_flag",
>  },
>
> -{
> -       .descr = "invalid enum kind_flag",
> -       .raw_types = {
> -               BTF_TYPE_INT_ENC(0, BTF_INT_SIGNED, 0, 32, 4),          /* [1] */
> -               BTF_TYPE_ENC(0, BTF_INFO_ENC(BTF_KIND_ENUM, 1, 1), 4),  /* [2] */
> -               BTF_ENUM_ENC(NAME_TBD, 0),
> -               BTF_END_RAW,
> -       },
> -       BTF_STR_SEC("\0A"),
> -       .map_type = BPF_MAP_TYPE_ARRAY,
> -       .map_name = "enum_type_check_btf",
> -       .key_size = sizeof(int),
> -       .value_size = sizeof(int),
> -       .key_type_id = 1,
> -       .value_type_id = 1,
> -       .max_entries = 4,
> -       .btf_load_err = true,
> -       .err_str = "Invalid btf_info kind_flag",
> -},
> -
>  {
>         .descr = "valid fwd kind_flag",
>         .raw_types = {
> diff --git a/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c b/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c
> index 1c7105fcae3c..4068cea4be53 100644
> --- a/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c
> +++ b/tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c
> @@ -13,7 +13,7 @@ enum e1 {
>
>  enum e2 {
>         C = 100,
> -       D = 4294967295,
> +       D = 268435455,
>         E = 0,
>  };

can you please also add btf_dump tests for >32-bit enums at the same
time? Both signed and unsigned?


>
> --
> 2.30.2
>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux