[PATCH bpf-next 3/3] selftests/bpf: tc_links/tc_opts: Serialize tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The tests aren't allowed to be run in parallel while they could be.

Replace serial_test_*() calls by test_*() ones to allow parallelization
of these tests.
Rename some 'subtests' functions to avoid name conflicts with the actual
tests.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <bastien.curutchet@xxxxxxxxxxx>
---
 tools/testing/selftests/bpf/prog_tests/tc_links.c | 40 +++++++++---------
 tools/testing/selftests/bpf/prog_tests/tc_opts.c  | 50 +++++++++++------------
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/tc_links.c b/tools/testing/selftests/bpf/prog_tests/tc_links.c
index 07a2fc3d44d03e18dd3c715b0b26c7f1ac6d47cb..c94fe1e1687239ed4090f53bff40ede10e501f55 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_links.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_links.c
@@ -269,7 +269,7 @@ static void test_tc_links_before_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_before(void)
+void test_tc_links_before(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -432,7 +432,7 @@ static void test_tc_links_after_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_after(void)
+void test_tc_links_after(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -541,7 +541,7 @@ static void test_tc_links_revision_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_revision(void)
+void test_tc_links_revision(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -654,7 +654,7 @@ static void test_tc_chain_classic(int target, bool chain_tc_old)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_chain_classic(void)
+void test_tc_links_chain_classic(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -891,7 +891,7 @@ static void test_tc_links_replace_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_replace(void)
+void test_tc_links_replace(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1212,7 +1212,7 @@ static void test_tc_links_invalid_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_invalid(void)
+void test_tc_links_invalid(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1377,7 +1377,7 @@ static void test_tc_links_prepend_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_prepend(void)
+void test_tc_links_prepend(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1542,7 +1542,7 @@ static void test_tc_links_append_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_append(void)
+void test_tc_links_append(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1649,7 +1649,7 @@ static void test_tc_links_dev_cleanup_target(int target)
 	ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
 }
 
-void serial_test_tc_links_dev_cleanup(void)
+void test_tc_links_dev_cleanup(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1762,7 +1762,7 @@ static void test_tc_chain_mixed(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_links_chain_mixed(void)
+void test_tc_links_chain_mixed(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1777,7 +1777,7 @@ void serial_test_tc_links_chain_mixed(void)
 	netns_free(ns);
 }
 
-static void test_tc_links_ingress(int target, bool chain_tc_old,
+static void tc_links_ingress(int target, bool chain_tc_old,
 				  bool tcx_teardown_first)
 {
 	LIBBPF_OPTS(bpf_tc_opts, tc_opts,
@@ -1881,7 +1881,7 @@ static void test_tc_links_ingress(int target, bool chain_tc_old,
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_links_ingress(void)
+void test_tc_links_ingress(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1890,9 +1890,9 @@ void serial_test_tc_links_ingress(void)
 	if (!ASSERT_OK_PTR(ns, "create and open ns"))
 		return;
 
-	test_tc_links_ingress(BPF_TCX_INGRESS, true, true);
-	test_tc_links_ingress(BPF_TCX_INGRESS, true, false);
-	test_tc_links_ingress(BPF_TCX_INGRESS, false, false);
+	tc_links_ingress(BPF_TCX_INGRESS, true, true);
+	tc_links_ingress(BPF_TCX_INGRESS, true, false);
+	tc_links_ingress(BPF_TCX_INGRESS, false, false);
 
 	netns_free(ns);
 }
@@ -1931,7 +1931,7 @@ static int qdisc_replace(int ifindex, const char *kind, bool block)
 	return err;
 }
 
-void serial_test_tc_links_dev_chain0(void)
+void test_tc_links_dev_chain0(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1963,7 +1963,7 @@ void serial_test_tc_links_dev_chain0(void)
 	netns_free(ns);
 }
 
-static void test_tc_links_dev_mixed(int target)
+static void tc_links_dev_mixed(int target)
 {
 	LIBBPF_OPTS(bpf_tc_opts, tc_opts, .handle = 1, .priority = 1);
 	LIBBPF_OPTS(bpf_tc_hook, tc_hook);
@@ -2070,7 +2070,7 @@ static void test_tc_links_dev_mixed(int target)
 	ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
 }
 
-void serial_test_tc_links_dev_mixed(void)
+void test_tc_links_dev_mixed(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2079,8 +2079,8 @@ void serial_test_tc_links_dev_mixed(void)
 	if (!ASSERT_OK_PTR(ns, "create and open ns"))
 		return;
 
-	test_tc_links_dev_mixed(BPF_TCX_INGRESS);
-	test_tc_links_dev_mixed(BPF_TCX_EGRESS);
+	tc_links_dev_mixed(BPF_TCX_INGRESS);
+	tc_links_dev_mixed(BPF_TCX_EGRESS);
 
 	netns_free(ns);
 }
diff --git a/tools/testing/selftests/bpf/prog_tests/tc_opts.c b/tools/testing/selftests/bpf/prog_tests/tc_opts.c
index d38376244532026b2b3d505bcf9711c8e7948e17..615048fc3cd7b497b49883bf4c1ba410efce52f0 100644
--- a/tools/testing/selftests/bpf/prog_tests/tc_opts.c
+++ b/tools/testing/selftests/bpf/prog_tests/tc_opts.c
@@ -12,7 +12,7 @@
 #include "test_tc_link.skel.h"
 #include "tc_helpers.h"
 
-void serial_test_tc_opts_basic(void)
+void test_tc_opts_basic(void)
 {
 	LIBBPF_OPTS(bpf_prog_attach_opts, opta);
 	LIBBPF_OPTS(bpf_prog_detach_opts, optd);
@@ -263,7 +263,7 @@ static void test_tc_opts_before_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_before(void)
+void test_tc_opts_before(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -463,7 +463,7 @@ static void test_tc_opts_after_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_after(void)
+void test_tc_opts_after(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -581,7 +581,7 @@ static void test_tc_opts_revision_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_revision(void)
+void test_tc_opts_revision(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -691,7 +691,7 @@ static void test_tc_chain_classic(int target, bool chain_tc_old)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_opts_chain_classic(void)
+void test_tc_opts_chain_classic(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -909,7 +909,7 @@ static void test_tc_opts_replace_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_replace(void)
+void test_tc_opts_replace(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1071,7 +1071,7 @@ static void test_tc_opts_invalid_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_invalid(void)
+void test_tc_opts_invalid(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1220,7 +1220,7 @@ static void test_tc_opts_prepend_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_prepend(void)
+void test_tc_opts_prepend(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1369,7 +1369,7 @@ static void test_tc_opts_append_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_append(void)
+void test_tc_opts_append(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1468,7 +1468,7 @@ static void test_tc_opts_dev_cleanup_target(int target)
 	ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
 }
 
-void serial_test_tc_opts_dev_cleanup(void)
+void test_tc_opts_dev_cleanup(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1653,7 +1653,7 @@ static void test_tc_opts_mixed_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_opts_mixed(void)
+void test_tc_opts_mixed(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1741,7 +1741,7 @@ static void test_tc_opts_demixed_target(int target)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_opts_demixed(void)
+void test_tc_opts_demixed(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -1921,7 +1921,7 @@ static void test_tc_opts_detach_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_detach(void)
+void test_tc_opts_detach(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2137,7 +2137,7 @@ static void test_tc_opts_detach_before_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_detach_before(void)
+void test_tc_opts_detach_before(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2362,7 +2362,7 @@ static void test_tc_opts_detach_after_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_detach_after(void)
+void test_tc_opts_detach_after(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2377,7 +2377,7 @@ void serial_test_tc_opts_detach_after(void)
 	netns_free(ns);
 }
 
-static void test_tc_opts_delete_empty(int target, bool chain_tc_old)
+static void tc_opts_delete_empty(int target, bool chain_tc_old)
 {
 	LIBBPF_OPTS(bpf_tc_hook, tc_hook, .ifindex = loopback);
 	LIBBPF_OPTS(bpf_prog_detach_opts, optd);
@@ -2400,7 +2400,7 @@ static void test_tc_opts_delete_empty(int target, bool chain_tc_old)
 	assert_mprog_count(target, 0);
 }
 
-void serial_test_tc_opts_delete_empty(void)
+void test_tc_opts_delete_empty(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2409,10 +2409,10 @@ void serial_test_tc_opts_delete_empty(void)
 	if (!ASSERT_OK_PTR(ns, "create and open ns"))
 		return;
 
-	test_tc_opts_delete_empty(BPF_TCX_INGRESS, false);
-	test_tc_opts_delete_empty(BPF_TCX_EGRESS, false);
-	test_tc_opts_delete_empty(BPF_TCX_INGRESS, true);
-	test_tc_opts_delete_empty(BPF_TCX_EGRESS, true);
+	tc_opts_delete_empty(BPF_TCX_INGRESS, false);
+	tc_opts_delete_empty(BPF_TCX_EGRESS, false);
+	tc_opts_delete_empty(BPF_TCX_INGRESS, true);
+	tc_opts_delete_empty(BPF_TCX_EGRESS, true);
 
 	netns_free(ns);
 }
@@ -2516,7 +2516,7 @@ static void test_tc_chain_mixed(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_chain_mixed(void)
+void test_tc_opts_chain_mixed(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2599,7 +2599,7 @@ static void test_tc_opts_max_target(int target, int flags, bool relative)
 	ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
 }
 
-void serial_test_tc_opts_max(void)
+void test_tc_opts_max(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2910,7 +2910,7 @@ static void test_tc_opts_query_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_query(void)
+void test_tc_opts_query(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;
@@ -2978,7 +2978,7 @@ static void test_tc_opts_query_attach_target(int target)
 	test_tc_link__destroy(skel);
 }
 
-void serial_test_tc_opts_query_attach(void)
+void test_tc_opts_query_attach(void)
 {
 	char ns_name[NS_NAME_MAX_LEN] = NS_NAME;
 	struct netns_obj *ns;

-- 
2.48.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux