<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 18, 2020 at 6:24 PM Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Test allows just 5ms delta for PASS, and test randomly fails in<br>
environments with shared resources and increased steal time.<br>
<br>
Relax the condition and also print deltas if test fails.<br>
Remove DEBUG ifdefs and main parameters to avoid unused variable<br>
warning.<br>
<br>
Signed-off-by: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br>
---<br>
 .../functional/timers/clocks/invaliddates.c   | 25 +++++++------------<br>
 1 file changed, 9 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c b/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c<br>
index face334fd250..d4116b1e9bc0 100644<br>
--- a/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c<br>
+++ b/testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c<br>
@@ -18,8 +18,7 @@<br>
<br>
 #define NUMTESTS 5<br>
<br>
-#define ACCEPTABLESECDELTA 0<br>
-#define ACCEPTABLENSECDELTA 5000000<br>
+#define ACCEPTABLESECDELTA 2<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">It's hard to say what size of the second-delta is a proper value, but to increase it can obviously decrease the failure probability. If there is no better way I'd go with this patch. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br></div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
 static int testtimes[NUMTESTS][2] = {<br>
        {INT32_MAX, 999999999}, // large number<br>
@@ -29,7 +28,7 @@ static int testtimes[NUMTESTS][2] = {<br>
        {1049623200, 999999999},        // daylight savings 2003<br>
 };<br>
<br>
-int main(int argc, char *argv[])<br>
+int main(void)<br>
 {<br>
        struct timespec tpset, tpget, tsreset;<br>
        int secdelta, nsecdelta;<br>
@@ -44,9 +43,6 @@ int main(int argc, char *argv[])<br>
        for (i = 0; i < NUMTESTS; i++) {<br>
                tpset.tv_sec = testtimes[i][0];<br>
                tpset.tv_nsec = testtimes[i][1];<br>
-#ifdef DEBUG<br>
-               printf("Test: %ds %dns\n", testtimes[i][0], testtimes[i][1]);<br>
-#endif<br>
                if (clock_settime(CLOCK_REALTIME, &tpset) == 0) {<br>
                        if (clock_gettime(CLOCK_REALTIME, &tpget) == -1) {<br>
                                printf("Error in clock_gettime()\n");<br>
@@ -58,16 +54,13 @@ int main(int argc, char *argv[])<br>
                                nsecdelta = nsecdelta + 1000000000;<br>
                                secdelta = secdelta - 1;<br>
                        }<br>
-#ifdef DEBUG<br>
-                       printf("Delta:  %ds %dns\n", secdelta, nsecdelta);<br>
-#endif<br>
-                       if ((secdelta > ACCEPTABLESECDELTA) || (secdelta < 0)) {<br>
-                               printf("clock does not appear to be set\n");<br>
-                               failure = 1;<br>
-                       }<br>
-                       if ((nsecdelta > ACCEPTABLENSECDELTA) ||<br>
-                           (nsecdelta < 0)) {<br>
-                               printf("clock does not appear to be set\n");<br>
+<br>
+                       if ((secdelta > ACCEPTABLESECDELTA)<br>
+                               || (secdelta < 0)) {<br>
+                               printf("FAIL: test(%d,%d), secdelta: %d,"<br>
+                                       " nsecdelta: %d\n",<br>
+                                       testtimes[i][0], testtimes[i][1],<br>
+                                       secdelta, nsecdelta);<br>
                                failure = 1;<br>
                        }<br>
                } else {<br>
-- <br>
2.18.1<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>