All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation.
@ 2009-09-11 13:20 Nobuhiro Lin
  2009-09-12  2:28 ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Nobuhiro Lin @ 2009-09-11 13:20 UTC (permalink / raw)
  To: ltp-list

From: nobuhiro <nobuhiro@andestech.com>

Sometimes we may get failed results that the measured time is 1 second longer than expected.
As fixed by Craig Meier earlier, the sleeps may last slightly more than total_sec.
Also considering the time() overhead, we should expect the sleeps to last between
total_sec and (total_sec+1) seconds.

Signed-off-by: Nobuhiro Lin <nobuhiro@andestech.com>
---
 testcases/kernel/syscalls/pselect/pselect01.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/pselect/pselect01.c b/testcases/kernel/syscalls/pselect/pselect01.c
index 08d168f..1778dfe 100644
--- a/testcases/kernel/syscalls/pselect/pselect01.c
+++ b/testcases/kernel/syscalls/pselect/pselect01.c
@@ -108,7 +108,7 @@ int main()
 			    NULL);
 		end = time(&t);
 
-		if (total_sec >= (end - start))
+		if(((end - start) >= total_sec) && ((end - start) <= total_sec + 1))
 			tst_resm(TPASS, "Sleep time was correct");
 		else
 			tst_resm(TFAIL, "Sleep time was incorrect:%d != %d",
-- 
1.6.3.1


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation.
  2009-09-11 13:20 [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation Nobuhiro Lin
@ 2009-09-12  2:28 ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2009-09-12  2:28 UTC (permalink / raw)
  To: ltp-list


[-- Attachment #1.1: Type: text/plain, Size: 413 bytes --]

On Friday 11 September 2009 09:20:33 Nobuhiro Lin wrote:
> -		if (total_sec >= (end - start))
> +		if(((end - start) >= total_sec) && ((end - start) <= total_sec + 1))

please fix your style.  skimping on whitespace doesnt make for smaller code.

that said, your test boils down to "== total_sec" or "== total_sec + 1".  
might as well use that rather than confusing greater/less than comparisons.
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 355 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation.
  2009-09-12  9:09 nobuhiro
@ 2009-09-13 13:17 ` Subrata Modak
  0 siblings, 0 replies; 4+ messages in thread
From: Subrata Modak @ 2009-09-13 13:17 UTC (permalink / raw)
  To: nobuhiro; +Cc: ltp-list, vapier

On Sat, 2009-09-12 at 17:09 +0800, nobuhiro@andestech.com wrote: 
> Hi Mike,
> 
> Thanks for identifying that.
> Fixed patch attached.

Thanks.

Regards--
Subrata

> 
> -Nobuhiro Lin
> 
> -----Original Message-----
> From: Mike Frysinger [mailto:vapier@gentoo.org] 
> Sent: Saturday, September 12, 2009 10:28 AM
> To: ltp-list@lists.sourceforge.net
> Cc: Shawn Hsin-Hung Lin(林信宏)
> Subject: Re: [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation.
> 
> On Friday 11 September 2009 09:20:33 Nobuhiro Lin wrote:
> > -		if (total_sec >= (end - start))
> > +		if(((end - start) >= total_sec) && ((end - start) <= total_sec + 
> > +1))
> 
> please fix your style.  skimping on whitespace doesnt make for smaller code.
> 
> that said, your test boils down to "== total_sec" or "== total_sec + 1".  
> might as well use that rather than confusing greater/less than comparisons.
> -mike
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation.
@ 2009-09-12  9:09 nobuhiro
  2009-09-13 13:17 ` Subrata Modak
  0 siblings, 1 reply; 4+ messages in thread
From: nobuhiro @ 2009-09-12  9:09 UTC (permalink / raw)
  To: ltp-list; +Cc: vapier

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

 
Hi Mike,

Thanks for identifying that.
Fixed patch attached.

-Nobuhiro Lin

-----Original Message-----
From: Mike Frysinger [mailto:vapier@gentoo.org] 
Sent: Saturday, September 12, 2009 10:28 AM
To: ltp-list@lists.sourceforge.net
Cc: Shawn Hsin-Hung Lin(林信宏)
Subject: Re: [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation.

On Friday 11 September 2009 09:20:33 Nobuhiro Lin wrote:
> -		if (total_sec >= (end - start))
> +		if(((end - start) >= total_sec) && ((end - start) <= total_sec + 
> +1))

please fix your style.  skimping on whitespace doesnt make for smaller code.

that said, your test boils down to "== total_sec" or "== total_sec + 1".  
might as well use that rather than confusing greater/less than comparisons.
-mike

[-- Attachment #2: 0001-pselect01-Fixed-the-checking-logic-to-also-consider-.patch --]
[-- Type: application/octet-stream, Size: 1184 bytes --]

From 2189cdbf557e18032be25807a8f500c7523978ca Mon Sep 17 00:00:00 2001
From: nobuhiro <nobuhiro@andestech.com>
Date: Fri, 11 Sep 2009 20:59:04 +0800
Subject: [PATCH] pselect01: Fixed the checking logic to also consider some variation.

Sometimes we may get failed results that the measured time is 1 second longer than expected.
As fixed by Craig Meier earlier, the sleeps may last slightly more than total_sec.
Also considering the time() overhead, we should expect the sleeps to last between
total_sec and (total_sec+1) seconds.
---
 testcases/kernel/syscalls/pselect/pselect01.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/pselect/pselect01.c b/testcases/kernel/syscalls/pselect/pselect01.c
index 08d168f..1d2b3c1 100644
--- a/testcases/kernel/syscalls/pselect/pselect01.c
+++ b/testcases/kernel/syscalls/pselect/pselect01.c
@@ -108,7 +108,7 @@ int main()
 			    NULL);
 		end = time(&t);
 
-		if (total_sec >= (end - start))
+		if (((end - start) == total_sec) || ((end - start) == total_sec + 1))
 			tst_resm(TPASS, "Sleep time was correct");
 		else
 			tst_resm(TFAIL, "Sleep time was incorrect:%d != %d",
-- 
1.6.3.1


[-- Attachment #3: Type: text/plain, Size: 355 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2009-09-13 13:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-11 13:20 [LTP] [PATCH] pselect01: Fixed the checking logic to also consider some variation Nobuhiro Lin
2009-09-12  2:28 ` Mike Frysinger
2009-09-12  9:09 nobuhiro
2009-09-13 13:17 ` Subrata Modak

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.