Commit Graph

25 Commits

Author SHA1 Message Date
Jens Axboe 6c32e92bb0 test: add potential argument, ignore if unused
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-19 17:36:19 -06:00
Jens Axboe e502435779 Add SPDX license identifiers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-02-11 20:34:12 -07:00
Jens Axboe 00dc6876cf test/timeout: remove copied (and wrong) comments
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-04 10:12:56 -07:00
Jens Axboe 7b8d8611b0 test/timeout: add test cases for sqe->flags being set on timeouts
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-04 10:03:38 -07:00
Jens Axboe 96144ea798 Split out system call bits from library interface
Rename the io_uring_* system calls to __sys_io_uring_* and make them
locals.

We only have the system calls because they are not in glibc yet, and
it's somewhat confusing that they share the same namespace as the
library functions. With this change, any exported io_uring_* function
is a library function.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-12-01 11:22:24 -07:00
Jens Axboe f0d57a101b test/timeout: test_single_timeout_nr should wait for 3, not 4
We only submit 3 requests, so don't wait for 4 of them.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-25 09:43:31 -07:00
Hrvoje Zeba 72bb93940b Printout correct failure locations in test/timeout.c
Some printouts were misleading, probably a c/p bug.

Signed-off-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-04 19:42:53 -07:00
Hrvoje Zeba 46e870e976 Use msec parameter instead of TIMEOUT_MSEC in msec_to_ts()
Small fix to make sure correct ts structure is filled with correct values.

Signed-off-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-11-04 19:42:48 -07:00
zhangyi (F) 6cca9e574c test/timeout: add multi timeout reqs test with different count
Add multi timeout reqs test case which want to test submitting timeout
reqs with different count number, check the return sequence and the
status of each req.

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-23 21:41:56 -06:00
zhangyi (F) 37136cb442 test/timeout: add multi timeout reqs test with different timeout
Add multi timeout reqs test case which want to test submitting timeout
reqs with different timeout value, check the return sequence and the
status of each req.

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-23 21:41:54 -06:00
Jens Axboe 93a22668c8 Shorten timeout tests
We use 1s for a lot of testing, shrink it down to 200 msec to allow
it to run a bit quicker.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-21 08:42:04 -06:00
Jens Axboe 80d8217c2f Add IORING_OP_TIMEOUT_REMOVE
Add the command opcode, and add two test cases for it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-16 09:14:11 -06:00
Jens Axboe b75b52e2d4 test/timeout: cleanup cqe seen and error prints
Use stderr always, and include the function name.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-16 07:28:37 -06:00
Jens Axboe 11a8f2bc38 Make io_uring_prep_timeout() take timeout flags
Not in a released version yet, plan for using the flags since we
already have the IORING_TIMEOUT_ABS flag.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-15 17:31:17 -06:00
Jens Axboe f303986495 Add test case for absolute timeouts
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-15 16:52:44 -06:00
Jens Axboe e2934e1444 Switch to 32/64-bit agnostic timeout format
We made a kernel change to support timeouts properly on 32-bit
archs, update liburing to use __kernel_timespec instead of the
differently sized timespec.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-10-01 10:19:54 -06:00
Jens Axboe ac72640594 Fold io_uring_wait_cqes_timeout() with io_uring_wait_cqes()
We also need the sigset for certain setups, and adding a third
option is pretty crazy. Since io_uring_wait_cqes_timeout() isn't
in a released version yet (and neither is io_uring_wait_cqes()),
make the necessary adjustments.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-27 08:32:50 -06:00
Jens Axboe 3ea33cb360 test/timeout: use io_uring_wait_cqes_timeout()
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-21 15:05:15 -06:00
Jens Axboe 8b93cca24b io_uring_wait_cqe_timeout: document that io_uring_submit() not needed
We call this internally after queueing the timeout SQE anyway, so
the application doesn't have to do it upfront.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-21 14:44:57 -06:00
Jens Axboe 76e9232baa Add io_uring_wait_cqe_timeout()
Like io_uring_wait_cqe(), except it accepts a timeout value as well. Note
that an sqe is used internally to handle the timeout. Applications using
this function must never set sqe->user_data to LIBURING_UDATA_TIMEOUT!

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-21 13:02:05 -06:00
Jens Axboe 3ad9074b79 Add TIMEOUT support
Add support for the current TIMEOUT variant. This allows passing
in a timeout and event count, first of which will trigger the
completion of the timeout command.

If the timeout is hit, the command completes with cqe->res == -ETIME.
If the asked number of events complete first, the command completes
with cqe->res == 0.

test/timeout.c tests a variety of timeout conditions.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-20 19:49:30 -06:00
Jens Axboe efb4e86701 Remove TIMEOUT code
We'll rework it for the final version, kill the early version
test case and liburing addition.

This reverts commits:

efb39e105a
e4269d2c10
4652762d5b
f102231b0f

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-19 09:55:18 -06:00
Jens Axboe efb39e105a test/timeout: check if we always get a wakeup from timeout
We need a wakeup even if we don't hit the desired number of
available commands if a timeout has triggered. Add a test case
for that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-17 13:39:47 -06:00
Jens Axboe e4269d2c10 test/timeout: include some notion of verifying length of timeout
In my testing, we're always right on 1000 msec, but allow some slack
and just judge it good if we're within +- 50%.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-17 12:18:07 -06:00
Jens Axboe 4652762d5b Add basic IORING_OP_TIMEOUT test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-09-17 10:03:00 -06:00