All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Xu <dxu@dxuuu.xyz>
To: daniel@iogearbox.net, shuah@kernel.org, andrii@kernel.org,
	ast@kernel.org, steffen.klassert@secunet.com,
	antony.antony@secunet.com, alexei.starovoitov@gmail.com,
	yonghong.song@linux.dev, eddyz87@gmail.com
Cc: martin.lau@linux.dev, song@kernel.org, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
	jolsa@kernel.org, mykolal@fb.com, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	devel@linux-ipsec.org, netdev@vger.kernel.org
Subject: [PATCH bpf-next v4 07/10] bpf: selftests: test_tunnel: Setup fresh topology for each subtest
Date: Mon,  4 Dec 2023 13:56:27 -0700	[thread overview]
Message-ID: <5292165f1f64883b5fc6354a9a24fb8074e3c2c6.1701722991.git.dxu@dxuuu.xyz> (raw)
In-Reply-To: <cover.1701722991.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-04 20:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 20:56 [PATCH bpf-next v4 00/10] Add bpf_xdp_get_xfrm_state() kfunc Daniel Xu
2023-12-04 20:56 ` [PATCH bpf-next v4 01/10] xfrm: bpf: Move xfrm_interface_bpf.c to xfrm_bpf.c Daniel Xu
2023-12-05  1:58   ` Alexei Starovoitov
2023-12-07 11:52   ` Steffen Klassert
2023-12-07 21:08     ` [devel-ipsec] " Eyal Birger
2023-12-08  8:35       ` Steffen Klassert
2023-12-09  0:04       ` Daniel Xu
2023-12-04 20:56 ` [PATCH bpf-next v4 02/10] bpf: xfrm: Add bpf_xdp_get_xfrm_state() kfunc Daniel Xu
2023-12-07 11:53   ` Steffen Klassert
2023-12-07 21:21   ` Eyal Birger
2023-12-09  0:07     ` Daniel Xu
2023-12-04 20:56 ` [PATCH bpf-next v4 03/10] bpf: xfrm: Add bpf_xdp_xfrm_state_release() kfunc Daniel Xu
2023-12-07 11:54   ` Steffen Klassert
2023-12-04 20:56 ` [PATCH bpf-next v4 04/10] libbpf: Add BPF_CORE_WRITE_BITFIELD() macro Daniel Xu
2023-12-05  4:03   ` Andrii Nakryiko
2023-12-04 20:56 ` [PATCH bpf-next v4 05/10] bpf: selftests: test_loader: Support __btf_path() annotation Daniel Xu
2023-12-04 20:56 ` [PATCH bpf-next v4 06/10] libbpf: selftests: Add verifier tests for CO-RE bitfield writes Daniel Xu
2023-12-05  4:05   ` Andrii Nakryiko
2023-12-04 20:56 ` Daniel Xu [this message]
2023-12-04 20:56 ` [PATCH bpf-next v4 08/10] bpf: selftests: test_tunnel: Use vmlinux.h declarations Daniel Xu
2023-12-04 20:56 ` [PATCH bpf-next v4 09/10] bpf: selftests: Move xfrm tunnel test to test_progs Daniel Xu
2023-12-04 20:56 ` [PATCH bpf-next v4 10/10] bpf: xfrm: Add selftest for bpf_xdp_get_xfrm_state() Daniel Xu

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=5292165f1f64883b5fc6354a9a24fb8074e3c2c6.1701722991.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.