Message ID | ca8f8f11a0437a4d0cc43582342f8780f262f888.1684362296.git.geliang.tang@suse.com (mailing list archive) |
---|---|
State | Accepted, archived |
Commit | 022ddca0dd31223de56768d4ef259c7f9720eb2f |
Delegated to: | Matthieu Baerts |
Headers | show |
Series | run sched tests in a dedicated ns | expand |
Context | Check | Description |
---|---|---|
matttbe/KVM_Validation__normal__only_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/KVM_Validation__debug__except_selftest_mptcp_join_ | warning | Unstable: 4 failed test(s): packetdrill_fastopen packetdrill_mp_capable packetdrill_sockopts selftest_diag |
matttbe/KVM_Validation__debug__only_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/build | success | Build and static analysis OK |
matttbe/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
matttbe/KVM_Validation__normal__except_selftest_mptcp_join_ | warning | Unstable: 1 failed test(s): packetdrill_fastopen |
Hi Geliang, On 18/05/2023 00:29, Geliang Tang wrote: > Use rand() to generate a random netns name instead of using the fixed > name "mptcp_ns" for every test. > > Fixes: 02d6a057c7be ("selftests/bpf: run mptcp in a dedicated netns") If we add the "Fixes" tag, it somehow means the previous behaviour was buggy. I agree that it is better to do what you did here just in case the previous netns has not been removed when re-launching the same test multiple time (what a CI would not do I guess) but I also see that most (all?) other BPF tests creating netns' use a fixed name. I hope you don't mind if I then remove this Fixes tag when applying the patch. While at it, I will also explain the reason why this patch is needed, something like: By doing that, we can re-launch the test even if there was an issue removing the previous netns or if by accident, a netns with this generic name already existed on the system. Note that using a different name each will also help adding more subtests in future commits. Cheers, Matt
diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c index de8b6c68fc30..8040997e4aef 100644 --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c @@ -11,7 +11,7 @@ #include "mptcp_bpf_rr.skel.h" #include "mptcp_bpf_red.skel.h" -#define NS_TEST "mptcp_ns" +char NS_TEST[32]; #ifndef TCP_CA_NAME_MAX #define TCP_CA_NAME_MAX 16 @@ -151,6 +151,8 @@ static void test_base(void) if (!ASSERT_GE(cgroup_fd, 0, "test__join_cgroup")) return; + srand(time(NULL)); + snprintf(NS_TEST, sizeof(NS_TEST), "mptcp_ns_%d", rand()); SYS(fail, "ip netns add %s", NS_TEST); SYS(fail, "ip -net %s link set dev lo up", NS_TEST);
Use rand() to generate a random netns name instead of using the fixed name "mptcp_ns" for every test. Fixes: 02d6a057c7be ("selftests/bpf: run mptcp in a dedicated netns") Signed-off-by: Geliang Tang <geliang.tang@suse.com> --- tools/testing/selftests/bpf/prog_tests/mptcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)