From nobody Thu Oct 2 02:15:04 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 327E63148C6 for ; Wed, 24 Sep 2025 14:50:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758725440; cv=none; b=toYq5JdvbdDF9tY5gKVfpGACEgwiA3sRJjtLMKGQ973pvubbv27gAsSI6B5j/7v86Hse5gW5+9+jo4JwXD4i1xpidsVNgEjE/25oWp9T3TrKLor39rvYt1ArzH7y/9NqsFC8dm/ejff9qCQ5Uji79aBpCCgfZq0vy4Ky27PWNaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758725440; c=relaxed/simple; bh=Sl7qyhFQO6cs/JT4ZzWKFa/Vo1Tj+0vv5OnnWd0PYEs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fXIId54XhyECmBJXlGjoD08K3okTNrrLjsiqvkHzfRI9f3ddkn0NA6LoHml/aVBNyAZMb7iUaw8aEOJmlsIzdDArkWjq8gleJk1updqX+5ZfKR5z7rWxLSs2mrgPwOc56hNhewDoVs2qBLnQR6cDI/nTA3vs8h7eJsyyWWxrVGg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=aJjhDPjT; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="aJjhDPjT" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id B17B01A0F7D; Wed, 24 Sep 2025 14:50:36 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8607C60634; Wed, 24 Sep 2025 14:50:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EBEF2102F1916; Wed, 24 Sep 2025 16:50:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1758725435; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=IMwoaA0KIJB8w7w/2HWONK/hMoiPI90VMZ2K/F1AZ4M=; b=aJjhDPjTJwHwvJX5ZU1OILOjM2ArMimoBouviK2jmMiCQcB/SM+N2FMCMEcVyC8kJDIYEe +XiYZ9tDsME8DiXeG9K4dnV+85SSHF1AphkrNfok1H9Um+9wt58yD30qMBVS6fxPOvi/C7 JAvtjQS5uhcnyeO57ufieY4MaWYoUgmTg4xsg1kjc32Kq088BmyZw1YC4k5G0VHqdug0U8 bhFgvbn2Dr+N7f3MDzKKaKTaJLSP3h6F3MTyVCVmA5/3rTm8NPSo7zaSlw7HPDghxzwSVJ FBaW9cO1f5ouNfMi1WFfRcs+fRrv/p6RprOmTZvPMC/ljL9waN/4s187gRmHxw== From: "Bastien Curutchet (eBPF Foundation)" Date: Wed, 24 Sep 2025 16:49:48 +0200 Subject: [PATCH bpf-next v4 13/15] selftests/bpf: test_xsk: Don't exit immediately on allocation failures Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250924-xsk-v4-13-20e57537b876@bootlin.com> References: <20250924-xsk-v4-0-20e57537b876@bootlin.com> In-Reply-To: <20250924-xsk-v4-0-20e57537b876@bootlin.com> To: =?utf-8?q?Bj=C3=B6rn_T=C3=B6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Mykola Lysenko , Shuah Khan , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: Thomas Petazzoni , Alexis Lothore , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Bastien Curutchet (eBPF Foundation)" X-Mailer: b4 0.14.2 X-Last-TLS-Session-Version: TLSv1.3 If any allocation in the pkt_stream_*() helpers fail, exit_with_error() is called. This terminates the program immediately. It prevents the following tests from running and isn't compliant with the CI. Return NULL in case of allocation failure. Return TEST_FAILURE when something goes wrong in the packet generation. Clean up the resources if a failure happens between two steps of a test. Move exit_with_error()'s definition into xskxceiver.c as it isn't used anywhere else now. Signed-off-by: Bastien Curutchet (eBPF Foundation) --- tools/testing/selftests/bpf/test_xsk.c | 136 +++++++++++++++++++++++----= ---- tools/testing/selftests/bpf/test_xsk.h | 7 -- tools/testing/selftests/bpf/xskxceiver.c | 9 ++ 3 files changed, 110 insertions(+), 42 deletions(-) diff --git a/tools/testing/selftests/bpf/test_xsk.c b/tools/testing/selftes= ts/bpf/test_xsk.c index 18a6ce648461de1975aa25997a22c77cecb97a76..453b55463ee8dcd2738d6605752= ad305532211b0 100644 --- a/tools/testing/selftests/bpf/test_xsk.c +++ b/tools/testing/selftests/bpf/test_xsk.c @@ -479,7 +479,7 @@ static struct pkt_stream *__pkt_stream_generate(u32 nb_= pkts, u32 pkt_len, u32 nb =20 pkt_stream =3D __pkt_stream_alloc(nb_pkts); if (!pkt_stream) - exit_with_error(ENOMEM); + return NULL; =20 pkt_stream->nb_pkts =3D nb_pkts; pkt_stream->max_pkt_len =3D pkt_len; @@ -503,37 +503,56 @@ static struct pkt_stream *pkt_stream_clone(struct pkt= _stream *pkt_stream) return pkt_stream_generate(pkt_stream->nb_pkts, pkt_stream->pkts[0].len); } =20 -static void pkt_stream_replace_ifobject(struct ifobject *ifobj, u32 nb_pkt= s, u32 pkt_len) +static int pkt_stream_replace_ifobject(struct ifobject *ifobj, u32 nb_pkts= , u32 pkt_len) { ifobj->xsk->pkt_stream =3D pkt_stream_generate(nb_pkts, pkt_len); + + if (!ifobj->xsk->pkt_stream) + return -ENOMEM; + + return 0; } =20 -static void pkt_stream_replace(struct test_spec *test, u32 nb_pkts, u32 pk= t_len) +static int pkt_stream_replace(struct test_spec *test, u32 nb_pkts, u32 pkt= _len) { - pkt_stream_replace_ifobject(test->ifobj_tx, nb_pkts, pkt_len); - pkt_stream_replace_ifobject(test->ifobj_rx, nb_pkts, pkt_len); + int ret; + + ret =3D pkt_stream_replace_ifobject(test->ifobj_tx, nb_pkts, pkt_len); + if (ret) + return ret; + + return pkt_stream_replace_ifobject(test->ifobj_rx, nb_pkts, pkt_len); } =20 -static void __pkt_stream_replace_half(struct ifobject *ifobj, u32 pkt_len, +static int __pkt_stream_replace_half(struct ifobject *ifobj, u32 pkt_len, int offset) { struct pkt_stream *pkt_stream; u32 i; =20 pkt_stream =3D pkt_stream_clone(ifobj->xsk->pkt_stream); + if (!pkt_stream) + return -ENOMEM; + for (i =3D 1; i < ifobj->xsk->pkt_stream->nb_pkts; i +=3D 2) pkt_stream_pkt_set(pkt_stream, &pkt_stream->pkts[i], offset, pkt_len); =20 ifobj->xsk->pkt_stream =3D pkt_stream; + + return 0; } =20 -static void pkt_stream_replace_half(struct test_spec *test, u32 pkt_len, i= nt offset) +static int pkt_stream_replace_half(struct test_spec *test, u32 pkt_len, in= t offset) { - __pkt_stream_replace_half(test->ifobj_tx, pkt_len, offset); - __pkt_stream_replace_half(test->ifobj_rx, pkt_len, offset); + int ret =3D __pkt_stream_replace_half(test->ifobj_tx, pkt_len, offset); + + if (ret) + return ret; + + return __pkt_stream_replace_half(test->ifobj_rx, pkt_len, offset); } =20 -static void pkt_stream_receive_half(struct test_spec *test) +static int pkt_stream_receive_half(struct test_spec *test) { struct pkt_stream *pkt_stream =3D test->ifobj_tx->xsk->pkt_stream; u32 i; @@ -547,14 +566,19 @@ static void pkt_stream_receive_half(struct test_spec = *test) =20 test->ifobj_rx->xsk->pkt_stream =3D pkt_stream_generate(pkt_stream->nb_pk= ts, pkt_stream->pkts[0].len); + if (!test->ifobj_rx->xsk->pkt_stream) + return -ENOMEM; + pkt_stream =3D test->ifobj_rx->xsk->pkt_stream; for (i =3D 1; i < pkt_stream->nb_pkts; i +=3D 2) pkt_stream->pkts[i].valid =3D false; =20 pkt_stream->nb_valid_entries /=3D 2; + + return 0; } =20 -static void pkt_stream_even_odd_sequence(struct test_spec *test) +static int pkt_stream_even_odd_sequence(struct test_spec *test) { struct pkt_stream *pkt_stream; u32 i; @@ -563,13 +587,19 @@ static void pkt_stream_even_odd_sequence(struct test_= spec *test) pkt_stream =3D test->ifobj_tx->xsk_arr[i].pkt_stream; pkt_stream =3D __pkt_stream_generate(pkt_stream->nb_pkts / 2, pkt_stream->pkts[0].len, i, 2); + if (!pkt_stream) + return -ENOMEM; test->ifobj_tx->xsk_arr[i].pkt_stream =3D pkt_stream; =20 pkt_stream =3D test->ifobj_rx->xsk_arr[i].pkt_stream; pkt_stream =3D __pkt_stream_generate(pkt_stream->nb_pkts / 2, pkt_stream->pkts[0].len, i, 2); + if (!pkt_stream) + return -ENOMEM; test->ifobj_rx->xsk_arr[i].pkt_stream =3D pkt_stream; } + + return 0; } =20 static void release_even_odd_sequence(struct test_spec *test) @@ -628,7 +658,7 @@ static struct pkt_stream *__pkt_stream_generate_custom(= struct ifobject *ifobj, s =20 pkt_stream =3D __pkt_stream_alloc(nb_frames); if (!pkt_stream) - exit_with_error(ENOMEM); + return NULL; =20 for (i =3D 0; i < nb_frames; i++) { struct pkt *pkt =3D &pkt_stream->pkts[pkt_nb]; @@ -671,15 +701,21 @@ static struct pkt_stream *__pkt_stream_generate_custo= m(struct ifobject *ifobj, s return pkt_stream; } =20 -static void pkt_stream_generate_custom(struct test_spec *test, struct pkt = *pkts, u32 nb_pkts) +static int pkt_stream_generate_custom(struct test_spec *test, struct pkt *= pkts, u32 nb_pkts) { struct pkt_stream *pkt_stream; =20 pkt_stream =3D __pkt_stream_generate_custom(test->ifobj_tx, pkts, nb_pkts= , true); + if (!pkt_stream) + return -ENOMEM; test->ifobj_tx->xsk->pkt_stream =3D pkt_stream; =20 pkt_stream =3D __pkt_stream_generate_custom(test->ifobj_rx, pkts, nb_pkts= , false); + if (!pkt_stream) + return -ENOMEM; test->ifobj_rx->xsk->pkt_stream =3D pkt_stream; + + return 0; } =20 static void pkt_print_data(u32 *data, u32 cnt) @@ -1944,24 +1980,28 @@ int testapp_stats_rx_dropped(struct test_spec *test) return TEST_SKIP; } =20 - pkt_stream_replace_half(test, MIN_PKT_SIZE * 4, 0); + if (pkt_stream_replace_half(test, MIN_PKT_SIZE * 4, 0)) + return TEST_FAILURE; test->ifobj_rx->umem->frame_headroom =3D test->ifobj_rx->umem->frame_size= - XDP_PACKET_HEADROOM - MIN_PKT_SIZE * 3; - pkt_stream_receive_half(test); + if (pkt_stream_receive_half(test)) + return TEST_FAILURE; test->ifobj_rx->validation_func =3D validate_rx_dropped; return testapp_validate_traffic(test); } =20 int testapp_stats_tx_invalid_descs(struct test_spec *test) { - pkt_stream_replace_half(test, XSK_UMEM__INVALID_FRAME_SIZE, 0); + if (pkt_stream_replace_half(test, XSK_UMEM__INVALID_FRAME_SIZE, 0)) + return TEST_FAILURE; test->ifobj_tx->validation_func =3D validate_tx_invalid_descs; return testapp_validate_traffic(test); } =20 int testapp_stats_rx_full(struct test_spec *test) { - pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS / 2,= MIN_PKT_SIZE); + if (pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS = / 2, MIN_PKT_SIZE)) + return TEST_FAILURE; test->ifobj_rx->xsk->pkt_stream =3D pkt_stream_generate(DEFAULT_UMEM_BUFF= ERS, MIN_PKT_SIZE); =20 test->ifobj_rx->xsk->rxqsize =3D DEFAULT_UMEM_BUFFERS; @@ -1972,7 +2012,8 @@ int testapp_stats_rx_full(struct test_spec *test) =20 int testapp_stats_fill_empty(struct test_spec *test) { - pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS / 2,= MIN_PKT_SIZE); + if (pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS = / 2, MIN_PKT_SIZE)) + return TEST_FAILURE; test->ifobj_rx->xsk->pkt_stream =3D pkt_stream_generate(DEFAULT_UMEM_BUFF= ERS, MIN_PKT_SIZE); =20 test->ifobj_rx->use_fill_ring =3D false; @@ -1985,7 +2026,8 @@ int testapp_send_receive_unaligned(struct test_spec *= test) test->ifobj_tx->umem->unaligned_mode =3D true; test->ifobj_rx->umem->unaligned_mode =3D true; /* Let half of the packets straddle a 4K buffer boundary */ - pkt_stream_replace_half(test, MIN_PKT_SIZE, -MIN_PKT_SIZE / 2); + if (pkt_stream_replace_half(test, MIN_PKT_SIZE, -MIN_PKT_SIZE / 2)) + return TEST_FAILURE; =20 return testapp_validate_traffic(test); } @@ -1995,7 +2037,8 @@ int testapp_send_receive_unaligned_mb(struct test_spe= c *test) test->mtu =3D MAX_ETH_JUMBO_SIZE; test->ifobj_tx->umem->unaligned_mode =3D true; test->ifobj_rx->umem->unaligned_mode =3D true; - pkt_stream_replace(test, DEFAULT_PKT_CNT, MAX_ETH_JUMBO_SIZE); + if (pkt_stream_replace(test, DEFAULT_PKT_CNT, MAX_ETH_JUMBO_SIZE)) + return TEST_FAILURE; return testapp_validate_traffic(test); } =20 @@ -2003,14 +2046,16 @@ int testapp_single_pkt(struct test_spec *test) { struct pkt pkts[] =3D {{0, MIN_PKT_SIZE, 0, true}}; =20 - pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); + if (pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts))) + return TEST_FAILURE; return testapp_validate_traffic(test); } =20 int testapp_send_receive_mb(struct test_spec *test) { test->mtu =3D MAX_ETH_JUMBO_SIZE; - pkt_stream_replace(test, DEFAULT_PKT_CNT, MAX_ETH_JUMBO_SIZE); + if (pkt_stream_replace(test, DEFAULT_PKT_CNT, MAX_ETH_JUMBO_SIZE)) + return TEST_FAILURE; =20 return testapp_validate_traffic(test); } @@ -2051,7 +2096,8 @@ int testapp_invalid_desc_mb(struct test_spec *test) } =20 test->mtu =3D MAX_ETH_JUMBO_SIZE; - pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); + if (pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts))) + return TEST_FAILURE; return testapp_validate_traffic(test); } =20 @@ -2096,7 +2142,8 @@ int testapp_invalid_desc(struct test_spec *test) pkts[6].offset +=3D umem_size; } =20 - pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); + if (pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts))) + return TEST_FAILURE; return testapp_validate_traffic(test); } =20 @@ -2108,7 +2155,8 @@ int testapp_xdp_drop(struct test_spec *test) test_spec_set_xdp_prog(test, skel_rx->progs.xsk_xdp_drop, skel_tx->progs.= xsk_xdp_drop, skel_rx->maps.xsk, skel_tx->maps.xsk); =20 - pkt_stream_receive_half(test); + if (pkt_stream_receive_half(test)) + return TEST_FAILURE; return testapp_validate_traffic(test); } =20 @@ -2140,7 +2188,8 @@ int testapp_xdp_shared_umem(struct test_spec *test) skel_tx->progs.xsk_xdp_shared_umem, skel_rx->maps.xsk, skel_tx->maps.xsk); =20 - pkt_stream_even_odd_sequence(test); + if (pkt_stream_even_odd_sequence(test)) + return TEST_FAILURE; =20 ret =3D testapp_validate_traffic(test); =20 @@ -2154,7 +2203,8 @@ int testapp_poll_txq_tmout(struct test_spec *test) test->ifobj_tx->use_poll =3D true; /* create invalid frame by set umem frame_size and pkt length equal to 20= 48 */ test->ifobj_tx->umem->frame_size =3D 2048; - pkt_stream_replace(test, 2 * DEFAULT_PKT_CNT, 2048); + if (pkt_stream_replace(test, 2 * DEFAULT_PKT_CNT, 2048)) + return TEST_FAILURE; return testapp_validate_traffic_single_thread(test, test->ifobj_tx); } =20 @@ -2168,7 +2218,7 @@ int testapp_too_many_frags(struct test_spec *test) { struct pkt *pkts; u32 max_frags, i; - int ret; + int ret =3D TEST_FAILURE; =20 if (test->mode =3D=3D TEST_MODE_ZC) { max_frags =3D test->ifobj_tx->xdp_zc_max_segs; @@ -2212,9 +2262,12 @@ int testapp_too_many_frags(struct test_spec *test) pkts[2 * max_frags + 1].len =3D MIN_PKT_SIZE; pkts[2 * max_frags + 1].valid =3D true; =20 - pkt_stream_generate_custom(test, pkts, 2 * max_frags + 2); - ret =3D testapp_validate_traffic(test); + if (pkt_stream_generate_custom(test, pkts, 2 * max_frags + 2)) { + free(pkts); + return TEST_FAILURE; + } =20 + ret =3D testapp_validate_traffic(test); free(pkts); return ret; } @@ -2288,7 +2341,8 @@ int testapp_send_receive_2k_frame(struct test_spec *t= est) { test->ifobj_tx->umem->frame_size =3D 2048; test->ifobj_rx->umem->frame_size =3D 2048; - pkt_stream_replace(test, DEFAULT_PKT_CNT, MIN_PKT_SIZE); + if (pkt_stream_replace(test, DEFAULT_PKT_CNT, MIN_PKT_SIZE)) + return TEST_FAILURE; return testapp_validate_traffic(test); } =20 @@ -2410,7 +2464,13 @@ int testapp_hw_sw_max_ring_size(struct test_spec *te= st) */ test->ifobj_tx->xsk->batch_size =3D test->ifobj_tx->ring.tx_max_pending -= 8; test->ifobj_rx->xsk->batch_size =3D test->ifobj_tx->ring.tx_max_pending -= 8; - pkt_stream_replace(test, max_descs, MIN_PKT_SIZE); + if (pkt_stream_replace(test, max_descs, MIN_PKT_SIZE)) { + clean_sockets(test, test->ifobj_tx); + clean_sockets(test, test->ifobj_rx); + clean_umem(test, test->ifobj_rx, test->ifobj_tx); + return TEST_FAILURE; + } + return testapp_validate_traffic(test); } =20 @@ -2436,8 +2496,13 @@ static int testapp_adjust_tail(struct test_spec *tes= t, u32 value, u32 pkt_len) test->adjust_tail =3D true; test->total_steps =3D 1; =20 - pkt_stream_replace_ifobject(test->ifobj_tx, DEFAULT_BATCH_SIZE, pkt_len); - pkt_stream_replace_ifobject(test->ifobj_rx, DEFAULT_BATCH_SIZE, pkt_len += value); + ret =3D pkt_stream_replace_ifobject(test->ifobj_tx, DEFAULT_BATCH_SIZE, p= kt_len); + if (ret) + return TEST_FAILURE; + + ret =3D pkt_stream_replace_ifobject(test->ifobj_rx, DEFAULT_BATCH_SIZE, p= kt_len + value); + if (ret) + return TEST_FAILURE; =20 ret =3D testapp_xdp_adjust_tail(test, value); if (ret) @@ -2489,7 +2554,8 @@ int testapp_tx_queue_consumer(struct test_spec *test) } =20 nr_packets =3D MAX_TX_BUDGET_DEFAULT + 1; - pkt_stream_replace(test, nr_packets, MIN_PKT_SIZE); + if (pkt_stream_replace(test, nr_packets, MIN_PKT_SIZE)) + return TEST_FAILURE; test->ifobj_tx->xsk->batch_size =3D nr_packets; test->ifobj_tx->xsk->check_consumer =3D true; =20 diff --git a/tools/testing/selftests/bpf/test_xsk.h b/tools/testing/selftes= ts/bpf/test_xsk.h index f4e192264b140c21cc861192fd0df991c46afd24..b068b25ea5da728fad1e17b894d= 6a1b1c9794f74 100644 --- a/tools/testing/selftests/bpf/test_xsk.h +++ b/tools/testing/selftests/bpf/test_xsk.h @@ -34,13 +34,6 @@ extern bool opt_verbose; #define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } whi= le (0) =20 -static void __exit_with_error(int error, const char *file, const char *fun= c, int line) -{ - ksft_test_result_fail("[%s:%s:%i]: ERROR: %d/\"%s\"\n", file, func, line,= error, - strerror(error)); - ksft_exit_xfail(); -} -#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__= , __LINE__) =20 static inline u32 ceil_u32(u32 a, u32 b) { diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selft= ests/bpf/xskxceiver.c index a874f27b590d8ba615e16c612728b2f515ac8dff..a16d3ed3629a995e2bcdd735743= 7451f059d213e 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -107,6 +107,15 @@ static u32 opt_run_test =3D RUN_ALL_TESTS; =20 void test__fail(void) { /* for network_helpers.c */ } =20 +static void __exit_with_error(int error, const char *file, const char *fun= c, int line) +{ + ksft_test_result_fail("[%s:%s:%i]: ERROR: %d/\"%s\"\n", file, func, line, + error, strerror(error)); + ksft_exit_xfail(); +} + +#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__= , __LINE__) + static bool ifobj_zc_avail(struct ifobject *ifobject) { size_t umem_sz =3D DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE; --=20 2.51.0