summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-27 16:07:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-28 09:09:47 +0100
commitd72aac4be901e2d721fe6cd477faf9a2ad5b5b72 (patch)
tree86f1fd37350e7dd7c083aed99f3e750d75656c41 /meta/recipes-core/glib-2.0
parent0b51f406d8fe1fbd19dbc058701bf745fdf209d2 (diff)
downloadpoky-d72aac4be901e2d721fe6cd477faf9a2ad5b5b72.tar.gz
glib: Fix ptest race issue
gio/tests/portal: Fix test ordering race When the gnome test runner executes the tests, the test appear to execute in disk order. This means it sometimes works and we sometimes see breakage in portal-support-snap and portal-support-snap-classic. The issue is that some tests create config files but some don't. If they run in the wrong order, tests see config files they shouldn't and break. Fix this by deleting the files after each test run, properly cleaning up after themselves. There are probably better ways to handle this but this patch should at least let us check this is the issue. I've tried to report upstream but their issue tracker account creation is struggling and I can't get my account to work. (From OE-Core rev: bff17171841fd15fb6084262e397c736005f7e3b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glib-2.0')
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/fix-ptest.patch166
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb1
2 files changed, 167 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/fix-ptest.patch b/meta/recipes-core/glib-2.0/glib-2.0/fix-ptest.patch
new file mode 100644
index 0000000000..1ae98be707
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/fix-ptest.patch
@@ -0,0 +1,166 @@
1gio/tests/portal: Fix test ordering race
2
3When the gnome test runner executes the tests, the test appear to execute in disk
4order. This means it sometimes works and we sometimes see breakage in portal-support-snap
5and portal-support-snap-classic.
6
7The issue is that some tests create config files but some don't. If they run
8in the wrong order, tests see config files they shouldn't and break.
9
10Fix this by deleting the files after each test run, properly cleaning up after
11themselves. There are probably better ways to handle this but this patch should
12at least let us check this is the issue.
13
14I've tried to report upstream but their issue tracker account creation is struggling
15and I can't get my account to work.
16
17Upstream-Status: Pending
18
19Index: glib-2.76.2/gio/tests/portal-support-snap-classic.c
20===================================================================
21--- glib-2.76.2.orig/gio/tests/portal-support-snap-classic.c
22+++ glib-2.76.2/gio/tests/portal-support-snap-classic.c
23@@ -89,6 +89,9 @@ test_portal_support_snap_none (SetupData
24 g_assert_false (glib_should_use_portal ());
25 g_assert_true (glib_network_available_in_sandbox ());
26 g_assert_true (glib_has_dconf_access_in_sandbox ());
27+
28+ cleanup_snapfiles (setup->snap_path);
29+ cleanup_snapfiles (setup->bin_path);
30 }
31
32 static void
33@@ -101,6 +104,9 @@ test_portal_support_snap_all (SetupData
34 g_assert_false (glib_should_use_portal ());
35 g_assert_true (glib_network_available_in_sandbox ());
36 g_assert_true (glib_has_dconf_access_in_sandbox ());
37+
38+ cleanup_snapfiles (setup->snap_path);
39+ cleanup_snapfiles (setup->bin_path);
40 }
41
42 int
43Index: glib-2.76.2/gio/tests/portal-support-snap.c
44===================================================================
45--- glib-2.76.2.orig/gio/tests/portal-support-snap.c
46+++ glib-2.76.2/gio/tests/portal-support-snap.c
47@@ -80,6 +80,8 @@ test_portal_support_snap_no_snapctl (Set
48 g_assert_false (glib_should_use_portal ());
49 g_assert_false (glib_network_available_in_sandbox ());
50 g_assert_false (glib_has_dconf_access_in_sandbox ());
51+
52+ cleanup_snapfiles (setup->snap_path);
53 }
54
55 static void
56@@ -92,6 +94,9 @@ test_portal_support_snap_none (SetupData
57 g_assert_false (glib_should_use_portal ());
58 g_assert_false (glib_network_available_in_sandbox ());
59 g_assert_false (glib_has_dconf_access_in_sandbox ());
60+
61+ cleanup_snapfiles (setup->snap_path);
62+ cleanup_snapfiles (setup->bin_path);
63 }
64
65 static void
66@@ -104,6 +109,9 @@ test_portal_support_snap_all (SetupData
67 g_assert_true (glib_should_use_portal ());
68 g_assert_true (glib_network_available_in_sandbox ());
69 g_assert_true (glib_has_dconf_access_in_sandbox ());
70+
71+ cleanup_snapfiles (setup->snap_path);
72+ cleanup_snapfiles (setup->bin_path);
73 }
74
75 static void
76@@ -116,6 +124,9 @@ test_portal_support_snap_desktop_only (S
77 g_assert_true (glib_should_use_portal ());
78 g_assert_true (glib_network_available_in_sandbox ());
79 g_assert_false (glib_has_dconf_access_in_sandbox ());
80+
81+ cleanup_snapfiles (setup->snap_path);
82+ cleanup_snapfiles (setup->bin_path);
83 }
84
85 static void
86@@ -128,6 +139,9 @@ test_portal_support_snap_network_only (S
87 g_assert_false (glib_should_use_portal ());
88 g_assert_true (glib_network_available_in_sandbox ());
89 g_assert_false (glib_has_dconf_access_in_sandbox ());
90+
91+ cleanup_snapfiles (setup->snap_path);
92+ cleanup_snapfiles (setup->bin_path);
93 }
94
95 static void
96@@ -140,6 +154,9 @@ test_portal_support_snap_gsettings_only
97 g_assert_false (glib_should_use_portal ());
98 g_assert_false (glib_network_available_in_sandbox ());
99 g_assert_true (glib_has_dconf_access_in_sandbox ());
100+
101+ cleanup_snapfiles (setup->snap_path);
102+ cleanup_snapfiles (setup->bin_path);
103 }
104
105 static void
106@@ -182,6 +199,9 @@ test_portal_support_snap_updates_dynamic
107 g_assert_false (glib_should_use_portal ());
108 g_assert_false (glib_network_available_in_sandbox ());
109 g_assert_false (glib_has_dconf_access_in_sandbox ());
110+
111+ cleanup_snapfiles (setup->snap_path);
112+ cleanup_snapfiles (setup->bin_path);
113 }
114
115 int
116Index: glib-2.76.2/gio/tests/portal-support-utils.c
117===================================================================
118--- glib-2.76.2.orig/gio/tests/portal-support-utils.c
119+++ glib-2.76.2/gio/tests/portal-support-utils.c
120@@ -26,6 +26,33 @@
121 #include <glib.h>
122 #include <glib/gstdio.h>
123
124+
125+void
126+cleanup_snapfiles (const gchar *path)
127+{
128+ GDir *dir = NULL;
129+ const gchar *entry;
130+
131+ dir = g_dir_open (path, 0, NULL);
132+ if (dir == NULL)
133+ {
134+ /* Assume it’s a file. Ignore failure. */
135+ (void) g_remove (path);
136+ return;
137+ }
138+
139+ while ((entry = g_dir_read_name (dir)) != NULL)
140+ {
141+ gchar *sub_path = g_build_filename (path, entry, NULL);
142+ cleanup_snapfiles (sub_path);
143+ g_free (sub_path);
144+ }
145+
146+ g_dir_close (dir);
147+
148+ g_rmdir (path);
149+}
150+
151 void
152 create_fake_snapctl (const char *path,
153 const char *supported_op)
154Index: glib-2.76.2/gio/tests/portal-support-utils.h
155===================================================================
156--- glib-2.76.2.orig/gio/tests/portal-support-utils.h
157+++ glib-2.76.2/gio/tests/portal-support-utils.h
158@@ -23,6 +23,8 @@
159
160 #include <glib.h>
161
162+void cleanup_snapfiles (const gchar *path);
163+
164 void create_fake_snap_yaml (const char *snap_path,
165 gboolean is_classic);
166
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb
index f3a716eb9d..7a0ed6b603 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.76.2.bb
@@ -15,6 +15,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
15 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \ 15 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
16 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ 16 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
17 file://0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch \ 17 file://0001-Avoid-having-g_futex_simple-inadvertently-modify-err.patch \
18 file://fix-ptest.patch \
18 " 19 "
19SRC_URI:append:class-native = " file://relocate-modules.patch" 20SRC_URI:append:class-native = " file://relocate-modules.patch"
20 21