diff mbox series

[SRU,REGRESSION,Eoan,1/1] selftests: Fix bpf reuseport test

Message ID 20200409152606.17305-1-stefan.bader@canonical.com
State New
Headers show
Series [SRU,REGRESSION,Eoan,1/1] selftests: Fix bpf reuseport test | expand

Commit Message

Stefan Bader April 9, 2020, 3:26 p.m. UTC
The IF_ERR macro is not yet defined, replace it with CHECK.
Alternatively we would have to revert the following patch:

  commit 1740b79aed7b5a121bb07ce30e4473225545b9d2
  Author: Lorenz Bauer <lmb@cloudflare.com>
  Date:   Fri Jan 24 11:27:54 2020 +0000

    selftests: bpf: Reset global state between reuseport test runs

BugLink: https://bugs.launchpad.net/bugs/1871613

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 tools/testing/selftests/bpf/test_select_reuseport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Colin Ian King April 9, 2020, 3:30 p.m. UTC | #1
On 09/04/2020 16:26, Stefan Bader wrote:
> The IF_ERR macro is not yet defined, replace it with CHECK.
> Alternatively we would have to revert the following patch:
> 
>   commit 1740b79aed7b5a121bb07ce30e4473225545b9d2
>   Author: Lorenz Bauer <lmb@cloudflare.com>
>   Date:   Fri Jan 24 11:27:54 2020 +0000
> 
>     selftests: bpf: Reset global state between reuseport test runs
> 
> BugLink: https://bugs.launchpad.net/bugs/1871613
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  tools/testing/selftests/bpf/test_select_reuseport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c
> index 079d0f5a2909..567912df9c74 100644
> --- a/tools/testing/selftests/bpf/test_select_reuseport.c
> +++ b/tools/testing/selftests/bpf/test_select_reuseport.c
> @@ -668,12 +668,12 @@ static void cleanup_per_test(void)
>  
>  	for (i = 0; i < NR_RESULTS; i++) {
>  		err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
> -		RET_IF(err, "reset elem in result_map",
> +		CHECK(err == -1, "reset elem in result_map",
>  		       "i:%u err:%d errno:%d\n", i, err, errno);
>  	}
>  
>  	err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
> -	RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
> +	CHECK(err == -1, "reset line number in linum_map", "err:%d errno:%d\n",
>  	       err, errno);
>  
>  	for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
> 

LGTM

Acked-by: Colin Ian King <colin.king@canonical.com>
Kleber Sacilotto de Souza April 9, 2020, 3:58 p.m. UTC | #2
On 09.04.20 17:26, Stefan Bader wrote:
> The IF_ERR macro is not yet defined, replace it with CHECK.
> Alternatively we would have to revert the following patch:
> 
>   commit 1740b79aed7b5a121bb07ce30e4473225545b9d2
>   Author: Lorenz Bauer <lmb@cloudflare.com>
>   Date:   Fri Jan 24 11:27:54 2020 +0000
> 
>     selftests: bpf: Reset global state between reuseport test runs
> 
> BugLink: https://bugs.launchpad.net/bugs/1871613
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>

Makes sense. Should it be a 'UBUNTU: SAUCE' patch?

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> 

> ---
>  tools/testing/selftests/bpf/test_select_reuseport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c
> index 079d0f5a2909..567912df9c74 100644
> --- a/tools/testing/selftests/bpf/test_select_reuseport.c
> +++ b/tools/testing/selftests/bpf/test_select_reuseport.c
> @@ -668,12 +668,12 @@ static void cleanup_per_test(void)
>  
>  	for (i = 0; i < NR_RESULTS; i++) {
>  		err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
> -		RET_IF(err, "reset elem in result_map",
> +		CHECK(err == -1, "reset elem in result_map",
>  		       "i:%u err:%d errno:%d\n", i, err, errno);
>  	}
>  
>  	err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
> -	RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
> +	CHECK(err == -1, "reset line number in linum_map", "err:%d errno:%d\n",
>  	       err, errno);
>  
>  	for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
>
Khalid Elmously April 9, 2020, 6:32 p.m. UTC | #3
Applied as SAUCE - thanks for the quick fix Stefan

On 2020-04-09 17:26:06 , Stefan Bader wrote:
> The IF_ERR macro is not yet defined, replace it with CHECK.
> Alternatively we would have to revert the following patch:
> 
>   commit 1740b79aed7b5a121bb07ce30e4473225545b9d2
>   Author: Lorenz Bauer <lmb@cloudflare.com>
>   Date:   Fri Jan 24 11:27:54 2020 +0000
> 
>     selftests: bpf: Reset global state between reuseport test runs
> 
> BugLink: https://bugs.launchpad.net/bugs/1871613
> 
> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>  tools/testing/selftests/bpf/test_select_reuseport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c
> index 079d0f5a2909..567912df9c74 100644
> --- a/tools/testing/selftests/bpf/test_select_reuseport.c
> +++ b/tools/testing/selftests/bpf/test_select_reuseport.c
> @@ -668,12 +668,12 @@ static void cleanup_per_test(void)
>  
>  	for (i = 0; i < NR_RESULTS; i++) {
>  		err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
> -		RET_IF(err, "reset elem in result_map",
> +		CHECK(err == -1, "reset elem in result_map",
>  		       "i:%u err:%d errno:%d\n", i, err, errno);
>  	}
>  
>  	err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
> -	RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
> +	CHECK(err == -1, "reset line number in linum_map", "err:%d errno:%d\n",
>  	       err, errno);
>  
>  	for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
> -- 
> 2.17.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Khalid Elmously April 22, 2020, 1:15 a.m. UTC | #4
This was actually needed in disco as well. Applied it there too.

On 2020-04-09 14:32:39 , Khaled Elmously wrote:
> Applied as SAUCE - thanks for the quick fix Stefan
> 
> On 2020-04-09 17:26:06 , Stefan Bader wrote:
> > The IF_ERR macro is not yet defined, replace it with CHECK.
> > Alternatively we would have to revert the following patch:
> > 
> >   commit 1740b79aed7b5a121bb07ce30e4473225545b9d2
> >   Author: Lorenz Bauer <lmb@cloudflare.com>
> >   Date:   Fri Jan 24 11:27:54 2020 +0000
> > 
> >     selftests: bpf: Reset global state between reuseport test runs
> > 
> > BugLink: https://bugs.launchpad.net/bugs/1871613
> > 
> > Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
> > ---
> >  tools/testing/selftests/bpf/test_select_reuseport.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c
> > index 079d0f5a2909..567912df9c74 100644
> > --- a/tools/testing/selftests/bpf/test_select_reuseport.c
> > +++ b/tools/testing/selftests/bpf/test_select_reuseport.c
> > @@ -668,12 +668,12 @@ static void cleanup_per_test(void)
> >  
> >  	for (i = 0; i < NR_RESULTS; i++) {
> >  		err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
> > -		RET_IF(err, "reset elem in result_map",
> > +		CHECK(err == -1, "reset elem in result_map",
> >  		       "i:%u err:%d errno:%d\n", i, err, errno);
> >  	}
> >  
> >  	err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
> > -	RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
> > +	CHECK(err == -1, "reset line number in linum_map", "err:%d errno:%d\n",
> >  	       err, errno);
> >  
> >  	for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)
> > -- 
> > 2.17.1
> > 
> > 
> > -- 
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c
index 079d0f5a2909..567912df9c74 100644
--- a/tools/testing/selftests/bpf/test_select_reuseport.c
+++ b/tools/testing/selftests/bpf/test_select_reuseport.c
@@ -668,12 +668,12 @@  static void cleanup_per_test(void)
 
 	for (i = 0; i < NR_RESULTS; i++) {
 		err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY);
-		RET_IF(err, "reset elem in result_map",
+		CHECK(err == -1, "reset elem in result_map",
 		       "i:%u err:%d errno:%d\n", i, err, errno);
 	}
 
 	err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY);
-	RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n",
+	CHECK(err == -1, "reset line number in linum_map", "err:%d errno:%d\n",
 	       err, errno);
 
 	for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++)