diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2019-01-28 13:53:36 +0000 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2019-01-28 13:53:36 +0000 |
commit | 140b82083f66511932f8d4b9c6a91a69a78446a1 (patch) | |
tree | 579d9c6064590f91485d42ddc4b2e9717440177e | |
parent | 80f2c96a458caed2afdb9b977a6f148e3e9ec2e1 (diff) | |
parent | 13282768c7c31b2b1914233e2c914afe015e461e (diff) | |
download | glib-140b82083f66511932f8d4b9c6a91a69a78446a1.tar.gz |
Merge branch 'trash-mount-points-master' into 'master'
Don't fail trash test if ~/.local doesn't exist or mount points can't be determined (master)
See merge request GNOME/glib!593
-rw-r--r-- | gio/tests/trash.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/gio/tests/trash.c b/gio/tests/trash.c index 1055585e5..4bf8fd0ef 100644 --- a/gio/tests/trash.c +++ b/gio/tests/trash.c @@ -107,14 +107,54 @@ test_trash_symlinks (void) g_test_bug ("1522"); - /* The test assumes that ~/.local always exists. */ target = g_build_filename (g_get_home_dir (), ".local", NULL); + + if (!g_file_test (target, G_FILE_TEST_IS_DIR)) + { + gchar *message; + + message = g_strdup_printf ("Directory '%s' does not exist", target); + g_test_skip (message); + g_free (message); + g_free (target); + return; + } + target_mount = g_unix_mount_for (target, NULL); + + if (target_mount == NULL) + { + gchar *message; + + message = g_strdup_printf ("Unable to determine mount point for %s", + target); + g_test_skip (message); + g_free (message); + g_free (target); + return; + } + g_assert_nonnull (target_mount); g_test_message ("Target: %s (mount: %s)", target, g_unix_mount_get_mount_path (target_mount)); tmp = g_dir_make_tmp ("test-trashXXXXXX", &error); + g_assert_no_error (error); + g_assert_nonnull (tmp); tmp_mount = g_unix_mount_for (tmp, NULL); + + if (tmp_mount == NULL) + { + gchar *message; + + message = g_strdup_printf ("Unable to determine mount point for %s", tmp); + g_test_skip (message); + g_free (message); + g_unix_mount_free (target_mount); + g_free (target); + g_free (tmp); + return; + } + g_assert_nonnull (tmp_mount); g_test_message ("Tmp: %s (mount: %s)", tmp, g_unix_mount_get_mount_path (tmp_mount)); |