kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/timers: Add missing error code assignment before test
@ 2016-08-09 10:11 Christophe JAILLET
  2016-08-09 10:20 ` walter harms
  2016-08-17 21:31 ` John Stultz
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2016-08-09 10:11 UTC (permalink / raw)
  To: john.stultz, tglx, shuahkh
  Cc: linux-kselftest, linux-kernel, kernel-janitors,
	Christophe JAILLET

In order to work, the 'err' return value has to be updated otherwise the
test can never be true.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 tools/testing/selftests/timers/posix_timers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c
index 5a246a0..15cf56d 100644
--- a/tools/testing/selftests/timers/posix_timers.c
+++ b/tools/testing/selftests/timers/posix_timers.c
@@ -122,7 +122,7 @@ static int check_itimer(int which)
 	else if (which = ITIMER_REAL)
 		idle_loop();
 
-	gettimeofday(&end, NULL);
+	err = gettimeofday(&end, NULL);
 	if (err < 0) {
 		perror("Can't call gettimeofday()\n");
 		return -1;
@@ -175,7 +175,7 @@ static int check_timer_create(int which)
 
 	user_loop();
 
-	gettimeofday(&end, NULL);
+	err = gettimeofday(&end, NULL);
 	if (err < 0) {
 		perror("Can't call gettimeofday()\n");
 		return -1;
-- 
2.7.4


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


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

* Re: [PATCH] selftests/timers: Add missing error code assignment before test
  2016-08-09 10:11 [PATCH] selftests/timers: Add missing error code assignment before test Christophe JAILLET
@ 2016-08-09 10:20 ` walter harms
  2016-08-17 21:31 ` John Stultz
  1 sibling, 0 replies; 3+ messages in thread
From: walter harms @ 2016-08-09 10:20 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: john.stultz, tglx, shuahkh, linux-kselftest, linux-kernel,
	kernel-janitors


The patch looks ok.
but perhaps it is better to replace this with clock_gettime() ?

from the manpage:
"POSIX.1-2008 marks gettimeofday() as obsolete, recommending the
 use of clock_gettime(2) instead."

just my 2 cents.

re,
 wh


Am 09.08.2016 12:11, schrieb Christophe JAILLET:
> In order to work, the 'err' return value has to be updated otherwise the
> test can never be true.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  tools/testing/selftests/timers/posix_timers.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c
> index 5a246a0..15cf56d 100644
> --- a/tools/testing/selftests/timers/posix_timers.c
> +++ b/tools/testing/selftests/timers/posix_timers.c
> @@ -122,7 +122,7 @@ static int check_itimer(int which)
>  	else if (which = ITIMER_REAL)
>  		idle_loop();
>  
> -	gettimeofday(&end, NULL);
> +	err = gettimeofday(&end, NULL);
>  	if (err < 0) {
>  		perror("Can't call gettimeofday()\n");
>  		return -1;
> @@ -175,7 +175,7 @@ static int check_timer_create(int which)
>  
>  	user_loop();
>  
> -	gettimeofday(&end, NULL);
> +	err = gettimeofday(&end, NULL);
>  	if (err < 0) {
>  		perror("Can't call gettimeofday()\n");
>  		return -1;

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

* Re: [PATCH] selftests/timers: Add missing error code assignment before test
  2016-08-09 10:11 [PATCH] selftests/timers: Add missing error code assignment before test Christophe JAILLET
  2016-08-09 10:20 ` walter harms
@ 2016-08-17 21:31 ` John Stultz
  1 sibling, 0 replies; 3+ messages in thread
From: John Stultz @ 2016-08-17 21:31 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Thomas Gleixner, Shuah Khan, linux-kselftest, lkml,
	kernel-janitors

On Tue, Aug 9, 2016 at 3:11 AM, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
> In order to work, the 'err' return value has to be updated otherwise the
> test can never be true.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: John Stultz <john.stultz@linaro.org>

thanks
-john

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

end of thread, other threads:[~2016-08-17 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-09 10:11 [PATCH] selftests/timers: Add missing error code assignment before test Christophe JAILLET
2016-08-09 10:20 ` walter harms
2016-08-17 21:31 ` John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).