All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rt-migrate-test: exit early if nr_runs is non-positive
@ 2014-11-27 10:20 Boris Egorov
  2015-02-17 14:08 ` Sebastian Andrzej Siewior
  2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
  0 siblings, 2 replies; 9+ messages in thread
From: Boris Egorov @ 2014-11-27 10:20 UTC (permalink / raw)
  To: 716237, linux-rt-users; +Cc: Boris Egorov

Program will crash if nr_runs is 0 due to dividing by it in
print_results(). Let's exit early instead.

Fixes: http://bugs.debian.org/716237

Signed-off-by: Boris Egorov <egorov@linux.com>
---
 src/rt-migrate-test/rt-migrate-test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/rt-migrate-test/rt-migrate-test.c
b/src/rt-migrate-test/rt-migrate-test.c
index e3c7a09..876a122 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -465,6 +465,11 @@ int main (int argc, char **argv)
  	parse_options(argc, argv);
+	if (nr_runs <= 0) {
+		fprintf(stderr, "Warning, --loops argument is non-positive. Exiting.\n");
+		exit(-1);
+	}
+
 	signal(SIGINT, stop_log);
  	if (argc >= (optind + 1))
-- 
2.1.3


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

* Re: [PATCH] rt-migrate-test: exit early if nr_runs is non-positive
  2014-11-27 10:20 [PATCH] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
@ 2015-02-17 14:08 ` Sebastian Andrzej Siewior
  2015-02-17 14:30   ` Boris Egorov
  2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
  1 sibling, 1 reply; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2015-02-17 14:08 UTC (permalink / raw)
  To: Boris Egorov, Clark Williams; +Cc: 716237, linux-rt-users

* Boris Egorov | 2014-11-27 16:20:34 [+0600]:

>Program will crash if nr_runs is 0 due to dividing by it in
>print_results(). Let's exit early instead.
>
>Fixes: http://bugs.debian.org/716237

Has this been dealt with? I can't see this applied. I would prefer
doing the value check in parse_options() itself. And looking at it, it
seems that run_interval is interval ignored. Or is there macro magic
invovled?

>Signed-off-by: Boris Egorov <egorov@linux.com>
>---
> src/rt-migrate-test/rt-migrate-test.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/src/rt-migrate-test/rt-migrate-test.c
>b/src/rt-migrate-test/rt-migrate-test.c
>index e3c7a09..876a122 100644
>--- a/src/rt-migrate-test/rt-migrate-test.c
>+++ b/src/rt-migrate-test/rt-migrate-test.c
>@@ -465,6 +465,11 @@ int main (int argc, char **argv)
>  	parse_options(argc, argv);
>+	if (nr_runs <= 0) {
>+		fprintf(stderr, "Warning, --loops argument is non-positive. Exiting.\n");
>+		exit(-1);
>+	}
>+
> 	signal(SIGINT, stop_log);
>  	if (argc >= (optind + 1))
>-- 
>2.1.3

Sebastian

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

* Re: [PATCH] rt-migrate-test: exit early if nr_runs is non-positive
  2015-02-17 14:08 ` Sebastian Andrzej Siewior
@ 2015-02-17 14:30   ` Boris Egorov
  2015-02-17 14:35     ` Boris Egorov
  0 siblings, 1 reply; 9+ messages in thread
From: Boris Egorov @ 2015-02-17 14:30 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Clark Williams; +Cc: 716237, linux-rt-users

Looks like this patch is not applied yet.

I can move value check to parse_options and send another version of
patch. As for macros - yes, I already mentioned them in debian bug
report thread. There are three of them (INTERVAL, RUN_INTERVAL,
PROGRESS_CHARS) which are improperly (IMO) used instead of corresponding
lowercase variables. I thought these changes should go to another patch.

On 02/17/2015 08:08 PM, Sebastian Andrzej Siewior wrote:
> * Boris Egorov | 2014-11-27 16:20:34 [+0600]:
> 
>> Program will crash if nr_runs is 0 due to dividing by it in
>> print_results(). Let's exit early instead.
>>
>> Fixes: http://bugs.debian.org/716237
> 
> Has this been dealt with? I can't see this applied. I would prefer
> doing the value check in parse_options() itself. And looking at it, it
> seems that run_interval is interval ignored. Or is there macro magic
> invovled?
> 
>> Signed-off-by: Boris Egorov <egorov@linux.com>
>> ---
>> src/rt-migrate-test/rt-migrate-test.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/src/rt-migrate-test/rt-migrate-test.c
>> b/src/rt-migrate-test/rt-migrate-test.c
>> index e3c7a09..876a122 100644
>> --- a/src/rt-migrate-test/rt-migrate-test.c
>> +++ b/src/rt-migrate-test/rt-migrate-test.c
>> @@ -465,6 +465,11 @@ int main (int argc, char **argv)
>>  	parse_options(argc, argv);
>> +	if (nr_runs <= 0) {
>> +		fprintf(stderr, "Warning, --loops argument is non-positive. Exiting.\n");
>> +		exit(-1);
>> +	}
>> +
>> 	signal(SIGINT, stop_log);
>>  	if (argc >= (optind + 1))
>> -- 
>> 2.1.3
> 
> Sebastian
> 

-- 
Best regards,
Boris Egorov

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

* Re: [PATCH] rt-migrate-test: exit early if nr_runs is non-positive
  2015-02-17 14:30   ` Boris Egorov
@ 2015-02-17 14:35     ` Boris Egorov
  2015-02-17 16:51       ` John Kacur
  0 siblings, 1 reply; 9+ messages in thread
From: Boris Egorov @ 2015-02-17 14:35 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Clark Williams; +Cc: 716237, linux-rt-users

Sorry, PROGRESS_CHARS macro is used correctly, but INTERVAL and
RUN_INTERVAL not. In my opinion, they should be defined and used once in
static variable assigning, and nowhere else.

On 02/17/2015 08:30 PM, Boris Egorov wrote:
> Looks like this patch is not applied yet.
> 
> I can move value check to parse_options and send another version of
> patch. As for macros - yes, I already mentioned them in debian bug
> report thread. There are three of them (INTERVAL, RUN_INTERVAL,
> PROGRESS_CHARS) which are improperly (IMO) used instead of corresponding
> lowercase variables. I thought these changes should go to another patch.
> 
> On 02/17/2015 08:08 PM, Sebastian Andrzej Siewior wrote:
>> * Boris Egorov | 2014-11-27 16:20:34 [+0600]:
>>
>>> Program will crash if nr_runs is 0 due to dividing by it in
>>> print_results(). Let's exit early instead.
>>>
>>> Fixes: http://bugs.debian.org/716237
>>
>> Has this been dealt with? I can't see this applied. I would prefer
>> doing the value check in parse_options() itself. And looking at it, it
>> seems that run_interval is interval ignored. Or is there macro magic
>> invovled?
>>
>>> Signed-off-by: Boris Egorov <egorov@linux.com>
>>> ---
>>> src/rt-migrate-test/rt-migrate-test.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/src/rt-migrate-test/rt-migrate-test.c
>>> b/src/rt-migrate-test/rt-migrate-test.c
>>> index e3c7a09..876a122 100644
>>> --- a/src/rt-migrate-test/rt-migrate-test.c
>>> +++ b/src/rt-migrate-test/rt-migrate-test.c
>>> @@ -465,6 +465,11 @@ int main (int argc, char **argv)
>>>  	parse_options(argc, argv);
>>> +	if (nr_runs <= 0) {
>>> +		fprintf(stderr, "Warning, --loops argument is non-positive. Exiting.\n");
>>> +		exit(-1);
>>> +	}
>>> +
>>> 	signal(SIGINT, stop_log);
>>>  	if (argc >= (optind + 1))
>>> -- 
>>> 2.1.3
>>
>> Sebastian
>>
> 

-- 
Best regards,
Boris Egorov

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

* Re: [PATCH] rt-migrate-test: exit early if nr_runs is non-positive
  2015-02-17 14:35     ` Boris Egorov
@ 2015-02-17 16:51       ` John Kacur
  0 siblings, 0 replies; 9+ messages in thread
From: John Kacur @ 2015-02-17 16:51 UTC (permalink / raw)
  To: Boris Egorov
  Cc: Sebastian Andrzej Siewior, Clark Williams, 716237, linux-rt-users



On Tue, 17 Feb 2015, Boris Egorov wrote:

> Sorry, PROGRESS_CHARS macro is used correctly, but INTERVAL and
> RUN_INTERVAL not. In my opinion, they should be defined and used once in
> static variable assigning, and nowhere else.
> 
> On 02/17/2015 08:30 PM, Boris Egorov wrote:
> > Looks like this patch is not applied yet.
> > 
> > I can move value check to parse_options and send another version of
> > patch. As for macros - yes, I already mentioned them in debian bug
> > report thread. There are three of them (INTERVAL, RUN_INTERVAL,
> > PROGRESS_CHARS) which are improperly (IMO) used instead of corresponding
> > lowercase variables. I thought these changes should go to another patch.
> > 
> > On 02/17/2015 08:08 PM, Sebastian Andrzej Siewior wrote:
> >> * Boris Egorov | 2014-11-27 16:20:34 [+0600]:
> >>
> >>> Program will crash if nr_runs is 0 due to dividing by it in
> >>> print_results(). Let's exit early instead.
> >>>
> >>> Fixes: http://bugs.debian.org/716237
> >>
> >> Has this been dealt with? I can't see this applied. I would prefer
> >> doing the value check in parse_options() itself. And looking at it, it
> >> seems that run_interval is interval ignored. Or is there macro magic
> >> invovled?
> >>
> >>> Signed-off-by: Boris Egorov <egorov@linux.com>
> >>> ---
> >>> src/rt-migrate-test/rt-migrate-test.c | 5 +++++
> >>> 1 file changed, 5 insertions(+)
> >>>
> >>> diff --git a/src/rt-migrate-test/rt-migrate-test.c
> >>> b/src/rt-migrate-test/rt-migrate-test.c
> >>> index e3c7a09..876a122 100644
> >>> --- a/src/rt-migrate-test/rt-migrate-test.c
> >>> +++ b/src/rt-migrate-test/rt-migrate-test.c
> >>> @@ -465,6 +465,11 @@ int main (int argc, char **argv)
> >>>  	parse_options(argc, argv);
> >>> +	if (nr_runs <= 0) {
> >>> +		fprintf(stderr, "Warning, --loops argument is non-positive. Exiting.\n");
> >>> +		exit(-1);
> >>> +	}
> >>> +
> >>> 	signal(SIGINT, stop_log);
> >>>  	if (argc >= (optind + 1))
> >>> -- 
> >>> 2.1.3
> >>
> >> Sebastian
> >>
> > 
> 
> -- 
> Best regards,
> Boris Egorov
> --

Awaiting your respin on these patches.

Thanks

John

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

* [PATCH v2 0/2] rt-migrate-test: few sanity fixes
  2014-11-27 10:20 [PATCH] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
  2015-02-17 14:08 ` Sebastian Andrzej Siewior
@ 2015-02-17 17:43 ` Boris Egorov
  2015-02-17 17:43   ` [PATCH v2 1/2] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Boris Egorov @ 2015-02-17 17:43 UTC (permalink / raw)
  To: 716237, linux-rt-users; +Cc: clark.williams, jkacur, bigeasy, Boris Egorov

Few fixes for rt-migrate-test, one to fix arithmetic error and others
to properly handle options passed by user.

Difference of this series from the first patch:

* value checks now taking place in parse_options() instead of main()
* added second sanity patch

Boris Egorov (2):
  rt-migrate-test: exit early if nr_runs is non-positive
  rt-migrate-test: use variables instead of macros

 src/rt-migrate-test/rt-migrate-test.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-- 
2.1.4


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

* [PATCH v2 1/2] rt-migrate-test: exit early if nr_runs is non-positive
  2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
@ 2015-02-17 17:43   ` Boris Egorov
  2015-02-17 17:43   ` [PATCH v2 2/2] rt-migrate-test: use variables instead of macros Boris Egorov
  2015-02-17 19:27   ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Clark Williams
  2 siblings, 0 replies; 9+ messages in thread
From: Boris Egorov @ 2015-02-17 17:43 UTC (permalink / raw)
  To: 716237, linux-rt-users; +Cc: clark.williams, jkacur, bigeasy, Boris Egorov

Program will crash if nr_runs is 0 due to dividing by it in
print_results(). Let's exit early instead.

Fixes: http://bugs.debian.org/716237
Signed-off-by: Boris Egorov <egorov@linux.com>
---
 src/rt-migrate-test/rt-migrate-test.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index e3c7a09..711d8a4 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -226,7 +226,10 @@ static void parse_options (int argc, char *argv[])
 			break;
 		}
 	}

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

* [PATCH v2 2/2] rt-migrate-test: use variables instead of macros
  2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
  2015-02-17 17:43   ` [PATCH v2 1/2] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
@ 2015-02-17 17:43   ` Boris Egorov
  2015-02-17 19:27   ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Clark Williams
  2 siblings, 0 replies; 9+ messages in thread
From: Boris Egorov @ 2015-02-17 17:43 UTC (permalink / raw)
  To: 716237, linux-rt-users; +Cc: clark.williams, jkacur, bigeasy, Boris Egorov

By default, static variables run_interval and interval assigned to
macros with corresponding uppercase name, RUN_INTERVAL and INTERVAL.
Later in code we should only use these variables to properly handle
options passed by user.

Signed-off-by: Boris Egorov <egorov@linux.com>
---
 src/rt-migrate-test/rt-migrate-test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/rt-migrate-test/rt-migrate-test.c b/src/rt-migrate-test/rt-migrate-test.c
index 711d8a4..cf682fe 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -334,7 +334,7 @@ static unsigned long busy_loop(unsigned long long start_time)
 	do {
 		l++;
 		time = get_time();
-	} while ((time - start_time) < RUN_INTERVAL);
+	} while ((time - start_time) < run_interval);
 
 	return l;
 }
@@ -539,8 +539,8 @@ int main (int argc, char **argv)
 		
 
 
-	intv.tv_sec = nano2sec(INTERVAL);
-	intv.tv_nsec = INTERVAL % sec2nano(1);
+	intv.tv_sec = nano2sec(interval);
+	intv.tv_nsec = interval % sec2nano(1);
 
 	print_progress_bar(0);
 
-- 
2.1.4


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

* Re: [PATCH v2 0/2] rt-migrate-test: few sanity fixes
  2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
  2015-02-17 17:43   ` [PATCH v2 1/2] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
  2015-02-17 17:43   ` [PATCH v2 2/2] rt-migrate-test: use variables instead of macros Boris Egorov
@ 2015-02-17 19:27   ` Clark Williams
  2 siblings, 0 replies; 9+ messages in thread
From: Clark Williams @ 2015-02-17 19:27 UTC (permalink / raw)
  To: Boris Egorov; +Cc: 716237, linux-rt-users, jkacur, bigeasy

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

On Tue, 17 Feb 2015 23:43:57 +0600
Boris Egorov <egorov@linux.com> wrote:

> Few fixes for rt-migrate-test, one to fix arithmetic error and others
> to properly handle options passed by user.
> 
> Difference of this series from the first patch:
> 
> * value checks now taking place in parse_options() instead of main()
> * added second sanity patch
> 
> Boris Egorov (2):
>   rt-migrate-test: exit early if nr_runs is non-positive
>   rt-migrate-test: use variables instead of macros
> 
>  src/rt-migrate-test/rt-migrate-test.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> -- 

I've pulled these into my tree and they will be in rt-tests-0.91.
Should come out this week.

Clark

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-02-17 19:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-27 10:20 [PATCH] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
2015-02-17 14:08 ` Sebastian Andrzej Siewior
2015-02-17 14:30   ` Boris Egorov
2015-02-17 14:35     ` Boris Egorov
2015-02-17 16:51       ` John Kacur
2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
2015-02-17 17:43   ` [PATCH v2 1/2] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
2015-02-17 17:43   ` [PATCH v2 2/2] rt-migrate-test: use variables instead of macros Boris Egorov
2015-02-17 19:27   ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Clark Williams

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.