All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute
@ 2018-11-14 14:21 Cristian Marussi
  2018-11-14 14:21 ` [LTP] [PATCH 2/2] [PATCH] cpuset_list_compute fix exit value Cristian Marussi
  2018-11-14 14:32 ` [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Cristian Marussi @ 2018-11-14 14:21 UTC (permalink / raw)
  To: ltp

cpuset_hotplug failed with:

Usage : cpuset_list_compute [-a|s] list1 [list2]

        -a|s   list1 add/subtract list2.[default: -a]

        -h     Help.
cpuset_hotplug 1 TFAIL: root group's cpus isn't expected(Result: 0,2-5, Expect: ).

It turned out that helper cpuset_list_compute was always failing because it was
improperly handling getopt retval.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 .../cpuset/cpuset_hotplug_test/cpuset_list_compute.c           | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
index 1b55f4b30..b9f176af4 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
@@ -29,8 +29,7 @@ static void usage(char *prog_name, int status)
 
 static void checkopt(int argc, char **argv)
 {
-	char c = '\0';
-	int optc = 0;
+	int c, optc = 0;
 
 	while ((c = getopt(argc, argv, "ahs")) != -1) {
 		switch (c) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 2/2] [PATCH] cpuset_list_compute fix exit value
  2018-11-14 14:21 [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cristian Marussi
@ 2018-11-14 14:21 ` Cristian Marussi
  2018-11-14 14:34   ` Cyril Hrubis
  2018-11-14 14:32 ` [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cyril Hrubis
  1 sibling, 1 reply; 5+ messages in thread
From: Cristian Marussi @ 2018-11-14 14:21 UTC (permalink / raw)
  To: ltp

Internal usage() helper was meant to use a custom exit value
provided by the caller, so use it.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 .../cpuset/cpuset_hotplug_test/cpuset_list_compute.c            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
index b9f176af4..1c66b863a 100644
--- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
+++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
@@ -24,7 +24,7 @@ int convert;
 static void usage(char *prog_name, int status)
 {
 	fprintf(stderr, USAGE, prog_name);
-	exit(1);
+	exit(status);
 }
 
 static void checkopt(int argc, char **argv)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute
  2018-11-14 14:21 [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cristian Marussi
  2018-11-14 14:21 ` [LTP] [PATCH 2/2] [PATCH] cpuset_list_compute fix exit value Cristian Marussi
@ 2018-11-14 14:32 ` Cyril Hrubis
  2018-11-14 14:39   ` Cristian Marussi
  1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2018-11-14 14:32 UTC (permalink / raw)
  To: ltp

Hi!
> cpuset_hotplug failed with:
> 
> Usage : cpuset_list_compute [-a|s] list1 [list2]
> 
>         -a|s   list1 add/subtract list2.[default: -a]
> 
>         -h     Help.
> cpuset_hotplug 1 TFAIL: root group's cpus isn't expected(Result: 0,2-5, Expect: ).
> 
> It turned out that helper cpuset_list_compute was always failing because it was
> improperly handling getopt retval.

It's working on intel, but I suppose that it overflows on arm since char
is smaller than int there. It would be a bit better if something along
these lines was written here. Otherwise the patch itself looks good.

> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
>  .../cpuset/cpuset_hotplug_test/cpuset_list_compute.c           | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
> index 1b55f4b30..b9f176af4 100644
> --- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
> +++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
> @@ -29,8 +29,7 @@ static void usage(char *prog_name, int status)
>  
>  static void checkopt(int argc, char **argv)
>  {
> -	char c = '\0';
> -	int optc = 0;
> +	int c, optc = 0;
>  
>  	while ((c = getopt(argc, argv, "ahs")) != -1) {
>  		switch (c) {
> -- 
> 2.17.1
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 2/2] [PATCH] cpuset_list_compute fix exit value
  2018-11-14 14:21 ` [LTP] [PATCH 2/2] [PATCH] cpuset_list_compute fix exit value Cristian Marussi
@ 2018-11-14 14:34   ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2018-11-14 14:34 UTC (permalink / raw)
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute
  2018-11-14 14:32 ` [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cyril Hrubis
@ 2018-11-14 14:39   ` Cristian Marussi
  0 siblings, 0 replies; 5+ messages in thread
From: Cristian Marussi @ 2018-11-14 14:39 UTC (permalink / raw)
  To: ltp

Hi

On 14/11/2018 14:32, Cyril Hrubis wrote:
> Hi!
>> cpuset_hotplug failed with:
>>
>> Usage : cpuset_list_compute [-a|s] list1 [list2]
>>
>>          -a|s   list1 add/subtract list2.[default: -a]
>>
>>          -h     Help.
>> cpuset_hotplug 1 TFAIL: root group's cpus isn't expected(Result: 0,2-5, Expect: ).
>>
>> It turned out that helper cpuset_list_compute was always failing because it was
>> improperly handling getopt retval.
> 
> It's working on intel, but I suppose that it overflows on arm since char
> is smaller than int there. It would be a bit better if something along
> these lines was written here. Otherwise the patch itself looks good.
> 

Fine I will add some more explanation.

Thanks

Cristian

>> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
>> ---
>>   .../cpuset/cpuset_hotplug_test/cpuset_list_compute.c           | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
>> index 1b55f4b30..b9f176af4 100644
>> --- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
>> +++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_list_compute.c
>> @@ -29,8 +29,7 @@ static void usage(char *prog_name, int status)
>>   
>>   static void checkopt(int argc, char **argv)
>>   {
>> -	char c = '\0';
>> -	int optc = 0;
>> +	int c, optc = 0;
>>   
>>   	while ((c = getopt(argc, argv, "ahs")) != -1) {
>>   		switch (c) {
>> -- 
>> 2.17.1
>>
>>
>> -- 
>> Mailing list info: https://lists.linux.it/listinfo/ltp
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-14 14:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 14:21 [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cristian Marussi
2018-11-14 14:21 ` [LTP] [PATCH 2/2] [PATCH] cpuset_list_compute fix exit value Cristian Marussi
2018-11-14 14:34   ` Cyril Hrubis
2018-11-14 14:32 ` [LTP] [PATCH 1/2] [PATCH] cpuset_hotplug: fix cpuset_list_compute Cyril Hrubis
2018-11-14 14:39   ` Cristian Marussi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.