test/ring-leak.c: kick UNIX garbage collection

Provide a more deterministic runtime by avoiding waiting for a random
GC run. This can take a long time depending on what is going on in
the host, it's been observed to even timeout the test.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe
2022-10-03 09:17:27 -06:00
parent 6c786f0c4f
commit 08fe94d13f
+13
View File
@@ -135,6 +135,17 @@ static int test_iowq_request_cancel(void)
return 0;
}
static void trigger_unix_gc(void)
{
int fd;
fd = socket(AF_UNIX, SOCK_DGRAM, 0);
if (fd < 0)
perror("socket dgram");
else
close(fd);
}
static int test_scm_cycles(bool update)
{
char buffer[128];
@@ -193,6 +204,8 @@ static int test_scm_cycles(bool update)
/* should unregister files and close the write fd */
io_uring_queue_exit(&ring);
trigger_unix_gc();
/*
* We're trying to wait for the ring to "really" exit, that will be
* done async. For that rely on the registered write end to be closed