All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Xu <dxu@dxuuu.xyz>
To: ast@kernel.org, daniel@iogearbox.net, shuah@kernel.org,
	andrii@kernel.org, steffen.klassert@secunet.com,
	antony.antony@secunet.com, alexei.starovoitov@gmail.com,
	yonghong.song@linux.dev, eddyz87@gmail.com
Cc: mykolal@fb.com, martin.lau@linux.dev, song@kernel.org,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	devel@linux-ipsec.org, netdev@vger.kernel.org
Subject: [PATCH ipsec-next v3 6/9] bpf: selftests: test_tunnel: Setup fresh topology for each subtest
Date: Fri,  1 Dec 2023 13:23:17 -0700	[thread overview]
Message-ID: <0441399633380f6ac1bd34ae6e5bf668fb7b83ce.1701462010.git.dxu@dxuuu.xyz> (raw)
In-Reply-To: <cover.1701462010.git.dxu@dxuuu.xyz>

This helps with determinism b/c individual setup/teardown prevents
leaking state between different subtests.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 tools/testing/selftests/bpf/prog_tests/test_tunnel.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/test_tunnel.c b/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
index d149ab98798d..b57d48219d0b 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
@@ -535,23 +535,20 @@ static void test_ipip_tunnel(enum ipip_encap encap)
 #define RUN_TEST(name, ...)						\
 	({								\
 		if (test__start_subtest(#name)) {			\
+			config_device();				\
 			test_ ## name(__VA_ARGS__);			\
+			cleanup();					\
 		}							\
 	})
 
 static void *test_tunnel_run_tests(void *arg)
 {
-	cleanup();
-	config_device();
-
 	RUN_TEST(vxlan_tunnel);
 	RUN_TEST(ip6vxlan_tunnel);
 	RUN_TEST(ipip_tunnel, NONE);
 	RUN_TEST(ipip_tunnel, FOU);
 	RUN_TEST(ipip_tunnel, GUE);
 
-	cleanup();
-
 	return NULL;
 }
 
-- 
2.42.1


  parent reply	other threads:[~2023-12-01 20:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 20:23 [PATCH ipsec-next v3 0/9] Add bpf_xdp_get_xfrm_state() kfunc Daniel Xu
2023-12-01 20:23 ` [PATCH ipsec-next v3 1/9] bpf: xfrm: " Daniel Xu
2023-12-01 20:23 ` [PATCH ipsec-next v3 2/9] bpf: xfrm: Add bpf_xdp_xfrm_state_release() kfunc Daniel Xu
2023-12-01 20:23 ` [PATCH ipsec-next v3 3/9] libbpf: Add BPF_CORE_WRITE_BITFIELD() macro Daniel Xu
2023-12-01 20:51   ` [devel-ipsec] " Daniel Xu
2023-12-01 21:22     ` Eduard Zingerman
2023-12-01 23:49   ` Andrii Nakryiko
2023-12-02  0:13     ` Daniel Xu
2023-12-02  0:40       ` Andrii Nakryiko
2023-12-01 20:23 ` [PATCH ipsec-next v3 4/9] bpf: selftests: test_loader: Support __btf_path() annotation Daniel Xu
2023-12-01 23:50   ` Andrii Nakryiko
2023-12-01 20:23 ` [PATCH ipsec-next v3 5/9] libbpf: selftests: Add verifier tests for CO-RE bitfield writes Daniel Xu
2023-12-01 23:52   ` Andrii Nakryiko
2023-12-02  0:10     ` Daniel Xu
2023-12-02  0:20       ` Eduard Zingerman
2023-12-01 20:23 ` Daniel Xu [this message]
2023-12-01 20:23 ` [PATCH ipsec-next v3 7/9] bpf: selftests: test_tunnel: Use vmlinux.h declarations Daniel Xu
2023-12-01 20:23 ` [PATCH ipsec-next v3 8/9] bpf: selftests: Move xfrm tunnel test to test_progs Daniel Xu
2023-12-01 20:23 ` [PATCH ipsec-next v3 9/9] bpf: xfrm: Add selftest for bpf_xdp_get_xfrm_state() Daniel Xu
2023-12-02  0:10 ` [PATCH ipsec-next v3 0/9] Add bpf_xdp_get_xfrm_state() kfunc Alexei Starovoitov
2023-12-02  0:16   ` Daniel Xu
2023-12-04  8:25     ` Steffen Klassert

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=0441399633380f6ac1bd34ae6e5bf668fb7b83ce.1701462010.git.dxu@dxuuu.xyz \
    --to=dxu@dxuuu.xyz \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=antony.antony@secunet.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=devel@linux-ipsec.org \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@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@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=steffen.klassert@secunet.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.