Re: svn commit: r336905 - head/tests/sys/kqueue/libkqueue

2018-08-03 Thread David A. Bright
On 07/30/2018 09:21 AM, David Bright wrote:
> Author: dab
> Date: Mon Jul 30 14:21:49 2018
> New Revision: 336905
> URL: https://svnweb.freebsd.org/changeset/base/336905
>
> Log:
>   Correct possible misleading error message in kqtest.
>   
>   ian@ pointed out that in the test_abstime() function time(NULL) is
>   used twice; once in an "if" test and again in the enclosed error
>   message. If the true branch was taken and the process got preempted
>   before the second time(NULL) call, by the time the error message was
>   generated enough time could have elapsed that the message could claim
>   that the event came "too early" but print an event time that was after
>   the expected timeout. Correct by making the time(NULL) call only once
>   and using that returned time in both the "if" test and the error
>   message.
>   
>   Reported by:ian@
>   MFC after:  4 days
>   X-MFC-with: r336761, r336781, r336802
It turns out that this won't be MFC'd as the change doesn't apply to
stable/11 or stable/10. The particular test corrected by this change
doesn't exist in those branches.
-- 

David Bright
d...@freebsd.org

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336905 - head/tests/sys/kqueue/libkqueue

2018-07-30 Thread David Bright
Author: dab
Date: Mon Jul 30 14:21:49 2018
New Revision: 336905
URL: https://svnweb.freebsd.org/changeset/base/336905

Log:
  Correct possible misleading error message in kqtest.
  
  ian@ pointed out that in the test_abstime() function time(NULL) is
  used twice; once in an "if" test and again in the enclosed error
  message. If the true branch was taken and the process got preempted
  before the second time(NULL) call, by the time the error message was
  generated enough time could have elapsed that the message could claim
  that the event came "too early" but print an event time that was after
  the expected timeout. Correct by making the time(NULL) call only once
  and using that returned time in both the "if" test and the error
  message.
  
  Reported by:  ian@
  MFC after:4 days
  X-MFC-with:   r336761, r336781, r336802
  Sponsored by: Dell EMC

Modified:
  head/tests/sys/kqueue/libkqueue/timer.c

Modified: head/tests/sys/kqueue/libkqueue/timer.c
==
--- head/tests/sys/kqueue/libkqueue/timer.c Mon Jul 30 12:58:33 2018
(r336904)
+++ head/tests/sys/kqueue/libkqueue/timer.c Mon Jul 30 14:21:49 2018
(r336905)
@@ -220,16 +220,17 @@ test_abstime(void)
 {
 const char *test_id = "kevent(EVFILT_TIMER, EV_ONESHOT, NOTE_ABSTIME)";
 struct kevent kev;
-time_t when;
+time_t start;
+time_t stop;
 const int timeout = 3;
 
 test_begin(test_id);
 
 test_no_kevents();
 
-when = time(NULL);
+start = time(NULL);
 EV_SET(, vnode_fd, EVFILT_TIMER, EV_ADD | EV_ONESHOT,
-  NOTE_ABSTIME | NOTE_SECONDS, when + timeout, NULL);
+  NOTE_ABSTIME | NOTE_SECONDS, start + timeout, NULL);
 if (kevent(kqfd, , 1, NULL, 0, NULL) < 0)
 err(1, "%s", test_id);
 
@@ -238,8 +239,9 @@ test_abstime(void)
 kev.data = 1;
 kev.fflags = 0;
 kevent_cmp(, kevent_get(kqfd));
-if (time(NULL) < when + timeout)
-   err(1, "too early %jd %jd", (intmax_t)time(NULL), (intmax_t)(when + 
timeout));
+stop = time(NULL);
+if (stop < start + timeout)
+   err(1, "too early %jd %jd", (intmax_t)stop, (intmax_t)(start + 
timeout));
 
 /* Check if the event occurs again */
 sleep(3);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"