public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing] timeout/test: clear state for timeout updates
@ 2020-12-08 21:57 Pavel Begunkov
  2020-12-08 22:44 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2020-12-08 21:57 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Clear the ring before test_update_nonexistent_timeout(), because
otherwise previous test_single_timeout_wait() may leave an internal
timeout, that would fire and fail the test with -ETIME.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 test/timeout.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/timeout.c b/test/timeout.c
index b80fc36..9c8211c 100644
--- a/test/timeout.c
+++ b/test/timeout.c
@@ -1260,6 +1260,14 @@ int main(int argc, char *argv[])
 		return ret;
 	}
 
+	/* io_uring_wait_cqes() may have left a timeout, reinit ring */
+	io_uring_queue_exit(&ring);
+	ret = io_uring_queue_init(8, &ring, 0);
+	if (ret) {
+		fprintf(stderr, "ring setup failed\n");
+		return 1;
+	}
+
 	ret = test_update_nonexistent_timeout(&ring);
 	has_timeout_update = (ret != -EINVAL);
 	if (has_timeout_update) {
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH liburing] timeout/test: clear state for timeout updates
  2020-12-08 21:57 [PATCH liburing] timeout/test: clear state for timeout updates Pavel Begunkov
@ 2020-12-08 22:44 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-12-08 22:44 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 12/8/20 2:57 PM, Pavel Begunkov wrote:
> Clear the ring before test_update_nonexistent_timeout(), because
> otherwise previous test_single_timeout_wait() may leave an internal
> timeout, that would fire and fail the test with -ETIME.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-08 22:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-08 21:57 [PATCH liburing] timeout/test: clear state for timeout updates Pavel Begunkov
2020-12-08 22:44 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox