1 // SPDX-License-Identifier: GPL-2.0
3 #include <test_progs.h>
4 #include "test_hash_large_key.skel.h"
6 void test_hash_large_key(void)
8 int err
, value
= 21, duration
= 0, hash_map_fd
;
9 struct test_hash_large_key
*skel
;
16 bzero(&key
, sizeof(key
));
18 skel
= test_hash_large_key__open_and_load();
19 if (CHECK(!skel
, "skel_open_and_load", "skeleton open/load failed\n"))
22 hash_map_fd
= bpf_map__fd(skel
->maps
.hash_map
);
23 if (CHECK(hash_map_fd
< 0, "bpf_map__fd", "failed\n"))
26 err
= test_hash_large_key__attach(skel
);
27 if (CHECK(err
, "attach_raw_tp", "err %d\n", err
))
30 err
= bpf_map_update_elem(hash_map_fd
, &key
, &value
, BPF_ANY
);
31 if (CHECK(err
, "bpf_map_update_elem", "errno=%d\n", errno
))
35 err
= bpf_map_lookup_elem(hash_map_fd
, &key
, &value
);
36 if (CHECK(err
, "bpf_map_lookup_elem", "errno=%d\n", errno
))
39 CHECK_FAIL(value
!= 42);
42 test_hash_large_key__destroy(skel
);