fix false alarm in pselect01
Quoted 15 lines · ----- "Garrett Cooper
Quoted 5 lines · Caspar Zhang
Hi Garrett, I tested my patch yesterday but the result is not so good. After 1000 times running, the fix:
+ /* do a rounding */
+real_sec= (int)(0.5 + (tv_end.tv_sec -tv_start.tv_sec +
Quoted 1 line
+ 1e-9 * (tv_end.tv_nsec -
tv_start.tv_nsec)));
Quoted 5 lines
+ if (
real_sec==total_sec)got failed for once. so I set the allowed error to 20%(see the attached patch). Then re-ran it for over 5000 times, without a failure.
Hi, seems that this changing not ACKed or committed, re-attach the patch .
Thanks,
Caspar
Quoted 6 lines
Quoted 4 lines
Then the nsec part, 10% allowed error seems not enough, the test failed for twice among 1000 times. So I set the range to 20%, too.
Fair enough... change committed.
Hi,
Tests can be easily failing when using real_sec == total_sec. Changed to the similar way as in nsec part does, allow 20% error.
testcases/kernel/syscalls/pselect/pselect01.c 2010-07-22 16:17:06.552474774 +0800 renamed from testcases/kernel/syscalls/pselect/pselect01.c 2010-07-21 18:08:25.139600055 +0800 +7 -6
@@ -66,7 +66,8 @@ int retval; struct timespec tv, tv_start, tv_end; long real_nsec, total_nsec; - int real_sec, total_sec; + double real_sec; + int total_sec; setup();
@@ -107,13 +108,13 @@ NULL); clock_gettime(CLOCK_REALTIME, &tv_end); - /* do a rounding */ - real_sec = (int)(0.5 + (tv_end.tv_sec - tv_start.tv_sec + - 1e-9 * (tv_end.tv_nsec - tv_start.tv_nsec))); - if (real_sec == total_sec) + real_sec = (tv_end.tv_sec - tv_start.tv_sec + + 1e-9 * (tv_end.tv_nsec - tv_start.tv_nsec)); + /* allow about 20% error */ + if (abs(real_sec - total_sec) < 0.2 * total_sec) tst_resm(TPASS, "Sleep time was correct"); else - tst_resm(TFAIL, "Sleep time was incorrect:%d != %d", + tst_resm(TFAIL, "Sleep time was incorrect:%d != %lf", total_sec, real_sec); }
Signature · 5 lines
Quality Assurance Associate (Kernel) in Red Hat Inc. (Beijing R&D Branch) TEL: +86-10-62608150 Web: http://www.redhat.com/
Hi,
Tests can be easily failing when using real_sec == total_sec. Changed to the similar way as in nsec part does, allow 20% error.
testcases/kernel/syscalls/pselect/pselect01.c +7 -6
@@ -66,7 +66,8 @@int retval;struct timespec tv, tv_start, tv_end;long real_nsec, total_nsec; -int real_sec, total_sec; +double real_sec; +int total_sec;setup ();
@@ -107,13 +108,13 @@ NULL);clock_gettime (CLOCK_REALTIME , &tv_end); -/* do a rounding */ - real_sec = (int )(0.5 + (tv_end.tv_sec - tv_start.tv_sec + -1e-9 * (tv_end.tv_nsec - tv_start.tv_nsec))); -if (real_sec == total_sec) + real_sec = (tv_end.tv_sec - tv_start.tv_sec + +1e-9 * (tv_end.tv_nsec - tv_start.tv_nsec)); +/* allow about 20% error */ +if (abs (real_sec - total_sec) <0.2 * total_sec)tst_resm (TPASS ,"Sleep time was correct" );else -tst_resm (TFAIL ,"Sleep time was incorrect:%d != %d" , +tst_resm (TFAIL ,"Sleep time was incorrect:%d != %lf" , total_sec, real_sec); }
------------------------------------------------------------------------------
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