/tools/testing/selftests/bpf/prog_tests/ |
D | pinning.c | 13 int err; in get_map_id() local 21 err = bpf_obj_get_info_by_fd(bpf_map__fd(map), in get_map_id() 23 CHECK(err, "get map info", "err %d errno %d", err, errno); in get_map_id() 40 int err, map_fd; in test_pinning() local 47 err = libbpf_get_error(obj); in test_pinning() 48 if (CHECK(err != -EINVAL, "invalid open", "err %d errno %d\n", err, errno)) { in test_pinning() 55 err = libbpf_get_error(obj); in test_pinning() 56 if (CHECK(err, "default open", "err %d errno %d\n", err, errno)) { in test_pinning() 61 err = bpf_object__load(obj); in test_pinning() 62 if (CHECK(err, "default load", "err %d errno %d\n", err, errno)) in test_pinning() [all …]
|
D | sockopt_sk.c | 9 int fd, err; in getsetsockopt() local 30 goto err; in getsetsockopt() 34 err = setsockopt(fd, SOL_IP, IP_TOS, big_buf, optlen); in getsetsockopt() 35 if (err) { in getsetsockopt() 37 goto err; in getsetsockopt() 42 err = getsockopt(fd, SOL_IP, IP_TOS, big_buf, &optlen); in getsetsockopt() 43 if (err) { in getsetsockopt() 45 goto err; in getsetsockopt() 51 goto err; in getsetsockopt() 57 err = setsockopt(fd, SOL_IP, IP_TTL, &buf, 1); in getsetsockopt() [all …]
|
D | sockopt_multi.c | 10 int err; in prog_attach() local 12 err = libbpf_prog_type_by_name(title, &prog_type, &attach_type); in prog_attach() 13 if (err) { in prog_attach() 24 err = bpf_prog_attach(bpf_program__fd(prog), cgroup_fd, in prog_attach() 26 if (err) { in prog_attach() 39 int err; in prog_detach() local 41 err = libbpf_prog_type_by_name(title, &prog_type, &attach_type); in prog_detach() 42 if (err) in prog_detach() 49 err = bpf_prog_detach2(bpf_program__fd(prog), cgroup_fd, in prog_detach() 51 if (err) in prog_detach() [all …]
|
D | xdp_attach.c | 13 int err, fd1, fd2, fd3; in test_xdp_attach() local 19 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj1, &fd1); in test_xdp_attach() 20 if (CHECK_FAIL(err)) in test_xdp_attach() 22 err = bpf_obj_get_info_by_fd(fd1, &info, &len); in test_xdp_attach() 23 if (CHECK_FAIL(err)) in test_xdp_attach() 27 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj2, &fd2); in test_xdp_attach() 28 if (CHECK_FAIL(err)) in test_xdp_attach() 32 err = bpf_obj_get_info_by_fd(fd2, &info, &len); in test_xdp_attach() 33 if (CHECK_FAIL(err)) in test_xdp_attach() 37 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj3, &fd3); in test_xdp_attach() [all …]
|
D | tailcalls.c | 11 int err, map_fd, prog_fd, main_fd, i, j; in test_tailcall_1() local 19 err = bpf_prog_load("tailcall1.o", BPF_PROG_TYPE_SCHED_CLS, &obj, in test_tailcall_1() 21 if (CHECK_FAIL(err)) in test_tailcall_1() 51 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1() 52 if (CHECK_FAIL(err)) in test_tailcall_1() 57 err = bpf_prog_test_run(main_fd, 1, buff, sizeof(buff), 0, in test_tailcall_1() 59 CHECK(err || retval != i, "tailcall", in test_tailcall_1() 60 "err %d errno %d retval %d\n", err, errno, retval); in test_tailcall_1() 62 err = bpf_map_delete_elem(map_fd, &i); in test_tailcall_1() 63 if (CHECK_FAIL(err)) in test_tailcall_1() [all …]
|
D | test_bpffs.c | 32 int err, duration = 0; in fn() local 34 err = unshare(CLONE_NEWNS); in fn() 35 if (CHECK(err, "unshare", "failed: %d\n", errno)) in fn() 38 err = mount("", "/", "", MS_REC | MS_PRIVATE, NULL); in fn() 39 if (CHECK(err, "mount /", "failed: %d\n", errno)) in fn() 42 err = umount(TDIR); in fn() 43 if (CHECK(err, "umount " TDIR, "failed: %d\n", errno)) in fn() 46 err = mount("none", TDIR, "tmpfs", 0, NULL); in fn() 47 if (CHECK(err, "mount", "mount root failed: %d\n", errno)) in fn() 50 err = mkdir(TDIR "/fs1", 0777); in fn() [all …]
|
D | skb_ctx.c | 30 int err; in test_skb_ctx() local 33 err = bpf_prog_load("./test_skb_ctx.o", BPF_PROG_TYPE_SCHED_CLS, &obj, in test_skb_ctx() 35 if (CHECK_ATTR(err, "load", "err %d errno %d\n", err, errno)) in test_skb_ctx() 41 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() 42 CHECK_ATTR(err == 0, "ctx_size_in", "err %d errno %d\n", err, errno); in test_skb_ctx() 48 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() 49 CHECK_ATTR(err == 0, "ctx_size_out", "err %d errno %d\n", err, errno); in test_skb_ctx() 55 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() 56 CHECK_ATTR(err == 0, "len", "err %d errno %d\n", err, errno); in test_skb_ctx() 60 err = bpf_prog_test_run_xattr(&tattr); in test_skb_ctx() [all …]
|
D | task_fd_query_rawtp.c | 10 int efd, err, prog_fd; in test_task_fd_query_rawtp() local 14 err = bpf_prog_load(file, BPF_PROG_TYPE_RAW_TRACEPOINT, &obj, &prog_fd); in test_task_fd_query_rawtp() 15 if (CHECK(err, "prog_load raw tp", "err %d errno %d\n", err, errno)) in test_task_fd_query_rawtp() 24 err = bpf_task_fd_query(getpid(), efd, 0, buf, &len, &prog_id, in test_task_fd_query_rawtp() 26 if (CHECK(err < 0, "bpf_task_fd_query", "err %d errno %d\n", err, in test_task_fd_query_rawtp() 30 err = fd_type == BPF_FD_TYPE_RAW_TRACEPOINT && in test_task_fd_query_rawtp() 32 if (CHECK(!err, "check_results", "fd_type %d tp_name %s\n", in test_task_fd_query_rawtp() 38 err = bpf_task_fd_query(getpid(), efd, 0, buf, &len, &prog_id, in test_task_fd_query_rawtp() 40 if (CHECK(err < 0, "bpf_task_fd_query (len = 0)", "err %d errno %d\n", in test_task_fd_query_rawtp() 41 err, errno)) in test_task_fd_query_rawtp() [all …]
|
D | xdp_link.c | 11 __u32 duration = 0, id1, id2, id0 = 0, prog_fd1, prog_fd2, err; in test_xdp_link() local 31 err = bpf_obj_get_info_by_fd(prog_fd1, &prog_info, &prog_info_len); in test_xdp_link() 32 if (CHECK(err, "fd_info1", "failed %d\n", -errno)) in test_xdp_link() 37 err = bpf_obj_get_info_by_fd(prog_fd2, &prog_info, &prog_info_len); in test_xdp_link() 38 if (CHECK(err, "fd_info2", "failed %d\n", -errno)) in test_xdp_link() 43 err = bpf_set_link_xdp_fd_opts(IFINDEX_LO, prog_fd1, XDP_FLAGS_REPLACE, &opts); in test_xdp_link() 44 if (CHECK(err, "fd_attach", "initial prog attach failed: %d\n", err)) in test_xdp_link() 48 err = bpf_get_link_xdp_id(IFINDEX_LO, &id0, 0); in test_xdp_link() 49 CHECK(err || id0 != id1, "id1_check", in test_xdp_link() 50 "loaded prog id %u != id1 %u, err %d", id0, id1, err); in test_xdp_link() [all …]
|
D | cgroup_attach_override.c | 34 goto err; in test_cgroup_attach_override() 39 goto err; in test_cgroup_attach_override() 43 goto err; in test_cgroup_attach_override() 49 goto err; in test_cgroup_attach_override() 53 goto err; in test_cgroup_attach_override() 57 goto err; in test_cgroup_attach_override() 61 goto err; in test_cgroup_attach_override() 67 goto err; in test_cgroup_attach_override() 70 goto err; in test_cgroup_attach_override() 75 goto err; in test_cgroup_attach_override() [all …]
|
D | xdp_adjust_tail.c | 10 int err, prog_fd; in test_xdp_adjust_tail_shrink() local 13 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_shrink() 14 if (CHECK_FAIL(err)) in test_xdp_adjust_tail_shrink() 17 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_xdp_adjust_tail_shrink() 20 CHECK(err || retval != XDP_DROP, in test_xdp_adjust_tail_shrink() 22 err, errno, retval, size); in test_xdp_adjust_tail_shrink() 25 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6), in test_xdp_adjust_tail_shrink() 27 CHECK(err || retval != XDP_TX || size != expect_sz, in test_xdp_adjust_tail_shrink() 29 err, errno, retval, size, expect_sz); in test_xdp_adjust_tail_shrink() 39 int err, prog_fd; in test_xdp_adjust_tail_grow() local [all …]
|
D | xdp_info.c | 13 int err, prog_fd; in test_xdp_info() local 17 err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, 0); in test_xdp_info() 18 if (CHECK(err, "get_xdp_none", "errno=%d\n", errno)) in test_xdp_info() 23 err = bpf_get_link_xdp_id(IFINDEX_LO, &prog_id, XDP_FLAGS_SKB_MODE); in test_xdp_info() 24 if (CHECK(err, "get_xdp_none_skb", "errno=%d\n", errno)) in test_xdp_info() 32 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_info() 33 if (CHECK_FAIL(err)) in test_xdp_info() 36 err = bpf_obj_get_info_by_fd(prog_fd, &info, &len); in test_xdp_info() 37 if (CHECK(err, "get_prog_info", "errno=%d\n", errno)) in test_xdp_info() 40 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_info() [all …]
|
D | stacktrace_build_id.c | 10 int err, stack_trace_len; in test_stacktrace_build_id() local 23 err = test_stacktrace_build_id__attach(skel); in test_stacktrace_build_id() 24 if (CHECK(err, "attach_tp", "err %d\n", err)) in test_stacktrace_build_id() 45 err = compare_map_keys(stackid_hmap_fd, stackmap_fd); in test_stacktrace_build_id() 46 if (CHECK(err, "compare_map_keys stackid_hmap vs. stackmap", in test_stacktrace_build_id() 47 "err %d errno %d\n", err, errno)) in test_stacktrace_build_id() 50 err = compare_map_keys(stackmap_fd, stackid_hmap_fd); in test_stacktrace_build_id() 51 if (CHECK(err, "compare_map_keys stackmap vs. stackid_hmap", in test_stacktrace_build_id() 52 "err %d errno %d\n", err, errno)) in test_stacktrace_build_id() 55 err = extract_build_id(buf, 256); in test_stacktrace_build_id() [all …]
|
D | global_data_init.c | 7 int err = -ENOMEM, map_fd, zero = 0; in test_global_data_init() local 15 err = libbpf_get_error(obj); in test_global_data_init() 16 if (CHECK_FAIL(err)) in test_global_data_init() 30 err = bpf_map__set_initial_value(map, newval, sz - 1); in test_global_data_init() 31 if (CHECK(!err, "reject set initial value wrong size", "err %d\n", err)) in test_global_data_init() 34 err = bpf_map__set_initial_value(map, newval, sz); in test_global_data_init() 35 if (CHECK(err, "set initial value", "err %d\n", err)) in test_global_data_init() 38 err = bpf_object__load(obj); in test_global_data_init() 39 if (CHECK_FAIL(err)) in test_global_data_init() 48 err = bpf_map_lookup_elem(map_fd, &zero, buff); in test_global_data_init() [all …]
|
D | raw_tp_test_run.c | 13 int comm_fd = -1, err, nr_online, i, prog_fd; in test_raw_tp_test_run() local 25 err = parse_cpu_mask_file("/sys/devices/system/cpu/online", &online, in test_raw_tp_test_run() 27 if (CHECK(err, "parse_cpu_mask_file", "err %d\n", err)) in test_raw_tp_test_run() 34 err = test_raw_tp_test_run__attach(skel); in test_raw_tp_test_run() 35 if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err)) in test_raw_tp_test_run() 42 err = write(comm_fd, buf, sizeof(buf)); in test_raw_tp_test_run() 43 CHECK(err < 0, "task rename", "err %d", errno); in test_raw_tp_test_run() 53 err = bpf_prog_test_run_xattr(&test_attr); in test_raw_tp_test_run() 54 CHECK(err == 0, "test_run", "should fail for too small ctx\n"); in test_raw_tp_test_run() 57 err = bpf_prog_test_run_xattr(&test_attr); in test_raw_tp_test_run() [all …]
|
D | trace_ext.c | 23 int err, pkt_fd, ext_fd; in test_trace_ext() local 34 err = test_pkt_md_access__attach(skel_pkt); in test_trace_ext() 35 if (CHECK(err, "setup", "classifier/test_pkt_md_access attach failed: %d\n", err)) in test_trace_ext() 51 err = test_trace_ext__load(skel_ext); in test_trace_ext() 52 if (CHECK(err, "setup", "freplace/test_pkt_md_access load failed\n")) { in test_trace_ext() 53 libbpf_strerror(err, buf, sizeof(buf)); in test_trace_ext() 58 err = test_trace_ext__attach(skel_ext); in test_trace_ext() 59 if (CHECK(err, "setup", "freplace/test_pkt_md_access attach failed: %d\n", err)) in test_trace_ext() 79 err = test_trace_ext_tracing__load(skel_trace); in test_trace_ext() 80 if (CHECK(err, "setup", "tracing/test_pkt_md_access_new load failed\n")) { in test_trace_ext() [all …]
|
D | tp_attach_query.c | 7 int i, j, bytes, efd, err, prog_fd[num_progs], pmu_fd[num_progs]; in test_tp_attach_query() local 38 err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj[i], in test_tp_attach_query() 40 if (CHECK(err, "prog_load", "err %d errno %d\n", err, errno)) in test_tp_attach_query() 48 err = bpf_obj_get_info_by_fd(prog_fd[i], &prog_info, &info_len); in test_tp_attach_query() 49 if (CHECK(err, "bpf_obj_get_info_by_fd", "err %d errno %d\n", in test_tp_attach_query() 50 err, errno)) in test_tp_attach_query() 60 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE, 0); in test_tp_attach_query() 61 if (CHECK(err, "perf_event_ioc_enable", "err %d errno %d\n", in test_tp_attach_query() 62 err, errno)) in test_tp_attach_query() 68 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_QUERY_BPF, query); in test_tp_attach_query() [all …]
|
/tools/testing/selftests/x86/ |
D | test_FCMOV.c | 56 int err = 0; in main() local 68 err |= !(fcmovb(0) == 1.0); err |= !(fcmovnb(0) != 1.0); in main() 69 err |= !(fcmove(0) == 1.0); err |= !(fcmovne(0) != 1.0); in main() 70 err |= !(fcmovbe(0) == 1.0); err |= !(fcmovnbe(0) != 1.0); in main() 71 err |= !(fcmovu(0) == 1.0); err |= !(fcmovnu(0) != 1.0); in main() 73 err |= !(fcmovb(CF) != 1.0); err |= !(fcmovnb(CF) == 1.0); in main() 74 err |= !(fcmove(CF) == 1.0); err |= !(fcmovne(CF) != 1.0); in main() 75 err |= !(fcmovbe(CF) != 1.0); err |= !(fcmovnbe(CF) == 1.0); in main() 76 err |= !(fcmovu(CF) == 1.0); err |= !(fcmovnu(CF) != 1.0); in main() 78 err |= !(fcmovb(ZF) == 1.0); err |= !(fcmovnb(ZF) != 1.0); in main() [all …]
|
/tools/testing/selftests/bpf/map_tests/ |
D | sk_storage_map.c | 170 int i, map_fd, err, *sk_fds; in insert_close_thread() local 189 err = -errno; in insert_close_thread() 193 err = bpf_map_update_elem(map_fd, &sk_fds[i], &value, in insert_close_thread() 195 if (err) { in insert_close_thread() 196 err = -errno; in insert_close_thread() 224 return ERR_PTR(err); in insert_close_thread() 229 int i, map_fd = -1, err = 0, nr_threads_created = 0; in do_sk_storage_map_stress_free() local 240 err = pthread_create(&sk_thread_ids[i], NULL, in do_sk_storage_map_stress_free() 242 if (err) { in do_sk_storage_map_stress_free() 243 err = -errno; in do_sk_storage_map_stress_free() [all …]
|
/tools/perf/tests/ |
D | event-times.c | 25 int err; in attach__enable_on_exec() local 29 err = perf_evlist__create_maps(evlist, &target); in attach__enable_on_exec() 30 if (err < 0) { in attach__enable_on_exec() 32 return err; in attach__enable_on_exec() 35 err = perf_evlist__prepare_workload(evlist, &target, argv, false, NULL); in attach__enable_on_exec() 36 if (err < 0) { in attach__enable_on_exec() 38 return err; in attach__enable_on_exec() 43 err = evlist__open(evlist); in attach__enable_on_exec() 44 if (err < 0) { in attach__enable_on_exec() 47 return err; in attach__enable_on_exec() [all …]
|
D | switch-tracking.c | 26 int err, i; in spin_sleep() local 31 err = gettimeofday(&start, NULL); in spin_sleep() 32 if (err) in spin_sleep() 33 return err; in spin_sleep() 40 err = gettimeofday(&now, NULL); in spin_sleep() 41 if (err) in spin_sleep() 42 return err; in spin_sleep() 53 err = nanosleep(&ts, NULL); in spin_sleep() 54 if (err == EINTR) in spin_sleep() 55 err = 0; in spin_sleep() [all …]
|
D | evsel-roundtrip-name.c | 13 int type, op, err = 0, ret = 0, i, idx; in perf_evsel__roundtrip_cache_name_test() local 28 err = parse_events(evlist, name, NULL); in perf_evsel__roundtrip_cache_name_test() 29 if (err) in perf_evsel__roundtrip_cache_name_test() 30 ret = err; in perf_evsel__roundtrip_cache_name_test() 67 int i, err; in __perf_evsel__name_array_test() local 75 err = parse_events(evlist, names[i], NULL); in __perf_evsel__name_array_test() 76 if (err) { in __perf_evsel__name_array_test() 78 names[i], err); in __perf_evsel__name_array_test() 83 err = 0; in __perf_evsel__name_array_test() 86 --err; in __perf_evsel__name_array_test() [all …]
|
/tools/testing/selftests/pidfd/ |
D | pidfd_fdinfo_test.c | 25 static int error_set(struct error *err, int code, const char *fmt, ...) in error_set() argument 30 if (code == PIDFD_PASS || !err || err->code != PIDFD_PASS) in error_set() 33 err->code = code; in error_set() 35 r = vsnprintf(err->msg, sizeof(err->msg), fmt, args); in error_set() 36 assert((size_t)r < sizeof(err->msg)); in error_set() 42 static void error_report(struct error *err, const char *test_name) in error_report() argument 44 switch (err->code) { in error_report() 46 ksft_exit_fail_msg("%s test: Fatal: %s\n", test_name, err->msg); in error_report() 51 ksft_test_result_error("%s test: %s\n", test_name, err->msg); in error_report() 56 ksft_test_result_skip("%s test: %s\n", test_name, err->msg); in error_report() [all …]
|
/tools/testing/selftests/bpf/ |
D | test_skb_cgroup_id_user.c | 53 int err = 0; in send_packet() local 57 goto err; in send_packet() 62 goto err; in send_packet() 68 goto err; in send_packet() 72 err: in send_packet() 73 err = -1; in send_packet() 77 return err; in send_packet() 91 goto err; in get_map_fd_by_prog_id() 99 goto err; in get_map_fd_by_prog_id() 104 goto err; in get_map_fd_by_prog_id() [all …]
|
D | test_socket_cookie.c | 98 int err = 0; in validate_map() local 103 goto err; in validate_map() 108 err = bpf_map_lookup_elem(map_fd, &client_fd, &val); in validate_map() 110 err = getsockname(client_fd, (struct sockaddr *)&addr, &len); in validate_map() 111 if (err) { in validate_map() 120 goto err; in validate_map() 124 err: in validate_map() 125 err = -1; in validate_map() 127 return err; in validate_map() 140 int err = 0; in run_test() local [all …]
|