[PATCH] Fix sporadic pselect01 failure

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] Fix sporadic pselect01 failure

by Craig Meier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Every once in a while, pselect01 fails with the following output:

FAIL  :  Sleep time was incorrect:5 != 6

This is because we expect our sleeps of slightly more than 5 seconds to
last at most 5 seconds (if we're uninterrupted, integer truncation will
mean this only comes up about 1% of the time).  To fix this, we should
instead expect our sleeps to last between 5 and 6 seconds, as in the
patch inlined below.

Signed-off-by: Craig Meier <crmeier@...>

svn diff -r 101920:110032 testcases/kernel/syscalls/pselect/pselect01.c
Index: testcases/kernel/syscalls/pselect/pselect01.c
===================================================================
--- testcases/kernel/syscalls/pselect/pselect01.c       (revision
101920)
+++ testcases/kernel/syscalls/pselect/pselect01.c       (revision
110032)
@@ -128,7 +128,7 @@

   /* Changed total_sec compare to an at least vs an exact compare */

-  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",total_sec,(end -
start));



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Ltp-list mailing list
Ltp-list@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [PATCH] Fix sporadic pselect01 failure

by Subrata Modak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-07-02 at 11:02 -0700, Craig Meier wrote:

> Every once in a while, pselect01 fails with the following output:
>
> FAIL  :  Sleep time was incorrect:5 != 6
>
> This is because we expect our sleeps of slightly more than 5 seconds to
> last at most 5 seconds (if we're uninterrupted, integer truncation will
> mean this only comes up about 1% of the time).  To fix this, we should
> instead expect our sleeps to last between 5 and 6 seconds, as in the
> patch inlined below.
>
> Signed-off-by: Craig Meier <crmeier@...>
>
Thanks Craig. Actually, we knew about this issue long back. But we did
not have a proper solution to this.

I have even increased the loop counter and the test passes fine. The
probability of this test fails mostly in situations when the loop
counter increases. Your Patch fixes that. Patch is merged. Please see
the result below when the loop count was increased to 20:

pselect01    1  PASS  :  Basic pselect syscall testing....OK
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 1
secs
pselect01    2  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 2
secs
pselect01    3  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 3
secs
pselect01    4  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 4
secs
pselect01    5  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 5
secs
pselect01    6  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 6
secs
pselect01    7  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 7
secs
pselect01    8  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 8
secs
pselect01    9  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 9
secs
pselect01   10  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 10
secs
pselect01   11  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 11
secs
pselect01   12  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 12
secs
pselect01   13  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 13
secs
pselect01   14  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 14
secs
pselect01   15  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 15
secs
pselect01   16  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 16
secs
pselect01   17  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 17
secs
pselect01   18  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 18
secs
pselect01   19  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 19
secs
pselect01   20  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for 20
secs
pselect01   21  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
1000000 micro secs
pselect01   22  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
2000000 micro secs
pselect01   23  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
3000000 micro secs
pselect01   24  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
4000000 micro secs
pselect01   25  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
5000000 micro secs
pselect01   26  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
6000000 micro secs
pselect01   27  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
7000000 micro secs
pselect01   28  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
8000000 micro secs
pselect01   29  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
9000000 micro secs
pselect01   30  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
10000000 micro secs
pselect01   31  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
11000000 micro secs
pselect01   32  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
12000000 micro secs
pselect01   33  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
13000000 micro secs
pselect01   34  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
14000000 micro secs
pselect01   35  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
15000000 micro secs
pselect01   36  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
16000000 micro secs
pselect01   37  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
17000000 micro secs
pselect01   38  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
18000000 micro secs
pselect01   39  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
19000000 micro secs
pselect01   40  PASS  :  Sleep time was correct
pselect01    0  INFO  :  Testing basic pselect sanity,Sleeping for
20000000 micro secs
pselect01   41  PASS  :  Sleep time was correct


Regards--
Subrata

> svn diff -r 101920:110032 testcases/kernel/syscalls/pselect/pselect01.c
> Index: testcases/kernel/syscalls/pselect/pselect01.c
> ===================================================================
> --- testcases/kernel/syscalls/pselect/pselect01.c       (revision
> 101920)
> +++ testcases/kernel/syscalls/pselect/pselect01.c       (revision
> 110032)
> @@ -128,7 +128,7 @@
>
>    /* Changed total_sec compare to an at least vs an exact compare */
>
> -  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",total_sec,(end -
> start));
>
>
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@...
> https://lists.sourceforge.net/lists/listinfo/ltp-list


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Ltp-list mailing list
Ltp-list@...
https://lists.sourceforge.net/lists/listinfo/ltp-list
LightInTheBox - Buy quality products at wholesale price