From aae17432841df94661adf15fec51beac0229faaf Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 10 Mar 2025 16:25:21 +0000 Subject: [PATCH] tests: Test directories inside /tmp rather than arbitrary paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This probably wasn’t causing any problems since it was a self-contained read only access of a non-existent path. But it’s a bit tidier to contain this all inside `/tmp`. Signed-off-by: Philip Withnall --- glib/tests/dir.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/glib/tests/dir.c b/glib/tests/dir.c index 641cee80a..e01b04595 100644 --- a/glib/tests/dir.c +++ b/glib/tests/dir.c @@ -32,13 +32,15 @@ static void test_dir_nonexisting (void) { GDir *dir; - GError *error; + GError *error = NULL; + char *path = NULL; - error = NULL; - dir = g_dir_open ("/pfrkstrf", 0, &error); - g_assert (dir == NULL); + path = g_build_filename (g_get_tmp_dir (), "does-not-exist", NULL); + dir = g_dir_open (path, 0, &error); + g_assert_null (dir); g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT); g_error_free (error); + g_free (path); } static void