]> granicus.if.org Git - strace/commitdiff
tests: add checks for bpf BPF_MAP_CREATE arguments
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sun, 25 Mar 2018 10:27:28 +0000 (12:27 +0200)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 12 Apr 2018 23:00:28 +0000 (23:00 +0000)
* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.

tests/bpf.c

index 35dc00e668e9df1c5f62fe554406a54e9ec4563e..59044512c972e3e93000400f6b0912770a80efe0 100644 (file)
@@ -240,22 +240,59 @@ static const struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
                .str = "map_type=BPF_MAP_TYPE_ARRAY, key_size=0, value_size=0"
                       ", max_entries=0, map_flags=0, inner_map_fd=0"
        },
-       {
+       { /* 1 */
                .data = { .BPF_MAP_CREATE_data = {
-                       .map_type = 1,
+                       .map_type = 16,
                        .key_size = 4,
                        .value_size = 8,
                        .max_entries = 256,
                        .map_flags = 7,
                        .inner_map_fd = -1,
-                       .numa_node = 42
+                       .numa_node = 3141592653,
                } },
                .size = offsetofend(struct BPF_MAP_CREATE_struct, numa_node),
-               .str = "map_type=BPF_MAP_TYPE_HASH, key_size=4"
+               .str = "map_type=BPF_MAP_TYPE_CPUMAP, key_size=4"
                       ", value_size=8, max_entries=256"
                       ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NO_COMMON_LRU"
-                      "|BPF_F_NUMA_NODE, inner_map_fd=-1, numa_node=42"
-       }
+                      "|BPF_F_NUMA_NODE, inner_map_fd=-1"
+                      ", numa_node=3141592653",
+       },
+       { /* 2 */
+               .data = { .BPF_MAP_CREATE_data = {
+                       .map_type = 17,
+                       .key_size = 0xface1e55,
+                       .value_size = 0xbadc0ded,
+                       .max_entries = 0xbeefcafe,
+                       .map_flags = 0xfffffff8,
+                       .inner_map_fd = 2718281828,
+                       .numa_node = -1,
+               } },
+               .size = offsetofend(struct BPF_MAP_CREATE_struct, numa_node),
+               .str = "map_type=0x11 /* BPF_MAP_TYPE_??? */"
+                      ", key_size=4207812181, value_size=3134983661"
+                      ", max_entries=3203386110"
+                      ", map_flags=0xfffffff8 /* BPF_F_??? */"
+                      ", inner_map_fd=-1576685468",
+       },
+       { /* 3 */
+               .data = { .BPF_MAP_CREATE_data = {
+                       .map_type = 0xdeadf00d,
+                       .key_size = 0xface1e55,
+                       .value_size = 0xbadc0ded,
+                       .max_entries = 0xbeefcafe,
+                       .map_flags = 0xc0dedead,
+                       .inner_map_fd = 2718281828,
+                       .numa_node = -1,
+               } },
+               .size = offsetofend(struct BPF_MAP_CREATE_struct, numa_node),
+               .str = "map_type=0xdeadf00d /* BPF_MAP_TYPE_??? */"
+                      ", key_size=4207812181, value_size=3134983661"
+                      ", max_entries=3203386110"
+                      ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NUMA_NODE"
+                                  "|0xc0dedea8"
+                      ", inner_map_fd=-1576685468"
+                      ", numa_node=4294967295 /* NUMA_NO_NODE */",
+       },
 };
 
 static const struct bpf_attr_check BPF_MAP_LOOKUP_ELEM_checks[] = {