/tools/testing/selftests/bpf/prog_tests/ |
D | skeleton.c | 17 struct test_skeleton__bss *bss; in test_skeleton() local 29 bss = skel->bss; in test_skeleton() 39 CHECK(bss->in3 != 0, "in3", "got %d != exp %d\n", bss->in3, 0); in test_skeleton() 40 CHECK(bss->out3 != 0, "out3", "got %d != exp %d\n", bss->out3, 0); in test_skeleton() 41 CHECK(bss->in4 != 0, "in4", "got %lld != exp %lld\n", bss->in4, 0LL); in test_skeleton() 42 CHECK(bss->out4 != 0, "out4", "got %lld != exp %lld\n", bss->out4, 0LL); in test_skeleton() 45 CHECK(bss->out6 != 0, "out6", "got %d != exp %d\n", bss->out6, 0); in test_skeleton() 50 bss->in3 = 12; in test_skeleton() 51 bss->in4 = 13; in test_skeleton() 61 CHECK(bss->in3 != 12, "in3", "got %d != exp %d\n", bss->in3, 12); in test_skeleton() [all …]
|
D | endian.c | 20 struct test_endian__bss *bss; in test_endian() local 26 bss = skel->bss; in test_endian() 28 bss->in16 = IN16; in test_endian() 29 bss->in32 = IN32; in test_endian() 30 bss->in64 = IN64; in test_endian() 38 CHECK(bss->out16 != OUT16, "out16", "got 0x%llx != exp 0x%llx\n", in test_endian() 39 (__u64)bss->out16, (__u64)OUT16); in test_endian() 40 CHECK(bss->out32 != OUT32, "out32", "got 0x%llx != exp 0x%llx\n", in test_endian() 41 (__u64)bss->out32, (__u64)OUT32); in test_endian() 42 CHECK(bss->out64 != OUT64, "out16", "got 0x%llx != exp 0x%llx\n", in test_endian() [all …]
|
D | btf_skc_cls_ingress.c | 77 memset(&skel->bss->srv_sa6, 0, sizeof(skel->bss->srv_sa6)); in reset_test() 78 skel->bss->listen_tp_sport = 0; in reset_test() 79 skel->bss->req_sk_sport = 0; in reset_test() 80 skel->bss->recv_cookie = 0; in reset_test() 81 skel->bss->gen_cookie = 0; in reset_test() 82 skel->bss->linum = 0; in reset_test() 87 if (skel->bss->linum) in print_err_line() 88 printf("bpf prog error at line %u\n", skel->bss->linum); in print_err_line() 108 memcpy(&skel->bss->srv_sa6, &srv_sa6, sizeof(srv_sa6)); in test_conn() 119 if (CHECK(skel->bss->listen_tp_sport != srv_port || in test_conn() [all …]
|
D | ringbuf.c | 66 skel->bss->dropped = 0; in trigger_samples() 67 skel->bss->total = 0; in trigger_samples() 68 skel->bss->discarded = 0; in trigger_samples() 71 skel->bss->value = 333; in trigger_samples() 73 skel->bss->value = 777; in trigger_samples() 150 skel->bss->pid = getpid(); in test_ringbuf() 164 CHECK(skel->bss->avail_data != 3 * rec_sz, in test_ringbuf() 166 3L * rec_sz, skel->bss->avail_data); in test_ringbuf() 167 CHECK(skel->bss->ring_size != page_size, in test_ringbuf() 169 (long)page_size, skel->bss->ring_size); in test_ringbuf() [all …]
|
D | link_pinning.c | 12 struct test_link_pinning__bss *bss) in test_link_pinning_subtest() argument 23 bss->in = 1; in test_link_pinning_subtest() 25 CHECK(bss->out != 1, "res_check1", "exp %d, got %d\n", 1, bss->out); in test_link_pinning_subtest() 40 bss->in = 2; in test_link_pinning_subtest() 42 CHECK(bss->out != 2, "res_check2", "exp %d, got %d\n", 2, bss->out); in test_link_pinning_subtest() 48 bss->in = 3; in test_link_pinning_subtest() 50 CHECK(bss->out != 3, "res_check3", "exp %d, got %d\n", 3, bss->out); in test_link_pinning_subtest() 66 bss->in = 4; in test_link_pinning_subtest() 68 CHECK(bss->out != 4, "res_check4", "exp %d, got %d\n", 4, bss->out); in test_link_pinning_subtest() 79 bss->in = i; in test_link_pinning_subtest() [all …]
|
D | core_read_macros.c | 27 struct test_core_read_macros__bss *bss; in test_core_read_macros() local 34 bss = skel->bss; in test_core_read_macros() 35 bss->my_pid = getpid(); in test_core_read_macros() 38 bss->k_probe_in.func = (void *)(long)0x1234; in test_core_read_macros() 39 bss->k_core_in.func = (void *)(long)0xabcd; in test_core_read_macros() 43 bss->u_probe_in = &u_probe_in; in test_core_read_macros() 47 bss->u_core_in = &u_core_in; in test_core_read_macros() 56 ASSERT_EQ(bss->k_probe_out, 0x1234, "k_probe_out"); in test_core_read_macros() 57 ASSERT_EQ(bss->k_core_out, 0xabcd, "k_core_out"); in test_core_read_macros() 59 ASSERT_EQ(bss->u_probe_out, 0x5678, "u_probe_out"); in test_core_read_macros() [all …]
|
D | snprintf.c | 46 skel->bss->pid = getpid(); in test_snprintf_positive() 54 ASSERT_STREQ(skel->bss->num_out, EXP_NUM_OUT, "num_out"); in test_snprintf_positive() 55 ASSERT_EQ(skel->bss->num_ret, EXP_NUM_RET, "num_ret"); in test_snprintf_positive() 57 ASSERT_STREQ(skel->bss->ip_out, EXP_IP_OUT, "ip_out"); in test_snprintf_positive() 58 ASSERT_EQ(skel->bss->ip_ret, EXP_IP_RET, "ip_ret"); in test_snprintf_positive() 60 ASSERT_OK(memcmp(skel->bss->sym_out, exp_sym_out, in test_snprintf_positive() 62 ASSERT_LT(MIN_SYM_RET, skel->bss->sym_ret, "sym_ret"); in test_snprintf_positive() 64 ASSERT_OK(memcmp(skel->bss->addr_out, exp_addr_out, in test_snprintf_positive() 66 ASSERT_EQ(skel->bss->addr_ret, EXP_ADDR_RET, "addr_ret"); in test_snprintf_positive() 68 ASSERT_STREQ(skel->bss->str_out, EXP_STR_OUT, "str_out"); in test_snprintf_positive() [all …]
|
D | snprintf_btf.c | 12 struct netif_receive_skb__bss *bss; in test_snprintf_btf() local 23 bss = skel->bss; in test_snprintf_btf() 34 if (bss->skip) { in test_snprintf_btf() 45 if (!ASSERT_GT(bss->ret, 0, "bpf_snprintf_ret")) in test_snprintf_btf() 48 if (CHECK(bss->ran_subtests == 0, "check if subtests ran", in test_snprintf_btf() 52 if (CHECK(bss->num_subtests != bss->ran_subtests, in test_snprintf_btf() 54 "only ran %d of %d tests\n", bss->num_subtests, in test_snprintf_btf() 55 bss->ran_subtests)) in test_snprintf_btf()
|
D | d_path.c | 104 struct test_d_path__bss *bss; in test_d_path() local 116 bss = skel->bss; in test_d_path() 117 bss->my_pid = getpid(); in test_d_path() 119 err = trigger_fstat_events(bss->my_pid); in test_d_path() 123 if (CHECK(!bss->called_stat, in test_d_path() 128 if (CHECK(!bss->called_close, in test_d_path() 134 CHECK(strncmp(src.paths[i], bss->paths_stat[i], MAX_PATH_LEN), in test_d_path() 137 i, src.paths[i], bss->paths_stat[i]); in test_d_path() 138 CHECK(strncmp(src.paths[i], bss->paths_close[i], MAX_PATH_LEN), in test_d_path() 141 i, src.paths[i], bss->paths_close[i]); in test_d_path() [all …]
|
D | linked_vars.c | 17 skel->bss->input_bss1 = 1000; in test_linked_vars() 18 skel->bss->input_bss2 = 2000; in test_linked_vars() 19 skel->bss->input_bss_weak = 3000; in test_linked_vars() 32 ASSERT_EQ(skel->bss->output_bss1, 1000 + 2000 + 3000, "output_bss1"); in test_linked_vars() 33 ASSERT_EQ(skel->bss->output_bss2, 1000 + 2000 + 3000, "output_bss2"); in test_linked_vars() 35 ASSERT_EQ(skel->bss->output_data1, 1 + 2 + 10, "output_bss1"); in test_linked_vars() 36 ASSERT_EQ(skel->bss->output_data2, 1 + 2 + 10, "output_bss2"); in test_linked_vars() 38 ASSERT_EQ(skel->bss->output_rodata1, 11 + 22 + 100, "output_weak1"); in test_linked_vars() 39 ASSERT_EQ(skel->bss->output_rodata2, 11 + 22 + 100, "output_weak2"); in test_linked_vars()
|
D | vmlinux.c | 21 struct test_vmlinux__bss *bss; in test_vmlinux() local 26 bss = skel->bss; in test_vmlinux() 35 CHECK(!bss->tp_called, "tp", "not called\n"); in test_vmlinux() 36 CHECK(!bss->raw_tp_called, "raw_tp", "not called\n"); in test_vmlinux() 37 CHECK(!bss->tp_btf_called, "tp_btf", "not called\n"); in test_vmlinux() 38 CHECK(!bss->kprobe_called, "kprobe", "not called\n"); in test_vmlinux() 39 CHECK(!bss->fentry_called, "fentry", "not called\n"); in test_vmlinux()
|
D | varlen.c | 16 struct test_varlen__bss *bss; in test_varlen() local 27 bss = skel->bss; in test_varlen() 34 bss->test_pid = getpid(); in test_varlen() 37 memcpy(bss->buf_in1, str1, size1); in test_varlen() 38 memcpy(bss->buf_in2, str2, size2); in test_varlen() 39 bss->capture = true; in test_varlen() 41 bss->capture = false; in test_varlen() 43 CHECK_VAL(bss->payload1_len1, size1); in test_varlen() 44 CHECK_VAL(bss->payload1_len2, size2); in test_varlen() 45 CHECK_VAL(bss->total1, size1 + size2); in test_varlen() [all …]
|
D | rdonly_maps.c | 4 struct bss { struct 30 struct bss bss; in test_rdonly_maps() local 55 memset(&bss, 0, sizeof(bss)); in test_rdonly_maps() 56 err = bpf_map_update_elem(bpf_map__fd(bss_map), &zero, &bss, 0); in test_rdonly_maps() 70 err = bpf_map_lookup_elem(bpf_map__fd(bss_map), &zero, &bss); in test_rdonly_maps() 73 if (CHECK(bss.did_run == 0, "check_run", in test_rdonly_maps() 76 if (CHECK(bss.iters != t->exp_iters, "check_iters", in test_rdonly_maps() 78 t->prog_name, bss.iters, t->exp_iters)) in test_rdonly_maps() 80 if (CHECK(bss.sum != t->exp_sum, "check_sum", in test_rdonly_maps() 82 t->prog_name, bss.sum, t->exp_sum)) in test_rdonly_maps()
|
D | subprogs.c | 26 CHECK(skel->bss->res1 != 12, "res1", "got %d, exp %d\n", skel->bss->res1, 12); in test_subprogs() 27 CHECK(skel->bss->res2 != 17, "res2", "got %d, exp %d\n", skel->bss->res2, 17); in test_subprogs() 28 CHECK(skel->bss->res3 != 19, "res3", "got %d, exp %d\n", skel->bss->res3, 19); in test_subprogs() 29 CHECK(skel->bss->res4 != 36, "res4", "got %d, exp %d\n", skel->bss->res4, 36); in test_subprogs()
|
D | ns_current_pid_tgid.c | 21 struct test_ns_current_pid_tgid__bss *bss; in test_current_pid_tgid() local 38 bss = skel->bss; in test_current_pid_tgid() 39 bss->dev = st.st_dev; in test_current_pid_tgid() 40 bss->ino = st.st_ino; in test_current_pid_tgid() 41 bss->user_pid = 0; in test_current_pid_tgid() 42 bss->user_tgid = 0; in test_current_pid_tgid() 50 ASSERT_EQ(bss->user_pid, pid, "pid"); in test_current_pid_tgid() 51 ASSERT_EQ(bss->user_tgid, tgid, "tgid"); in test_current_pid_tgid()
|
D | module_attach.c | 58 struct test_module_attach__bss *bss; in test_module_attach() local 74 bss = skel->bss; in test_module_attach() 84 ASSERT_EQ(bss->raw_tp_read_sz, READ_SZ, "raw_tp"); in test_module_attach() 85 ASSERT_EQ(bss->raw_tp_bare_write_sz, WRITE_SZ, "raw_tp_bare"); in test_module_attach() 86 ASSERT_EQ(bss->tp_btf_read_sz, READ_SZ, "tp_btf"); in test_module_attach() 87 ASSERT_EQ(bss->fentry_read_sz, READ_SZ, "fentry"); in test_module_attach() 88 ASSERT_EQ(bss->fentry_manual_read_sz, READ_SZ, "fentry_manual"); in test_module_attach() 89 ASSERT_EQ(bss->fexit_read_sz, READ_SZ, "fexit"); in test_module_attach() 90 ASSERT_EQ(bss->fexit_ret, -EIO, "fexit_tet"); in test_module_attach() 91 ASSERT_EQ(bss->fmod_ret_read_sz, READ_SZ, "fmod_ret"); in test_module_attach()
|
D | ringbuf_multi.c | 81 skel->bss->pid = getpid(); in test_ringbuf_multi() 98 skel->bss->target_ring = 0; in test_ringbuf_multi() 99 skel->bss->value = 333; in test_ringbuf_multi() 103 skel->bss->target_ring = 1; in test_ringbuf_multi() 104 skel->bss->value = 555; in test_ringbuf_multi() 107 skel->bss->target_ring = 2; in test_ringbuf_multi() 108 skel->bss->value = 777; in test_ringbuf_multi() 121 CHECK(skel->bss->dropped != 0, "err_dropped", "exp %ld, got %ld\n", in test_ringbuf_multi() 122 0L, skel->bss->dropped); in test_ringbuf_multi() 123 CHECK(skel->bss->skipped != 1, "err_skipped", "exp %ld, got %ld\n", in test_ringbuf_multi() [all …]
|
D | linked_funcs.c | 18 skel->bss->syscall_id = SYS_getpgid; in test_linked_funcs() 31 ASSERT_EQ(skel->bss->output_val1, 2000 + 2000, "output_val1"); in test_linked_funcs() 32 ASSERT_EQ(skel->bss->output_ctx1, SYS_getpgid, "output_ctx1"); in test_linked_funcs() 33 ASSERT_EQ(skel->bss->output_weak1, 42, "output_weak1"); in test_linked_funcs() 35 ASSERT_EQ(skel->bss->output_val2, 2 * 1000 + 2 * (2 * 1000), "output_val2"); in test_linked_funcs() 36 ASSERT_EQ(skel->bss->output_ctx2, SYS_getpgid, "output_ctx2"); in test_linked_funcs() 38 ASSERT_EQ(skel->bss->output_weak2, 0, "output_weak2"); in test_linked_funcs()
|
D | trace_printk.c | 14 struct trace_printk__bss *bss; in test_trace_printk() local 31 bss = skel->bss; in test_trace_printk() 49 if (CHECK(bss->trace_printk_ran == 0, in test_trace_printk() 51 "ran == %d", bss->trace_printk_ran)) in test_trace_printk() 54 if (CHECK(bss->trace_printk_ret <= 0, in test_trace_printk() 56 "got %d", bss->trace_printk_ret)) in test_trace_printk() 63 if (found == bss->trace_printk_ran) in test_trace_printk()
|
D | atomics.c | 25 ASSERT_EQ(skel->bss->add64_result, 1, "add64_result"); in test_add() 28 ASSERT_EQ(skel->bss->add32_result, 1, "add32_result"); in test_add() 30 ASSERT_EQ(skel->bss->add_stack_value_copy, 3, "add_stack_value"); in test_add() 31 ASSERT_EQ(skel->bss->add_stack_result, 1, "add_stack_result"); in test_add() 58 ASSERT_EQ(skel->bss->sub64_result, 1, "sub64_result"); in test_sub() 61 ASSERT_EQ(skel->bss->sub32_result, 1, "sub32_result"); in test_sub() 63 ASSERT_EQ(skel->bss->sub_stack_value_copy, -1, "sub_stack_value"); in test_sub() 64 ASSERT_EQ(skel->bss->sub_stack_result, 1, "sub_stack_result"); in test_sub() 90 ASSERT_EQ(skel->bss->and64_result, 0x110ull << 32, "and64_result"); in test_and() 93 ASSERT_EQ(skel->bss->and32_result, 0x110, "and32_result"); in test_and() [all …]
|
D | stack_var_off.c | 18 skel->bss->test_pid = getpid(); in test_stack_var_off() 20 skel->bss->input[0] = 2; in test_stack_var_off() 21 skel->bss->input[1] = 42; /* This will be returned in probe_res. */ in test_stack_var_off() 29 if (CHECK(skel->bss->probe_res != 42, "check_probe_res", in test_stack_var_off() 30 "wrong probe res: %d\n", skel->bss->probe_res)) in test_stack_var_off()
|
D | attach_probe.c | 31 if (CHECK(!skel->bss, "check_bss", ".bss wasn't mmap()-ed\n")) in test_attach_probe() 77 if (CHECK(skel->bss->kprobe_res != 1, "check_kprobe_res", in test_attach_probe() 78 "wrong kprobe res: %d\n", skel->bss->kprobe_res)) in test_attach_probe() 80 if (CHECK(skel->bss->kretprobe_res != 2, "check_kretprobe_res", in test_attach_probe() 81 "wrong kretprobe res: %d\n", skel->bss->kretprobe_res)) in test_attach_probe() 87 if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res", in test_attach_probe() 88 "wrong uprobe res: %d\n", skel->bss->uprobe_res)) in test_attach_probe() 90 if (CHECK(skel->bss->uretprobe_res != 4, "check_uretprobe_res", in test_attach_probe() 91 "wrong uretprobe res: %d\n", skel->bss->uretprobe_res)) in test_attach_probe()
|
D | get_func_ip_test.c | 43 ASSERT_EQ(skel->bss->test1_result, 1, "test1_result"); in test_get_func_ip_test() 44 ASSERT_EQ(skel->bss->test2_result, 1, "test2_result"); in test_get_func_ip_test() 45 ASSERT_EQ(skel->bss->test3_result, 1, "test3_result"); in test_get_func_ip_test() 46 ASSERT_EQ(skel->bss->test4_result, 1, "test4_result"); in test_get_func_ip_test() 47 ASSERT_EQ(skel->bss->test5_result, 1, "test5_result"); in test_get_func_ip_test() 49 ASSERT_EQ(skel->bss->test6_result, 1, "test6_result"); in test_get_func_ip_test() 50 ASSERT_EQ(skel->bss->test7_result, 1, "test7_result"); in test_get_func_ip_test()
|
D | test_lsm.c | 69 err = exec_cmd(&skel->bss->monitored_pid); in test_lsm() 73 ASSERT_EQ(skel->bss->bprm_count, 1, "bprm_count"); in test_lsm() 75 skel->bss->monitored_pid = getpid(); in test_lsm() 81 ASSERT_EQ(skel->bss->mprotect_count, 1, "mprotect_count"); in test_lsm() 87 ASSERT_EQ(skel->bss->copy_test, 3, "copy_test"); in test_lsm() 91 skel->bss->copy_test = 0; in test_lsm() 92 skel->bss->bprm_count = 0; in test_lsm() 93 skel->bss->mprotect_count = 0; in test_lsm()
|
D | for_each.c | 52 ASSERT_EQ(skel->bss->hashmap_output, 4, "hashmap_output"); in test_hash_map() 53 ASSERT_EQ(skel->bss->hashmap_elems, max_entries, "hashmap_elems"); in test_hash_map() 59 ASSERT_EQ(skel->bss->percpu_called, 1, "percpu_called"); in test_hash_map() 60 ASSERT_LT(skel->bss->cpu, num_cpus, "num_cpus"); in test_hash_map() 61 ASSERT_EQ(skel->bss->percpu_map_elems, 1, "percpu_map_elems"); in test_hash_map() 62 ASSERT_EQ(skel->bss->percpu_key, 1, "percpu_key"); in test_hash_map() 63 ASSERT_EQ(skel->bss->percpu_val, skel->bss->cpu + 1, "percpu_val"); in test_hash_map() 64 ASSERT_EQ(skel->bss->percpu_output, 100, "percpu_output"); in test_hash_map() 116 ASSERT_EQ(skel->bss->arraymap_output, expected_total, "array_output"); in test_array_map() 117 ASSERT_EQ(skel->bss->cpu + 1, skel->bss->percpu_val, "percpu_val"); in test_array_map()
|