Skip to content

Commit 77a7a82

Browse files
danobiAlexei Starovoitov
authored andcommitted
bpf: selftests: test_tunnel: Setup fresh topology for each subtest
This helps with determinism b/c individual setup/teardown prevents leaking state between different subtests. Signed-off-by: Daniel Xu <[email protected]> Link: https://lore.kernel.org/r/0fb59fa16fb58cca7def5239df606005a3e8dd0e.1702593901.git.dxu@dxuuu.xyz Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 8f0ec8c commit 77a7a82

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tools/testing/selftests/bpf/prog_tests/test_tunnel.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,23 +535,20 @@ static void test_ipip_tunnel(enum ipip_encap encap)
535535
#define RUN_TEST(name, ...) \
536536
({ \
537537
if (test__start_subtest(#name)) { \
538+
config_device(); \
538539
test_ ## name(__VA_ARGS__); \
540+
cleanup(); \
539541
} \
540542
})
541543

542544
static void *test_tunnel_run_tests(void *arg)
543545
{
544-
cleanup();
545-
config_device();
546-
547546
RUN_TEST(vxlan_tunnel);
548547
RUN_TEST(ip6vxlan_tunnel);
549548
RUN_TEST(ipip_tunnel, NONE);
550549
RUN_TEST(ipip_tunnel, FOU);
551550
RUN_TEST(ipip_tunnel, GUE);
552551

553-
cleanup();
554-
555552
return NULL;
556553
}
557554

0 commit comments

Comments
 (0)