mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Merge branch 'main' into 'main'
gio/tests/portal-support: Fix snap test ordering race Closes #3020 See merge request GNOME/glib!3454
This commit is contained in:
commit
ad464d5563
@ -66,6 +66,9 @@ tests_teardown (SetupData *setup_data,
|
||||
else
|
||||
g_unsetenv ("SNAP");
|
||||
|
||||
cleanup_snapfiles (setup_data->snap_path);
|
||||
cleanup_snapfiles (setup_data->bin_path);
|
||||
|
||||
g_clear_pointer (&setup_data->old_path, g_free);
|
||||
g_clear_pointer (&setup_data->old_snap, g_free);
|
||||
}
|
||||
|
@ -67,6 +67,9 @@ tests_teardown (SetupData *setup_data,
|
||||
else
|
||||
g_unsetenv ("SNAP");
|
||||
|
||||
cleanup_snapfiles (setup_data->snap_path);
|
||||
cleanup_snapfiles (setup_data->bin_path);
|
||||
|
||||
g_clear_pointer (&setup_data->old_path, g_free);
|
||||
g_clear_pointer (&setup_data->old_snap, g_free);
|
||||
}
|
||||
|
@ -26,6 +26,33 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
|
||||
void
|
||||
cleanup_snapfiles (const gchar *path)
|
||||
{
|
||||
GDir *dir = NULL;
|
||||
const gchar *entry;
|
||||
|
||||
dir = g_dir_open (path, 0, NULL);
|
||||
if (dir == NULL)
|
||||
{
|
||||
/* Assume it’s a file. Ignore failure. */
|
||||
(void) g_remove (path);
|
||||
return;
|
||||
}
|
||||
|
||||
while ((entry = g_dir_read_name (dir)) != NULL)
|
||||
{
|
||||
gchar *sub_path = g_build_filename (path, entry, NULL);
|
||||
cleanup_snapfiles (sub_path);
|
||||
g_free (sub_path);
|
||||
}
|
||||
|
||||
g_dir_close (dir);
|
||||
|
||||
g_rmdir (path);
|
||||
}
|
||||
|
||||
void
|
||||
create_fake_snapctl (const char *path,
|
||||
const char *supported_op)
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
void cleanup_snapfiles (const gchar *path);
|
||||
|
||||
void create_fake_snap_yaml (const char *snap_path,
|
||||
gboolean is_classic);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user