Lines Matching refs:test

617 static void do_test_fixup(struct bpf_test *test, enum bpf_prog_type prog_type,  in do_test_fixup()  argument
620 int *fixup_map_hash_8b = test->fixup_map_hash_8b; in do_test_fixup()
621 int *fixup_map_hash_48b = test->fixup_map_hash_48b; in do_test_fixup()
622 int *fixup_map_hash_16b = test->fixup_map_hash_16b; in do_test_fixup()
623 int *fixup_map_array_48b = test->fixup_map_array_48b; in do_test_fixup()
624 int *fixup_map_sockmap = test->fixup_map_sockmap; in do_test_fixup()
625 int *fixup_map_sockhash = test->fixup_map_sockhash; in do_test_fixup()
626 int *fixup_map_xskmap = test->fixup_map_xskmap; in do_test_fixup()
627 int *fixup_map_stacktrace = test->fixup_map_stacktrace; in do_test_fixup()
628 int *fixup_prog1 = test->fixup_prog1; in do_test_fixup()
629 int *fixup_prog2 = test->fixup_prog2; in do_test_fixup()
630 int *fixup_map_in_map = test->fixup_map_in_map; in do_test_fixup()
631 int *fixup_cgroup_storage = test->fixup_cgroup_storage; in do_test_fixup()
632 int *fixup_percpu_cgroup_storage = test->fixup_percpu_cgroup_storage; in do_test_fixup()
633 int *fixup_map_spin_lock = test->fixup_map_spin_lock; in do_test_fixup()
634 int *fixup_map_array_ro = test->fixup_map_array_ro; in do_test_fixup()
635 int *fixup_map_array_wo = test->fixup_map_array_wo; in do_test_fixup()
636 int *fixup_map_array_small = test->fixup_map_array_small; in do_test_fixup()
637 int *fixup_sk_storage_map = test->fixup_sk_storage_map; in do_test_fixup()
638 int *fixup_map_event_output = test->fixup_map_event_output; in do_test_fixup()
640 if (test->fill_helper) { in do_test_fixup()
641 test->fill_insns = calloc(MAX_TEST_INSNS, sizeof(struct bpf_insn)); in do_test_fixup()
642 test->fill_helper(test); in do_test_fixup()
894 static void do_test_single(struct bpf_test *test, bool unpriv, in do_test_single() argument
898 int prog_len, prog_type = test->prog_type; in do_test_single()
899 struct bpf_insn *prog = test->insns; in do_test_single()
914 do_test_fixup(test, prog_type, prog, map_fds); in do_test_single()
915 if (test->fill_insns) { in do_test_single()
916 prog = test->fill_insns; in do_test_single()
917 prog_len = test->prog_len; in do_test_single()
928 if (test->flags & F_LOAD_WITH_STRICT_ALIGNMENT) in do_test_single()
930 if (test->flags & F_NEEDS_EFFICIENT_UNALIGNED_ACCESS) in do_test_single()
932 if (test->flags & ~3) in do_test_single()
933 pflags |= test->flags; in do_test_single()
935 expected_ret = unpriv && test->result_unpriv != UNDEF ? in do_test_single()
936 test->result_unpriv : test->result; in do_test_single()
937 expected_err = unpriv && test->errstr_unpriv ? in do_test_single()
938 test->errstr_unpriv : test->errstr; in do_test_single()
941 attr.expected_attach_type = test->expected_attach_type; in do_test_single()
965 (test->flags & F_NEEDS_EFFICIENT_UNALIGNED_ACCESS)) in do_test_single()
983 if (test->insn_processed) { in do_test_single()
989 if (test->insn_processed != insn_processed) { in do_test_single()
991 insn_processed, test->insn_processed); in do_test_single()
1005 if (!test->runs) in do_test_single()
1006 test->runs = 1; in do_test_single()
1008 for (i = 0; i < test->runs; i++) { in do_test_single()
1009 if (unpriv && test->retvals[i].retval_unpriv) in do_test_single()
1010 expected_val = test->retvals[i].retval_unpriv; in do_test_single()
1012 expected_val = test->retvals[i].retval; in do_test_single()
1015 test->retvals[i].data, in do_test_single()
1016 sizeof(test->retvals[i].data)); in do_test_single()
1018 printf("(run %d/%d) ", i + 1, test->runs); in do_test_single()
1039 if (test->fill_insns) in do_test_single()
1040 free(test->fill_insns); in do_test_single()
1092 static bool test_as_unpriv(struct bpf_test *test) in test_as_unpriv() argument
1094 return !test->prog_type || in test_as_unpriv()
1095 test->prog_type == BPF_PROG_TYPE_SOCKET_FILTER || in test_as_unpriv()
1096 test->prog_type == BPF_PROG_TYPE_CGROUP_SKB; in test_as_unpriv()
1104 struct bpf_test *test = &tests[i]; in do_test() local
1109 if (test_as_unpriv(test) && unpriv_disabled) { in do_test()
1110 printf("#%d/u %s SKIP\n", i, test->descr); in do_test()
1112 } else if (test_as_unpriv(test)) { in do_test()
1115 printf("#%d/u %s ", i, test->descr); in do_test()
1116 do_test_single(test, true, &passes, &errors); in do_test()
1122 printf("#%d/p %s SKIP\n", i, test->descr); in do_test()
1125 printf("#%d/p %s ", i, test->descr); in do_test()
1126 do_test_single(test, false, &passes, &errors); in do_test()