[v2] test/eal: check invalid cpu value

Message ID 20200720101908.12500-1-ktraynor@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2] test/eal: check invalid cpu value |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Kevin Traynor July 20, 2020, 10:19 a.m. UTC
  When using --lcores option, there is a limit of CPU_SETSIZE.
Currently that allows 0..1023 on Linux.

Check it is caught when this limit is exceeded.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 app/test/test_eal_flags.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Lukasz Wojciechowski July 20, 2020, 11:08 a.m. UTC | #1
W dniu 20.07.2020 o 12:19, Kevin Traynor pisze:
> When using --lcores option, there is a limit of CPU_SETSIZE.
> Currently that allows 0..1023 on Linux.
>
> Check it is caught when this limit is exceeded.
>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>   app/test/test_eal_flags.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
> index 4ee809e3d..b019656b2 100644
> --- a/app/test/test_eal_flags.c
> +++ b/app/test/test_eal_flags.c
> @@ -528,4 +528,7 @@ test_missing_c_flag(void)
>   				 "--lcores",
>   				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
> +	/* check an invalid cpu value >= CPU_SETSIZE */
> +	const char * const argv30[] = { prgname, prefix, mp_flag,
> +				 "--lcores", "3@" RTE_STR(CPU_SETSIZE) };
>   
>   	if (launch_proc(argv2) != 0) {
> @@ -577,5 +580,5 @@ test_missing_c_flag(void)
>   	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
>   	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
> -	    launch_proc(argv28) == 0) {
> +	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
>   		printf("Error - "
>   		       "process ran without error with invalid --lcore flag\n");
Now it's perfect.

Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
  
David Marchand July 21, 2020, 6:58 p.m. UTC | #2
On Mon, Jul 20, 2020 at 1:08 PM Lukasz Wojciechowski
<l.wojciechow@partner.samsung.com> wrote:

> W dniu 20.07.2020 o 12:19, Kevin Traynor pisze:
> > When using --lcores option, there is a limit of CPU_SETSIZE.
> > Currently that allows 0..1023 on Linux.
> >
> > Check it is caught when this limit is exceeded.
> Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>

Applied, thanks Kevin.
  

Patch

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 4ee809e3d..b019656b2 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -528,4 +528,7 @@  test_missing_c_flag(void)
 				 "--lcores",
 				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
+	/* check an invalid cpu value >= CPU_SETSIZE */
+	const char * const argv30[] = { prgname, prefix, mp_flag,
+				 "--lcores", "3@" RTE_STR(CPU_SETSIZE) };
 
 	if (launch_proc(argv2) != 0) {
@@ -577,5 +580,5 @@  test_missing_c_flag(void)
 	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
 	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
-	    launch_proc(argv28) == 0) {
+	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
 		printf("Error - "
 		       "process ran without error with invalid --lcore flag\n");