# Fix io_uring tests \(\#12134\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/47c58cba595a8e1eddf6c87086d52691d180a103)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 47c58cba595a8e1eddf6c87086d52691d180a103

Requested commit: 47c58cba595a8e1eddf6c87086d52691d180a103

Commit: 47c58cba595a8e1eddf6c87086d52691d180a103

Tree: 84ed8e541eaf92bf1d98d5849e89203fa0cf6974

Author: Vincent Rischmann

Committer: GitHub

## Message

```
Fix io_uring tests (#12134)

* io_uring: fix the timeout_remove test

The test does a IORING_OP_TIMEOUT followed with a IORING_OP_TIMEOUT_REMOVE
and assumed we would get the CQEs in the same order.

Linux v5.18 changed how this works and we now get them in the reverse order.

The documentation doesn't explicitly say which CQE we should get first
so just make the test work with both cases.

* io_uring: fix the remove_buffers test

The original test was buggy but accidentally worked with kernels < 5.18

The test assumed that IORING_OP_REMOVE_BUFFERS removed from the start of
but in fact the documentation doesn't specify which buffer is removed,
only that a certain number of buffers are removed.

Starting with the kernel 5.18 the check for the `used_buffer_id` fails.
Turns out that previous kernels removed buffers in such a way that the
remaining buffer for this read would always be 0, however this isn't
true anymore.

Instead of checking a specific value just check that the `used_buffer_id`
corresponds to a valid ID.
```

## Parents

- [9c66fdadc709ca4c00b08aa8fa4dc6312cb559c3](https://git.cafe/gitcafe/zig/commit/9c66fdadc709ca4c00b08aa8fa4dc6312cb559c3?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/47c58cba595a8e1eddf6c87086d52691d180a103?format=markdown)
