History log of /src/tests/sys/kqueue/libkqueue/timer.c (Results 1 – 25 of 32)
Revision Date Author Comments
# 994bec47 24-Jun-2025 Gleb Smirnoff <glebius@FreeBSD.org>

tests/kqueue: repair flaky test

The test arms timer for 500 msec and then sleeps 1 second and expects that
the timer would always fire exactly 2 times. However, it has a chance to
legitimately fire

tests/kqueue: repair flaky test

The test arms timer for 500 msec and then sleeps 1 second and expects that
the timer would always fire exactly 2 times. However, it has a chance to
legitimately fire only once. This makes the test flaky. Fix the test
reducing sleep time down to 495 msec.

The problem started to show up recently, and I attribute that to
626ea75ed2e9. Before this revision sleep(3) was almost always sleeping
over 1000 msec, now it can sleep exactly 1000 msec.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D50996

show more ...


# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# d6d4f9b4 25-May-2022 Mark Johnston <markj@FreeBSD.org>

kqueue tests: Add new EVFILT_TIMER regression tests from upstream

One of the tests exposes the regression reported in PR 264131.

One test is disabled because FreeBSD does not support setting EV_ONE

kqueue tests: Add new EVFILT_TIMER regression tests from upstream

One of the tests exposes the regression reported in PR 264131.

One test is disabled because FreeBSD does not support setting EV_ONESHOT
on an already-added periodic timer. Though, in this case the flag is
simply ignored, which isn't ideal.

One test is slightly modified to set EV_ADD when reconfiguring a
disabled timer per some commentary in PR 258412.

Ideally we would re-import the test suite from libkqueue but there is a
fair bit of divergence so this will require some effort. This just gets
us one small step closer while increasing test coverage.

PR: 258412
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

show more ...


# 2f4dbe27 01-Oct-2021 Kyle Evans <kevans@FreeBSD.org>

kqueue: fix recent assertion

NOTE_ABSTIME may also have a zero timeout, which indicates that we
should still fire immediately as an absolute time in the past. A test
has been added for this one as

kqueue: fix recent assertion

NOTE_ABSTIME may also have a zero timeout, which indicates that we
should still fire immediately as an absolute time in the past. A test
has been added for this one as well.

Fixes: 9c999a259f00 ("kqueue: don't arbitrarily restrict long-past...")
Point hat: kevans
Reported by: syzbot+1c8d1154f560b3930042@syzkaller.appspotmail.com

show more ...


# 9c999a25 29-Sep-2021 Kyle Evans <kevans@FreeBSD.org>

kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejec

kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected. We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

Reviewed by: kib, markj
Discussed with: allanjude
Differential Revision: https://reviews.freebsd.org/D32230

show more ...


# 0fbdc372 20-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

tests: kqueue: fix some issues with now() on ILP32 platforms

There were ultimately two separate problems here:
- a 32-bit long cannot represent microseconds since 1970 (noted by ian)
- time_t is 32-

tests: kqueue: fix some issues with now() on ILP32 platforms

There were ultimately two separate problems here:
- a 32-bit long cannot represent microseconds since 1970 (noted by ian)
- time_t is 32-bit on i386, so now() was wrong anyways even with the correct
return type.

For the first, just explicitly use a uint64_t for now() and all of the
callers. For the second, we need to explicitly cast tv_sec to uint64_t
before it gets multiplied in the SEC_TO_US macro. Casting this instance
rather than generally in the macro was arbitrarily chosen simply because all
other uses are converting small relative time values.

The tests now pass on i386, at least; presumably other ILP32 will be fine
now as well.

show more ...


# c9c283bd 18-Apr-2020 Alex Richardson <arichardson@FreeBSD.org>

Fix various warnings in tests/sys/kqueue and bump WARNS

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D24296


# c17dd0e8 17-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

tests: kqueue: use a more precise timer for the NOTE_ABSTIME test

Originally noticed while attempting to run the kqueue tests under
qemu-user-static, this apparently just happens sometimes when runn

tests: kqueue: use a more precise timer for the NOTE_ABSTIME test

Originally noticed while attempting to run the kqueue tests under
qemu-user-static, this apparently just happens sometimes when running in a
jail in general -- the timer will fire off "too early," but it's really just
the result of imprecise measurements (noted by cem).

Kicking this over to NOTE_USECONDS still tests the correct thing while
allowing it to work more consistently; a basic sanity test reveals that we
often end up coming in just less than 200 microseconds after the timer
fired off.

MFC after: 3 days

show more ...


# ce6a89e2 06-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-f

kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

show more ...


# 67350cb5 09-Dec-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340918 through r341763.


# d3404881 27-Nov-2018 David Bright <dab@FreeBSD.org>

Make whitespace more consistent in libkqueue tests.

After r337820, which "corrected" some spaces-instead-of-tab whitespace
issues in the libkqueue tests, jmg@ pointed out that these files were
origi

Make whitespace more consistent in libkqueue tests.

After r337820, which "corrected" some spaces-instead-of-tab whitespace
issues in the libkqueue tests, jmg@ pointed out that these files were
originally space-based, not tab-spaced, and so the correction should
have been to get rid of the tabs that had been introduced in previous
changes, not the spaces. This change does that. This is a whitespace
only change; no functional change is intended.

Reported by: jmg@
MFC after: 3 days
Sponsored by: Dell EMC Isilon

show more ...


# bbd7a929 04-Aug-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r336870 through r337285, and resolve conflicts.


# 994bec47 24-Jun-2025 Gleb Smirnoff <glebius@FreeBSD.org>

tests/kqueue: repair flaky test

The test arms timer for 500 msec and then sleeps 1 second and expects that
the timer would always fire exactly 2 times. However, it has a chance to
legitimately fire

tests/kqueue: repair flaky test

The test arms timer for 500 msec and then sleeps 1 second and expects that
the timer would always fire exactly 2 times. However, it has a chance to
legitimately fire only once. This makes the test flaky. Fix the test
reducing sleep time down to 495 msec.

The problem started to show up recently, and I attribute that to
626ea75ed2e9. Before this revision sleep(3) was almost always sleeping
over 1000 msec, now it can sleep exactly 1000 msec.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D50996

show more ...


# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# d6d4f9b4 25-May-2022 Mark Johnston <markj@FreeBSD.org>

kqueue tests: Add new EVFILT_TIMER regression tests from upstream

One of the tests exposes the regression reported in PR 264131.

One test is disabled because FreeBSD does not support setting EV_ONE

kqueue tests: Add new EVFILT_TIMER regression tests from upstream

One of the tests exposes the regression reported in PR 264131.

One test is disabled because FreeBSD does not support setting EV_ONESHOT
on an already-added periodic timer. Though, in this case the flag is
simply ignored, which isn't ideal.

One test is slightly modified to set EV_ADD when reconfiguring a
disabled timer per some commentary in PR 258412.

Ideally we would re-import the test suite from libkqueue but there is a
fair bit of divergence so this will require some effort. This just gets
us one small step closer while increasing test coverage.

PR: 258412
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

show more ...


# 2f4dbe27 01-Oct-2021 Kyle Evans <kevans@FreeBSD.org>

kqueue: fix recent assertion

NOTE_ABSTIME may also have a zero timeout, which indicates that we
should still fire immediately as an absolute time in the past. A test
has been added for this one as

kqueue: fix recent assertion

NOTE_ABSTIME may also have a zero timeout, which indicates that we
should still fire immediately as an absolute time in the past. A test
has been added for this one as well.

Fixes: 9c999a259f00 ("kqueue: don't arbitrarily restrict long-past...")
Point hat: kevans
Reported by: syzbot+1c8d1154f560b3930042@syzkaller.appspotmail.com

show more ...


# 9c999a25 29-Sep-2021 Kyle Evans <kevans@FreeBSD.org>

kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejec

kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected. We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

Reviewed by: kib, markj
Discussed with: allanjude
Differential Revision: https://reviews.freebsd.org/D32230

show more ...


# 0fbdc372 20-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

tests: kqueue: fix some issues with now() on ILP32 platforms

There were ultimately two separate problems here:
- a 32-bit long cannot represent microseconds since 1970 (noted by ian)
- time_t is 32-

tests: kqueue: fix some issues with now() on ILP32 platforms

There were ultimately two separate problems here:
- a 32-bit long cannot represent microseconds since 1970 (noted by ian)
- time_t is 32-bit on i386, so now() was wrong anyways even with the correct
return type.

For the first, just explicitly use a uint64_t for now() and all of the
callers. For the second, we need to explicitly cast tv_sec to uint64_t
before it gets multiplied in the SEC_TO_US macro. Casting this instance
rather than generally in the macro was arbitrarily chosen simply because all
other uses are converting small relative time values.

The tests now pass on i386, at least; presumably other ILP32 will be fine
now as well.

show more ...


# c9c283bd 18-Apr-2020 Alex Richardson <arichardson@FreeBSD.org>

Fix various warnings in tests/sys/kqueue and bump WARNS

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D24296


# c17dd0e8 17-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

tests: kqueue: use a more precise timer for the NOTE_ABSTIME test

Originally noticed while attempting to run the kqueue tests under
qemu-user-static, this apparently just happens sometimes when runn

tests: kqueue: use a more precise timer for the NOTE_ABSTIME test

Originally noticed while attempting to run the kqueue tests under
qemu-user-static, this apparently just happens sometimes when running in a
jail in general -- the timer will fire off "too early," but it's really just
the result of imprecise measurements (noted by cem).

Kicking this over to NOTE_USECONDS still tests the correct thing while
allowing it to work more consistently; a basic sanity test reveals that we
often end up coming in just less than 200 microseconds after the timer
fired off.

MFC after: 3 days

show more ...


# ce6a89e2 06-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-f

kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

show more ...


# 67350cb5 09-Dec-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r340918 through r341763.


# d3404881 27-Nov-2018 David Bright <dab@FreeBSD.org>

Make whitespace more consistent in libkqueue tests.

After r337820, which "corrected" some spaces-instead-of-tab whitespace
issues in the libkqueue tests, jmg@ pointed out that these files were
origi

Make whitespace more consistent in libkqueue tests.

After r337820, which "corrected" some spaces-instead-of-tab whitespace
issues in the libkqueue tests, jmg@ pointed out that these files were
originally space-based, not tab-spaced, and so the correction should
have been to get rid of the tabs that had been introduced in previous
changes, not the spaces. This change does that. This is a whitespace
only change; no functional change is intended.

Reported by: jmg@
MFC after: 3 days
Sponsored by: Dell EMC Isilon

show more ...


# bbd7a929 04-Aug-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r336870 through r337285, and resolve conflicts.


# d0a17901 30-Jul-2018 David Bright <dab@FreeBSD.org>

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 t

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

show more ...


12