From: "Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>
To: Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>,
Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>,
Shuah Khan <shuah@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>
Cc: ebpf@linuxfoundation.org,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Bastien Curutchet" <bastien.curutchet@bootlin.com>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"Alexis Lothoré (eBPF Foundation)" <alexis.lothore@bootlin.com>
Subject: [PATCH bpf-next v3 05/14] selftests/bpf: expose all subtests from flow_dissector
Date: Wed, 20 Nov 2024 08:43:15 +0100 [thread overview]
Message-ID: <20241120-flow_dissector-v3-5-45b46494f937@bootlin.com> (raw)
In-Reply-To: <20241120-flow_dissector-v3-0-45b46494f937@bootlin.com>
The flow_dissector test integrated in test_progs actually runs a wide
matrix of tests over different packets types and bpf programs modes, but
exposes only 3 main tests, preventing tests users from running specific
subtests with a specific input only.
Expose all subtests executed by flow_dissector by using
test__start_subtest().
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
---
Changes in v3:
-none
Changes in v2:
- fetch Acked-by tag
This change resulsts in the exposure of 42 subtests with the current
content from flow_dissector:
# ./test_progs -a flow_dissector
#102/1 flow_dissector/ipv4-skb:OK
#102/2 flow_dissector/ipv6-skb:OK
#102/3 flow_dissector/802.1q-ipv4-skb:OK
#102/4 flow_dissector/802.1ad-ipv6-skb:OK
#102/5 flow_dissector/ipv4-frag-skb:OK
#102/6 flow_dissector/ipv4-no-frag-skb:OK
#102/7 flow_dissector/ipv6-frag-skb:OK
#102/8 flow_dissector/ipv6-no-frag-skb:OK
#102/9 flow_dissector/ipv6-flow-label-skb:OK
#102/10 flow_dissector/ipv6-no-flow-label-skb:OK
#102/11 flow_dissector/ipv6-empty-flow-label-skb:OK
#102/12 flow_dissector/ipip-encap-skb:OK
#102/13 flow_dissector/ipip-no-encap-skb:OK
#102/14 flow_dissector/ipip-encap-dissector-continue-skb:OK
#102/15 flow_dissector/ipv4-non-skb-indirect-attach:OK
#102/16 flow_dissector/ipv6-non-skb-indirect-attach:OK
#102/17 flow_dissector/802.1q-ipv4-non-skb-indirect-attach:OK
#102/18 flow_dissector/802.1ad-ipv6-non-skb-indirect-attach:OK
#102/19 flow_dissector/ipv4-frag-non-skb-indirect-attach:OK
#102/20 flow_dissector/ipv4-no-frag-non-skb-indirect-attach:OK
#102/21 flow_dissector/ipv6-frag-non-skb-indirect-attach:OK
#102/22 flow_dissector/ipv6-no-frag-non-skb-indirect-attach:OK
#102/23 flow_dissector/ipv6-flow-label-non-skb-indirect-attach:OK
#102/24 flow_dissector/ipv6-no-flow-label-non-skb-indirect-attach:OK
#102/25 flow_dissector/ipv6-empty-flow-label-non-skb-indirect-attach:OK
#102/26 flow_dissector/ipip-encap-non-skb-indirect-attach:OK
#102/27 flow_dissector/ipip-no-encap-non-skb-indirect-attach:OK
#102/28 flow_dissector/ipip-encap-dissector-continue-non-skb-indirect-attach:OK
#102/29 flow_dissector/ipv4-non-skb-direct-attach:OK
#102/30 flow_dissector/ipv6-non-skb-direct-attach:OK
#102/31 flow_dissector/802.1q-ipv4-non-skb-direct-attach:OK
#102/32 flow_dissector/802.1ad-ipv6-non-skb-direct-attach:OK
#102/33 flow_dissector/ipv4-frag-non-skb-direct-attach:OK
#102/34 flow_dissector/ipv4-no-frag-non-skb-direct-attach:OK
#102/35 flow_dissector/ipv6-frag-non-skb-direct-attach:OK
#102/36 flow_dissector/ipv6-no-frag-non-skb-direct-attach:OK
#102/37 flow_dissector/ipv6-flow-label-non-skb-direct-attach:OK
#102/38 flow_dissector/ipv6-no-flow-label-non-skb-direct-attach:OK
#102/39 flow_dissector/ipv6-empty-flow-label-non-skb-direct-attach:OK
#102/40 flow_dissector/ipip-encap-non-skb-direct-attach:OK
#102/41 flow_dissector/ipip-no-encap-non-skb-direct-attach:OK
#102/42 flow_dissector/ipip-encap-dissector-continue-non-skb-direct-attach:OK
#102 flow_dissector:OK
Summary: 1/42 PASSED, 0 SKIPPED, 0 FAILED
---
.../selftests/bpf/prog_tests/flow_dissector.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
index 7e7051a85be7410d4c636af8cd58206a76afe49e..29182009cda944e617a26e450902e63c2f7787ce 100644
--- a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
+++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c
@@ -8,6 +8,7 @@
#include "bpf_flow.skel.h"
#define FLOW_CONTINUE_SADDR 0x7f00007f /* 127.0.0.127 */
+#define TEST_NAME_MAX_LEN 64
#ifndef IP_MF
#define IP_MF 0x2000
@@ -505,8 +506,10 @@ static int init_prog_array(struct bpf_object *obj, struct bpf_map *prog_array)
return 0;
}
-static void run_tests_skb_less(int tap_fd, struct bpf_map *keys)
+static void run_tests_skb_less(int tap_fd, struct bpf_map *keys,
+ char *test_suffix)
{
+ char test_name[TEST_NAME_MAX_LEN];
int i, err, keys_fd;
keys_fd = bpf_map__fd(keys);
@@ -520,6 +523,10 @@ static void run_tests_skb_less(int tap_fd, struct bpf_map *keys)
struct bpf_flow_keys flow_keys = {};
__u32 key = (__u32)(tests[i].keys.sport) << 16 |
tests[i].keys.dport;
+ snprintf(test_name, TEST_NAME_MAX_LEN, "%s-%s", tests[i].name,
+ test_suffix);
+ if (!test__start_subtest(test_name))
+ continue;
/* For skb-less case we can't pass input flags; run
* only the tests that have a matching set of flags.
@@ -582,7 +589,8 @@ void test_flow_dissector_skb_less_direct_attach(void)
if (!ASSERT_OK(err, "ifup"))
goto out_close_tap;
- run_tests_skb_less(tap_fd, skel->maps.last_dissection);
+ run_tests_skb_less(tap_fd, skel->maps.last_dissection,
+ "non-skb-direct-attach");
err = bpf_prog_detach2(prog_fd, 0, BPF_FLOW_DISSECTOR);
ASSERT_OK(err, "bpf_prog_detach2");
@@ -629,7 +637,8 @@ void test_flow_dissector_skb_less_indirect_attach(void)
if (!ASSERT_OK_PTR(link, "attach_netns"))
goto out_close_tap;
- run_tests_skb_less(tap_fd, skel->maps.last_dissection);
+ run_tests_skb_less(tap_fd, skel->maps.last_dissection,
+ "non-skb-indirect-attach");
err = bpf_link__destroy(link);
ASSERT_OK(err, "bpf_link__destroy");
@@ -646,6 +655,7 @@ void test_flow_dissector_skb_less_indirect_attach(void)
void test_flow_dissector_skb(void)
{
+ char test_name[TEST_NAME_MAX_LEN];
struct bpf_flow *skel;
int i, err, prog_fd;
@@ -670,6 +680,10 @@ void test_flow_dissector_skb(void)
);
static struct bpf_flow_keys ctx = {};
+ snprintf(test_name, TEST_NAME_MAX_LEN, "%s-skb", tests[i].name);
+ if (!test__start_subtest(test_name))
+ continue;
+
if (tests[i].flags) {
topts.ctx_in = &ctx;
topts.ctx_size_in = sizeof(ctx);
--
2.47.0
next prev parent reply other threads:[~2024-11-20 7:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-20 7:43 [PATCH bpf-next v3 00/14] selftests/bpf: migrate test_flow_dissector.sh to test_progs Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 01/14] selftests/bpf: add a macro to compare raw memory Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 02/14] selftests/bpf: use ASSERT_MEMEQ to compare bpf flow keys Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 03/14] selftests/bpf: replace CHECK calls with ASSERT macros in flow_dissector test Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 04/14] selftests/bpf: re-split main function into dedicated tests Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` Alexis Lothoré (eBPF Foundation) [this message]
2024-11-20 7:43 ` [PATCH bpf-next v3 06/14] selftests/bpf: add gre packets testing to flow_dissector Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 07/14] selftests/bpf: migrate flow_dissector namespace exclusivity test Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 08/14] selftests/bpf: Enable generic tc actions in selftests config Alexis Lothoré (eBPF Foundation)
2024-11-20 7:43 ` [PATCH bpf-next v3 09/14] selftests/bpf: move ip checksum helper to network helpers Alexis Lothoré (eBPF Foundation)
2024-11-20 15:55 ` Stanislav Fomichev
2024-11-20 7:43 ` [PATCH bpf-next v3 10/14] selftests/bpf: document pseudo-header checksum helpers Alexis Lothoré (eBPF Foundation)
2024-11-20 15:55 ` Stanislav Fomichev
2024-11-20 7:43 ` [PATCH bpf-next v3 11/14] selftests/bpf: use the same udp and tcp headers in tests under test_progs Alexis Lothoré (eBPF Foundation)
2024-11-20 15:55 ` Stanislav Fomichev
2024-11-20 7:43 ` [PATCH bpf-next v3 12/14] selftests/bpf: add network helpers to generate udp checksums Alexis Lothoré (eBPF Foundation)
2024-11-20 15:56 ` Stanislav Fomichev
2024-11-20 7:43 ` [PATCH bpf-next v3 13/14] selftests/bpf: migrate bpf flow dissectors tests to test_progs Alexis Lothoré (eBPF Foundation)
2024-11-20 15:56 ` Stanislav Fomichev
2024-11-20 7:43 ` [PATCH bpf-next v3 14/14] selftests/bpf: remove test_flow_dissector.sh Alexis Lothoré (eBPF Foundation)
2024-11-25 22:10 ` [PATCH bpf-next v3 00/14] selftests/bpf: migrate test_flow_dissector.sh to test_progs patchwork-bot+netdevbpf
2024-11-26 10:48 ` Alexis Lothoré
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241120-flow_dissector-v3-5-45b46494f937@bootlin.com \
--to=alexis.lothore@bootlin.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bastien.curutchet@bootlin.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ebpf@linuxfoundation.org \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox