diff options
author | Yonghong Song <yhs@fb.com> | 2022-10-25 21:29:06 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-10-25 23:19:19 -0700 |
commit | fd4ca6c1facfdc370d5f0b798106d07433e33aec (patch) | |
tree | af9fa6b945b95d9184b662acb9163c78d7b4fb8e /tools/testing/selftests/bpf/prog_tests/libbpf_str.c | |
parent | f7f0f1657d9552e8667bc4758cbf41909bcdf7e2 (diff) | |
download | linux-fd4ca6c1facfdc370d5f0b798106d07433e33aec.tar.gz linux-fd4ca6c1facfdc370d5f0b798106d07433e33aec.tar.bz2 linux-fd4ca6c1facfdc370d5f0b798106d07433e33aec.zip |
selftests/bpf: Fix test test_libbpf_str/bpf_map_type_str
Previous bpf patch made a change to uapi bpf.h like
@@ -922,7 +922,14 @@ enum bpf_map_type {
BPF_MAP_TYPE_SOCKHASH,
- BPF_MAP_TYPE_CGROUP_STORAGE,
+ BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
+ BPF_MAP_TYPE_CGROUP_STORAGE = BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED,
BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
where BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED and BPF_MAP_TYPE_CGROUP_STORAGE
have the same enum value. This will cause selftest test_libbpf_str/bpf_map_type_str
failing. This patch fixed the issue by avoid the check for
BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED in the test.
Signed-off-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20221026042906.674830-1-yhs@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/libbpf_str.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/libbpf_str.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/libbpf_str.c b/tools/testing/selftests/bpf/prog_tests/libbpf_str.c index 93e9cddaadcf..efb8bd43653c 100644 --- a/tools/testing/selftests/bpf/prog_tests/libbpf_str.c +++ b/tools/testing/selftests/bpf/prog_tests/libbpf_str.c @@ -139,6 +139,14 @@ static void test_libbpf_bpf_map_type_str(void) snprintf(buf, sizeof(buf), "BPF_MAP_TYPE_%s", map_type_str); uppercase(buf); + /* Special case for map_type_name BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED + * where it and BPF_MAP_TYPE_CGROUP_STORAGE have the same enum value + * (map_type). For this enum value, libbpf_bpf_map_type_str() picks + * BPF_MAP_TYPE_CGROUP_STORAGE. + */ + if (strcmp(map_type_name, "BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED") == 0) + continue; + ASSERT_STREQ(buf, map_type_name, "exp_str_value"); } |