Commit Graph

355 Commits

Author SHA1 Message Date
Jens Axboe eeec5edea3 test/sigfd-deadlock: remove unneeded libaio.h include
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-09-02 19:55:04 -06:00
Jens Axboe 95c86e6b06 Fix missing 'c' in sigfd-deadlock addition
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-09-02 09:15:09 -06:00
Jens Axboe 8dab3799ae Add signalfd deadlock test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-29 18:49:01 -06:00
Jens Axboe c0c96b2757 test/register-restrictions: don't fail if restrictions aren't supported
Also cleanup the tests a bit (static, void).

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-28 10:04:45 -06:00
Stefano Garzarella c62e8d2702 Add test/register-restrictions.c test case
This new test stresses the IORING_REGISTER_RESTRICTIONS opcode.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2020-08-27 15:35:43 +02:00
Jens Axboe abce98153b Add a test case for closed pipe terminating properly
This is fixed by upstream commit:

commit 68faa4727c0e2d7d255d9b97e754f2cda748f141
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue Aug 25 12:27:50 2020 -0600

    io_uring: don't use poll handler if file can't be nonblocking read/written

We're testing whether we first get some data, then a zero return on the
next one when it's closed. The buggy behavior was to arm a poll handler,
which isn't notified when the pipe is closed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-25 17:23:14 -06:00
Jens Axboe 5de5b6a042 test/iopoll: only SQPOLL requires root, IOPOLL does not
We can test IOPOLL just fine as a regular user, so just skip the SQPOLL
specific tests.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-21 15:45:47 -06:00
Jens Axboe 895101b8b8 test/iopoll: coding style fixups
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-21 08:40:24 -06:00
Glauber Costa 3a745bc3dd iopoll: test that we always enter the ring
If the ring is configured to operate in poll mode we need to always
enter the kernel to fetch new events. This behavior was introduced
in  bf3aeb3dbb but recently broken.

Break me once, shame on you. Break me twice, shame on me:
  - Add a unit test.

The unit test submits sqes manually through the system call, which
guarantees that IORING_ENTER_GETEVENTS will not be present in the flag
set during the initial submission.

The only way we can ever fetch new I/O events is if io_uring_submit
indeed will enter the ring despite not having new sqes to submit.

This test passes with 8e8cb865cd but fails before it due to the
aforementioned regression.

Signed-off-by: Glauber Costa <glauber@datadoghq.com>
2020-08-21 09:34:49 -04:00
Jens Axboe 7124bfa7e2 test/a4c0b3decb33-test: limit to 5000 iterations
We currently rely on this test being killed by runtests.sh, and
the test expects this and exits nicely when that happens. But let's
give it a finite runtime in general, so that running it independently
will have it exit nicely on its own as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-20 05:38:50 -06:00
Jens Axboe 81d63a87cb test/lfs-openat: add linked files test case
From Pavel, added a version that sets IOSQE_ASYNC as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-16 08:36:17 -07:00
Jens Axboe a1c610c48f test/double-poll-crash: ignore arguments
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-15 11:53:38 -07:00
Jens Axboe 85bdbaa147 Add test case for double poll crash
This is the generated syzkaller reproducer. Should be fixed by this
mainline commit:

commit d4e7cd36a90e38e0276d6ce0c20f5ccef17ec38c (HEAD -> io_uring-5.9, origin/io_uring-5.9)
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sat Aug 15 11:44:50 2020 -0700

    io_uring: sanitize double poll handling

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-15 11:51:29 -07:00
Jens Axboe 8d5397ec28 test/submit-reuse: accept test argument
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-15 08:49:10 -07:00
Jens Axboe 025fa064c4 test/timeout-overflow: don't run on newer kernels
It's known to fail with the batched completions, just disable it
on newer kernels.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 18:00:06 -06:00
Jens Axboe be9a28a0fc test: add missing SPDX identifiers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 17:46:01 -06:00
Jens Axboe e6f41a5461 Add test cases for file table exit hang
This should be fixed by the kernel commit:

commit f254ac04c8744cf7bfed012717eac34eacc65dfb
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed Aug 12 17:33:30 2020 -0600

    io_uring: enable lookup of links holding inflight files

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 17:44:15 -06:00
Jens Axboe 8a87557966 test/wakeup-hang: ignore argument
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 09:55:52 -06:00
Jens Axboe c5060b31ae Add test case for task_work related wakeup hang
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-07 16:46:56 -06:00
Jens Axboe c4299cd841 test/eeed8b54e0df-test: allow 4096 as valid return too
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-30 10:44:10 -06:00
Jens Axboe 649f9969b9 test/nop-all-sizes: exit ring for each loop
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-11 10:08:45 -06:00
Jens Axboe a930a04f80 Add test case for testing full fill of SQ and CQ ring
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-11 09:49:45 -06:00
Tobias Klauser d07544c2f5 test/statx: test for ENOSYS in statx_syscall_supported
errno will be ENOSYS, not EOPNOTSUPP if the syscall is not there. This
also matches what errno is set to in do_statx if __NR_statx is not
defined.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 08:27:44 -06:00
Jens Axboe 478555bf27 test/statx: be safe and check if __NR_statx is there
Probably don't need this, but it's right before release and I'd hate
for a test to cause compilation failure.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 07:54:49 -06:00
Tobias Klauser 6d2ea702bc test/statx: verify against statx(2) on all archs
Use __NR_statx in do_statx and unconditionally use it to check the
result on all architectures, not just x86_64. This relies on the
fact that __NR_statx should be defined if struct statx and STATX_ALL are
available as well.

Don't fail the test if the statx syscall returns EOPNOTSUPP though.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 07:52:57 -06:00
Jens Axboe 000a67651c test/cq-overflow-peek
Add test case for missing CQ flush when using peek.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 19:30:05 -06:00
Jens Axboe ebbaf26d95 test/cq-full: correct error condition
We only care about if we get less than 8, it's perfectly valid to
get the full 12. In fact, once we modify peek to ensure we flush
kernel side overflows, we will get more.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 09:42:30 -06:00
Jens Axboe 2553ed5d7f test/cq-overflow: correct error condition
We only care about if we get less than 8, it's perfectly valid to
get the full 16. In fact, once we modify peek to ensure we flush
kernel side overflows, we will get more.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 09:36:17 -06:00
Jens Axboe c7135cabe9 test/ce593a6c480a-test: ignore arguments
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-03 09:08:15 -06:00
Jens Axboe e989633cd8 Add regression test case for task_work regression
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-03 09:05:37 -06:00
Jens Axboe d99b222de2 test: various missing return checks from io_uring_wait_cqe()
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-30 09:58:23 -06:00
Bart Van Assche ebc7ceef54 Add a C++ unit test
Since the liburing header files support C++ compilers, add a C++ unit test.
This helps to verify C++ compatibility of the liburing header files.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-28 14:03:56 -06:00
Max Kellermann babcca7c79 test/lfs-openat: open dfd with O_PATH
This triggers a bug present until at least Linux 5.6.11, causing
EBADF, see https://lkml.org/lkml/2020/5/7/1287

Signed-off-by: Max Kellermann <mk@cm4all.com>
2020-06-22 23:06:01 +02:00
Jens Axboe 6bcd306fa2 test/timeout-overflow: use #X for the timeout number
'th doesn't really work for 1/2/3 timeouts, just use # to make it
clear we're dealing with the timeout number.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-22 10:25:17 -06:00
Jens Axboe 5c63fc08da test/runtests.sh: make default timeout be 60 seconds
30 seconds is just a bit too short if the tests are run with
KASAN and PROVE_LOCKING enabled, make it 60 seconds instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-21 20:59:01 -06:00
Bart Van Assche 45ed6e8a4a Makefiles: Enable -Wextra
Enable -Wextra and disable the unused parameter and different signedness
in comparison warnings.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-21 20:49:50 -06:00
Pavel Begunkov fc3dc5b19d test/stdout: fix strcmp non-\0 string
After copying len(str) bytes of a string, the copy won't necessary have
\0 terminator, that makes test_pipe_io_fixed() to fail. Use memcmp().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-16 13:47:13 -06:00
Jens Axboe a81c0849f9 test/runtests.sh: add dmesg check
Lifted this from blktests, basically it just checks for known patterns
of kernel complaints. If we trigger one while running a test, we fail
the test case.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-15 10:49:27 -06:00
Jens Axboe 021025b6ec test/send_recv: add SQPOLL test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-10 19:01:56 -06:00
Jens Axboe bc765b01ff Add test/close-opath.c
This tests whether we can close an O_PATH opened fd. Test program
is an edited version of one from Clay Harris <bugs@claycon.org>, found
here:

https://claycon.org/software/io_uring/tests/close_opath.c

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-09 19:50:30 -06:00
Jens Axboe 10d2ffc8d1 test/runtests.sh: improve failed list
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-06-01 14:19:24 -06:00
Jens Axboe b00ca4081e test/iopoll: skip test if file/device/fs doesn't supported polled IO
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-29 11:35:33 -06:00
Jens Axboe 93e13bc25a test/file-register: ensure write vs read is ordered
We submit both the read and write at the same time, there's no guarantee
the write is even started by the time the read is issued. Play it safe
and wait for the write before starting the read.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-23 16:52:43 -06:00
Jens Axboe f824a63713 test/runtests.sh: include argument for failed test concatenation
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-23 16:38:59 -06:00
Jens Axboe 5d27b05ec9 test/eventfd-disable: ignore test when an argument is given
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-20 11:13:25 -06:00
Stefano Garzarella 87d2753fde Add test/eventfd-disable.c test case
This new test checks if the mechanism to enable/disable notifications
through eventfd when a request is completed works correctly.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-20 11:09:04 -06:00
Jens Axboe 4f18c82de3 test: use config.local for runtests.sh
Add it to .gitignore as well. This makes it easier to have a local
configuration that isn't overwritten by resetting the git tree, or
pulling changes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-20 09:32:11 -06:00
Jens Axboe 0845b537a3 Add test case for SQPOLL -EBUSY bug
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-20 07:36:21 -06:00
Jens Axboe 3827276e9f test/runtests.sh: check if configured test files exist
Helps to catch early if you're missing a module load or filesystem
mount.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-19 22:04:33 -06:00
Jens Axboe 9bc68a1862 test/fadvise: support configured test files
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-05-19 21:58:31 -06:00