Skip to contentSkip to conversation

pselect01: Fixed the checking logic to also consider some variation.

PATCH In review Nobuhiro Lin 2 participants 2 messages Sep 11, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pselect01: Fixed the checking logic to also consider some variation.

From: nobuhiro <[email protected]>

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(-)
testcases/kernel/syscalls/pselect/pselect01.c +1 -1
index 08d168f..1778dfe 100644
@@ -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",
Signature · 12 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

testcases/kernel/syscalls/pselect/pselect01.c int main() · line 111

Quoted 2 lines · On Friday 11 September 2009 09:20:33 Nobuhiro Lin wrote:
testcases/kernel/syscalls/pselect/pselect01.c +1 -1
-		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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list