1 // SPDX-License-Identifier: GPL-2.0-only
3 #include <test_progs.h>
5 #include "cap_helpers.h"
6 #include "verifier_and.skel.h"
7 #include "verifier_array_access.skel.h"
8 #include "verifier_basic_stack.skel.h"
9 #include "verifier_bounds_deduction.skel.h"
10 #include "verifier_bounds_mix_sign_unsign.skel.h"
11 #include "verifier_cfg.skel.h"
12 #include "verifier_cgroup_inv_retcode.skel.h"
13 #include "verifier_cgroup_skb.skel.h"
16 static void run_tests_aux(const char *skel_name, skel_elf_bytes_fn elf_bytes_factory)
18 struct test_loader tester = {};
22 /* test_verifier tests are executed w/o CAP_SYS_ADMIN, do the same here */
23 err = cap_disable_effective(1ULL << CAP_SYS_ADMIN, &old_caps);
25 PRINT_FAIL("failed to drop CAP_SYS_ADMIN: %i, %s\n", err, strerror(err));
29 test_loader__run_subtests(&tester, skel_name, elf_bytes_factory);
30 test_loader_fini(&tester);
32 err = cap_enable_effective(old_caps, NULL);
34 PRINT_FAIL("failed to restore CAP_SYS_ADMIN: %i, %s\n", err, strerror(err));
37 #define RUN(skel) run_tests_aux(#skel, skel##__elf_bytes)
39 void test_verifier_and(void) { RUN(verifier_and); }
40 void test_verifier_array_access(void) { RUN(verifier_array_access); }
41 void test_verifier_basic_stack(void) { RUN(verifier_basic_stack); }
42 void test_verifier_bounds_deduction(void) { RUN(verifier_bounds_deduction); }
43 void test_verifier_bounds_mix_sign_unsign(void) { RUN(verifier_bounds_mix_sign_unsign); }
44 void test_verifier_cfg(void) { RUN(verifier_cfg); }
45 void test_verifier_cgroup_inv_retcode(void) { RUN(verifier_cgroup_inv_retcode); }
46 void test_verifier_cgroup_skb(void) { RUN(verifier_cgroup_skb); }