Skip to contentSkip to conversation

fix false alarm in pselect01

PATCH Caspar Zhang 2 participants 2 messages Jul 18, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1752311632.509001279437850417.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com

#1 lore raw
Quoted 16 lines · ----- "Caspar Zhang

Hi all,

In my recent tests, not all desired time is equal to exact
execution time,
sometimes it is +/-1s, and in a few times it becomes +/-2s. In most
cases,
+/-2s is still a valid value between exact execute time and desired
time.

--- a/testcases/kernel/syscalls/pselect/pselect01.c 2010-04-01
14:23:10.000000000 +0800
+++ b/testcases/kernel/syscalls/pselect/pselect01.c 2010-07-15
16:03:40.969426078 +0800

Review line 115

Quoted 8 lines
(quoted diff) +2 -1
@@ -109,7 +109,8 @@
                            NULL);
                end = time(&t);
 
-               if (((end - start) == total_sec) || ((end - start) ==
 total_sec + 1))
+               /* Is it still valid in range -2~2s? */
+               if ((end - start - total_sec <= 2) && (end - start -
 total_sec >= -2))

Sorry for mistake, since end, start are unsigned int, use end-start-total_sec >= -2 will cause error, add (int)before (end-start) instead. New patch attached.

Thanks,
Caspar

Signature · 9 lines
Kernel Associate Quality Engineer
Red Hat Inc. (Beijing R&D Branch)

Red Hat China R&D Branch Unit 907, North Tower C, 
  Raycom Infotech Park, No.2 Kexueyuan Nanlu, 
  Haidian District, Beijing 100190

TEL: +86-10-62608150
Web: http://www.redhat.com/

Hi all,

In my recent tests, not all desired time is equal to exact execution time, sometimes it is +/-1s, and in a few times it becomes +/-2s. In most cases, +/-2s is still a valid value between exact execute time and desired time.

testcases/kernel/syscalls/pselect/pselect01.c +2 -1
@@ -109,7 +109,8 @@
 			    NULL);
 		end = time(&t);
 
-		if (((end - start) == total_sec) || ((end - start) == total_sec + 1))
+		/* Is it still valid in range -2~2s? */
+		if (((int)(end - start) - total_sec <= 2) && ((int)(end - start) - total_sec >= -2))
 			tst_resm(TPASS, "Sleep time was correct");
 		else
 			tst_resm(TFAIL, "Sleep time was incorrect:%d != %d",

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 22 lines · Caspar Zhang
Quoted 19 lines · ----- "Caspar Zhang

Hi all,

   In my recent tests, not all desired time is equal to exact execution time,
   sometimes it is +/-1s, and in a few times it becomes +/-2s. In most cases,
   +/-2s is still a valid value between exact execute time and desired time.

--- a/testcases/kernel/syscalls/pselect/pselect01.c     2010-04-01 14:23:10.000000000 +0800
+++ b/testcases/kernel/syscalls/pselect/pselect01.c     2010-07-15 16:03:40.969426078 +0800

testcases/kernel/syscalls/pselect/pselect01.c +0 -0
@@ -109,7 +109,8 @@
                             NULL);
                 end = time(&t);
 
Quoted 9 lines

Review line 115

Quoted 5 lines
(quoted diff) +2 -1
-               if (((end - start) == total_sec) || ((end - start) ==
 total_sec + 1))
+               /* Is it still valid in range -2~2s? */
+               if ((end - start - total_sec <= 2) && (end - start -
 total_sec >= -2))

Sorry for mistake, since end, start are unsigned int, use end-start-total_sec >= -2 will cause error, add (int)before (end-start) instead. New patch attached.

The fact that the test is using time(3) to calculate the elapsed
period instead of clock_gettime is dubious at best, because the precision of time is in seconds. Maybe it should be converted to clock_gettime calls for improved precision?
Thanks,
-Garrett

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list