From ea96069a1aaf4abe0de5684409ed32eb0b4a5506 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 22 Feb 2021 12:43:54 +0000
Subject: [PATCH] tests: Assert that no file descriptors are leaked

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 tests/pressure-vessel/utils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/pressure-vessel/utils.c b/tests/pressure-vessel/utils.c
index 3bdb9f0a8..9fa84bb99 100644
--- a/tests/pressure-vessel/utils.c
+++ b/tests/pressure-vessel/utils.c
@@ -38,7 +38,7 @@
 
 typedef struct
 {
-  int unused;
+  TestsOpenFdSet old_fds;
 } Fixture;
 
 typedef struct
@@ -51,6 +51,8 @@ setup (Fixture *f,
        gconstpointer context)
 {
   G_GNUC_UNUSED const Config *config = context;
+
+  f->old_fds = tests_check_fd_leaks_enter ();
 }
 
 static void
@@ -58,6 +60,8 @@ teardown (Fixture *f,
           gconstpointer context)
 {
   G_GNUC_UNUSED const Config *config = context;
+
+  tests_check_fd_leaks_leave (f->old_fds);
 }
 
 static void
-- 
GitLab