[PATCH mptcp-next] Squash to "selftests/bpf: Add mptcp subflow subtest"

Geliang Tang posted 1 patch 2 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/fccaccd2e7a1ce8518782c85965a6e26d37a87f9.1721872694.git.tanggeliang@kylinos.cn
There is a newer version of this series
tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
[PATCH mptcp-next] Squash to "selftests/bpf: Add mptcp subflow subtest"
Posted by Geliang Tang 2 months, 3 weeks ago
From: Geliang Tang <tanggeliang@kylinos.cn>

Skip the test with test__skip() for systems that do not
support "ip mptcp", so that CI can also pass.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
index 00f63f3f19f4..ddef8c61360f 100644
--- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
+++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
@@ -357,10 +357,11 @@ static int endpoint_init(char *flags)
 	SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST);
 	SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST, ADDR_2);
 	SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST);
-	/* It would be better to use  "ip -net %s mptcp endpoint add %s %s",
-	 * but the BPF CI is using an old version of IPRoute (5.5.0).
-	 */
-	SYS(fail, "ip netns exec %s ./mptcp_pm_nl_ctl add %s flags %s", NS_TEST, ADDR_2, flags);
+	if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, flags)) {
+		/* "ip mptcp" not support, skip this test. */
+		test__skip();
+		goto fail;
+	}
 
 	return 0;
 fail:
@@ -435,7 +436,7 @@ static void test_subflow(void)
 	if (!ASSERT_OK_PTR(nstoken, "create_netns: mptcp_subflow"))
 		goto skel_destroy;
 
-	if (!ASSERT_OK(endpoint_init("subflow"), "endpoint_init"))
+	if (endpoint_init("subflow"))
 		goto close_netns;
 
 	run_subflow(skel->data->cc);
-- 
2.43.0
Re: [PATCH mptcp-next] Squash to "selftests/bpf: Add mptcp subflow subtest"
Posted by Matthieu Baerts 2 months, 3 weeks ago
Hi Geliang,

Thank you for the patch!

On 25/07/2024 03:58, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> Skip the test with test__skip() for systems that do not
> support "ip mptcp", so that CI can also pass.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index 00f63f3f19f4..ddef8c61360f 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> @@ -357,10 +357,11 @@ static int endpoint_init(char *flags)
>  	SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST);
>  	SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST, ADDR_2);
>  	SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST);
> -	/* It would be better to use  "ip -net %s mptcp endpoint add %s %s",
> -	 * but the BPF CI is using an old version of IPRoute (5.5.0).
> -	 */
> -	SYS(fail, "ip netns exec %s ./mptcp_pm_nl_ctl add %s flags %s", NS_TEST, ADDR_2, flags);
> +	if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s", NS_TEST, ADDR_2, flags)) {

This will silently mark the test as skipped, because stderr will be muted.

> +		/* "ip mptcp" not support, skip this test. */

Could it be possible to at least print this comment? I can add:

  fprintf(stderr, "'ip mptcp' not supported, skip this test.\n");

when applying the patch. WDYT?

> +		test__skip();
> +		goto fail;
> +	}
>  
>  	return 0;
>  fail:
> @@ -435,7 +436,7 @@ static void test_subflow(void)
>  	if (!ASSERT_OK_PTR(nstoken, "create_netns: mptcp_subflow"))
>  		goto skel_destroy;
>  
> -	if (!ASSERT_OK(endpoint_init("subflow"), "endpoint_init"))
> +	if (endpoint_init("subflow"))
>  		goto close_netns;
>  
>  	run_subflow(skel->data->cc);

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next] Squash to "selftests/bpf: Add mptcp subflow subtest"
Posted by Geliang Tang 2 months, 3 weeks ago
Hi Matt,

On Fri, 2024-07-26 at 11:18 +0200, Matthieu Baerts wrote:
> Hi Geliang,
> 
> Thank you for the patch!
> 
> On 25/07/2024 03:58, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> > 
> > Skip the test with test__skip() for systems that do not
> > support "ip mptcp", so that CI can also pass.
> > 
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > ---
> >  tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > index 00f63f3f19f4..ddef8c61360f 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> > @@ -357,10 +357,11 @@ static int endpoint_init(char *flags)
> >  	SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST);
> >  	SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST,
> > ADDR_2);
> >  	SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST);
> > -	/* It would be better to use  "ip -net %s mptcp endpoint
> > add %s %s",
> > -	 * but the BPF CI is using an old version of IPRoute
> > (5.5.0).
> > -	 */
> > -	SYS(fail, "ip netns exec %s ./mptcp_pm_nl_ctl add %s flags
> > %s", NS_TEST, ADDR_2, flags);
> > +	if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s",
> > NS_TEST, ADDR_2, flags)) {
> 
> This will silently mark the test as skipped, because stderr will be
> muted.
> 
> > +		/* "ip mptcp" not support, skip this test. */
> 
> Could it be possible to at least print this comment? I can add:
> 
>   fprintf(stderr, "'ip mptcp' not supported, skip this test.\n");
> 
> when applying the patch. WDYT?

Martin, BPF maintainer, replied on "[v3 2/3] selftests/bpf: Add mptcp
pm_nl_ctl link" recently to suggest us to send a v4 of it, if then, no
need to apply this squash-to patch at this moment. Please send a v4 to
continue using mptcp pm_nl_ctl.

Sorry for the confusion caused.

Thanks,
-Geliang

> 
> > +		test__skip();
> > +		goto fail;
> > +	}
> >  
> >  	return 0;
> >  fail:
> > @@ -435,7 +436,7 @@ static void test_subflow(void)
> >  	if (!ASSERT_OK_PTR(nstoken, "create_netns:
> > mptcp_subflow"))
> >  		goto skel_destroy;
> >  
> > -	if (!ASSERT_OK(endpoint_init("subflow"), "endpoint_init"))
> > +	if (endpoint_init("subflow"))
> >  		goto close_netns;
> >  
> >  	run_subflow(skel->data->cc);
> 
> Cheers,
> Matt

Re: [PATCH mptcp-next] Squash to "selftests/bpf: Add mptcp subflow subtest"
Posted by Matthieu Baerts 2 months, 2 weeks ago
Hi Geliang,

On 27/07/2024 03:12, Geliang Tang wrote:
> Hi Matt,
> 
> On Fri, 2024-07-26 at 11:18 +0200, Matthieu Baerts wrote:
>> Hi Geliang,
>>
>> Thank you for the patch!
>>
>> On 25/07/2024 03:58, Geliang Tang wrote:
>>> From: Geliang Tang <tanggeliang@kylinos.cn>
>>>
>>> Skip the test with test__skip() for systems that do not
>>> support "ip mptcp", so that CI can also pass.
>>>
>>> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
>>> ---
>>>  tools/testing/selftests/bpf/prog_tests/mptcp.c | 11 ++++++-----
>>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c
>>> b/tools/testing/selftests/bpf/prog_tests/mptcp.c
>>> index 00f63f3f19f4..ddef8c61360f 100644
>>> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
>>> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
>>> @@ -357,10 +357,11 @@ static int endpoint_init(char *flags)
>>>  	SYS(fail, "ip -net %s link set dev veth1 up", NS_TEST);
>>>  	SYS(fail, "ip -net %s addr add %s/24 dev veth2", NS_TEST,
>>> ADDR_2);
>>>  	SYS(fail, "ip -net %s link set dev veth2 up", NS_TEST);
>>> -	/* It would be better to use  "ip -net %s mptcp endpoint
>>> add %s %s",
>>> -	 * but the BPF CI is using an old version of IPRoute
>>> (5.5.0).
>>> -	 */
>>> -	SYS(fail, "ip netns exec %s ./mptcp_pm_nl_ctl add %s flags
>>> %s", NS_TEST, ADDR_2, flags);
>>> +	if (SYS_NOFAIL("ip -net %s mptcp endpoint add %s %s",
>>> NS_TEST, ADDR_2, flags)) {
>>
>> This will silently mark the test as skipped, because stderr will be
>> muted.
>>
>>> +		/* "ip mptcp" not support, skip this test. */
>>
>> Could it be possible to at least print this comment? I can add:
>>
>>   fprintf(stderr, "'ip mptcp' not supported, skip this test.\n");
>>
>> when applying the patch. WDYT?
> 
> Martin, BPF maintainer, replied on "[v3 2/3] selftests/bpf: Add mptcp
> pm_nl_ctl link" recently to suggest us to send a v4 of it, if then, no
> need to apply this squash-to patch at this moment. Please send a v4 to
> continue using mptcp pm_nl_ctl.

Thank you for this note. The modifications I suggested might require
some changes of their CI. I think it should not, but I need to check. In
other words, it might take some time.

Would it be OK to apply your patch (with the fprintf()) to remove the
dependency on mptcp_pm_nl_ctl, and send this first? After or in
parallel, I can check what I suggested before. If this modification is
accepted, and their CI is still using an old IPRoute version, then we
can (re-)add mptcp_pm_nl_ctl. WDYT?

> 
> Sorry for the confusion caused.
> 
> Thanks,
> -Geliang
> 
>>
>>> +		test__skip();
>>> +		goto fail;
>>> +	}
>>>  
>>>  	return 0;
>>>  fail:
>>> @@ -435,7 +436,7 @@ static void test_subflow(void)
>>>  	if (!ASSERT_OK_PTR(nstoken, "create_netns:
>>> mptcp_subflow"))
>>>  		goto skel_destroy;
>>>  
>>> -	if (!ASSERT_OK(endpoint_init("subflow"), "endpoint_init"))
>>> +	if (endpoint_init("subflow"))
>>>  		goto close_netns;
>>>  
>>>  	run_subflow(skel->data->cc);
>>
>> Cheers,
>> Matt
> 

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.