diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-30 15:42:44 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-31 16:53:04 +0100 |
| commit | 0869a82d19531a14e8d63fe67a0e5a25cc6f732a (patch) | |
| tree | 25399059c7908df25978725efd44c45775216553 /meta/recipes-core | |
| parent | 01472f512f45bdd319611871a21172216c74e29a (diff) | |
| download | poky-0869a82d19531a14e8d63fe67a0e5a25cc6f732a.tar.gz | |
glib-2.0: Update ptest fix to upstream backport
Update the ptest fix to match the one accepted upstream.
(From OE-Core rev: 82910dd43889e9ac50f7dba9437e3304c52eb1c3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
3 files changed, 108 insertions, 167 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-portal-support-Fix-snap-test-ordering-race.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-portal-support-Fix-snap-test-ordering-race.patch new file mode 100644 index 0000000000..9e2bc1338b --- /dev/null +++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-portal-support-Fix-snap-test-ordering-race.patch | |||
| @@ -0,0 +1,107 @@ | |||
| 1 | From f47503cc5ae10de6dee319ba6cff257eddabf33e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 3 | Date: Tue, 30 May 2023 11:52:38 +0100 | ||
| 4 | Subject: [PATCH] gio/tests/portal-support: Fix snap test ordering race | ||
| 5 | |||
| 6 | When the gnome test runner executes the tests, the test appear to execute in disk | ||
| 7 | order. This means it sometimes works and sometimes we see breakage in portal-support-snap | ||
| 8 | and portal-support-snap-classic. | ||
| 9 | |||
| 10 | The issue is that some tests create config files but some don't. If they run | ||
| 11 | in the wrong order, tests see config files they shouldn't and break. | ||
| 12 | |||
| 13 | Fix this by deleting the files after each test run, properly cleaning up after | ||
| 14 | themselves. The cleanup code is based upon gtestutils.c:rm_rf(). | ||
| 15 | |||
| 16 | Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/c63cf19d9a8a6ae315a7f9a3fe4ea60c8cf5dece] | ||
| 17 | |||
| 18 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 19 | --- | ||
| 20 | gio/tests/portal-support-snap-classic.c | 3 +++ | ||
| 21 | gio/tests/portal-support-snap.c | 3 +++ | ||
| 22 | gio/tests/portal-support-utils.c | 27 +++++++++++++++++++++++++ | ||
| 23 | gio/tests/portal-support-utils.h | 2 ++ | ||
| 24 | 4 files changed, 35 insertions(+) | ||
| 25 | |||
| 26 | diff --git a/gio/tests/portal-support-snap-classic.c b/gio/tests/portal-support-snap-classic.c | ||
| 27 | index 8c0ed90c2..5b67865e7 100644 | ||
| 28 | --- a/gio/tests/portal-support-snap-classic.c | ||
| 29 | +++ b/gio/tests/portal-support-snap-classic.c | ||
| 30 | @@ -66,6 +66,9 @@ tests_teardown (SetupData *setup_data, | ||
| 31 | else | ||
| 32 | g_unsetenv ("SNAP"); | ||
| 33 | |||
| 34 | + cleanup_snapfiles (setup_data->snap_path); | ||
| 35 | + cleanup_snapfiles (setup_data->bin_path); | ||
| 36 | + | ||
| 37 | g_clear_pointer (&setup_data->old_path, g_free); | ||
| 38 | g_clear_pointer (&setup_data->old_snap, g_free); | ||
| 39 | } | ||
| 40 | diff --git a/gio/tests/portal-support-snap.c b/gio/tests/portal-support-snap.c | ||
| 41 | index 7dd14d82f..cd904678f 100644 | ||
| 42 | --- a/gio/tests/portal-support-snap.c | ||
| 43 | +++ b/gio/tests/portal-support-snap.c | ||
| 44 | @@ -67,6 +67,9 @@ tests_teardown (SetupData *setup_data, | ||
| 45 | else | ||
| 46 | g_unsetenv ("SNAP"); | ||
| 47 | |||
| 48 | + cleanup_snapfiles (setup_data->snap_path); | ||
| 49 | + cleanup_snapfiles (setup_data->bin_path); | ||
| 50 | + | ||
| 51 | g_clear_pointer (&setup_data->old_path, g_free); | ||
| 52 | g_clear_pointer (&setup_data->old_snap, g_free); | ||
| 53 | } | ||
| 54 | diff --git a/gio/tests/portal-support-utils.c b/gio/tests/portal-support-utils.c | ||
| 55 | index ae7073a3a..b7ee22630 100644 | ||
| 56 | --- a/gio/tests/portal-support-utils.c | ||
| 57 | +++ b/gio/tests/portal-support-utils.c | ||
| 58 | @@ -26,6 +26,33 @@ | ||
| 59 | #include <glib.h> | ||
| 60 | #include <glib/gstdio.h> | ||
| 61 | |||
| 62 | + | ||
| 63 | +void | ||
| 64 | +cleanup_snapfiles (const gchar *path) | ||
| 65 | +{ | ||
| 66 | + GDir *dir = NULL; | ||
| 67 | + const gchar *entry; | ||
| 68 | + | ||
| 69 | + dir = g_dir_open (path, 0, NULL); | ||
| 70 | + if (dir == NULL) | ||
| 71 | + { | ||
| 72 | + /* Assume it’s a file. Ignore failure. */ | ||
| 73 | + (void) g_remove (path); | ||
| 74 | + return; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + while ((entry = g_dir_read_name (dir)) != NULL) | ||
| 78 | + { | ||
| 79 | + gchar *sub_path = g_build_filename (path, entry, NULL); | ||
| 80 | + cleanup_snapfiles (sub_path); | ||
| 81 | + g_free (sub_path); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + g_dir_close (dir); | ||
| 85 | + | ||
| 86 | + g_rmdir (path); | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | void | ||
| 90 | create_fake_snapctl (const char *path, | ||
| 91 | const char *supported_op) | ||
| 92 | diff --git a/gio/tests/portal-support-utils.h b/gio/tests/portal-support-utils.h | ||
| 93 | index 40c035b43..defbdcd4e 100644 | ||
| 94 | --- a/gio/tests/portal-support-utils.h | ||
| 95 | +++ b/gio/tests/portal-support-utils.h | ||
| 96 | @@ -23,6 +23,8 @@ | ||
| 97 | |||
| 98 | #include <glib.h> | ||
| 99 | |||
| 100 | +void cleanup_snapfiles (const gchar *path); | ||
| 101 | + | ||
| 102 | void create_fake_snap_yaml (const char *snap_path, | ||
| 103 | gboolean is_classic); | ||
| 104 | |||
| 105 | -- | ||
| 106 | 2.39.2 | ||
| 107 | |||
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 deleted file mode 100644 index 1ae98be707..0000000000 --- a/meta/recipes-core/glib-2.0/glib-2.0/fix-ptest.patch +++ /dev/null | |||
| @@ -1,166 +0,0 @@ | |||
| 1 | gio/tests/portal: Fix test ordering race | ||
| 2 | |||
| 3 | When the gnome test runner executes the tests, the test appear to execute in disk | ||
| 4 | order. This means it sometimes works and we sometimes see breakage in portal-support-snap | ||
| 5 | and portal-support-snap-classic. | ||
| 6 | |||
| 7 | The issue is that some tests create config files but some don't. If they run | ||
| 8 | in the wrong order, tests see config files they shouldn't and break. | ||
| 9 | |||
| 10 | Fix this by deleting the files after each test run, properly cleaning up after | ||
| 11 | themselves. There are probably better ways to handle this but this patch should | ||
| 12 | at least let us check this is the issue. | ||
| 13 | |||
| 14 | I've tried to report upstream but their issue tracker account creation is struggling | ||
| 15 | and I can't get my account to work. | ||
| 16 | |||
| 17 | Upstream-Status: Pending | ||
| 18 | |||
| 19 | Index: 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 | ||
| 43 | Index: 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 | ||
| 116 | Index: 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) | ||
| 154 | Index: 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 7a0ed6b603..6a9a5f359c 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,7 +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 | file://0001-gio-tests-portal-support-Fix-snap-test-ordering-race.patch \ |
| 19 | " | 19 | " |
| 20 | SRC_URI:append:class-native = " file://relocate-modules.patch" | 20 | SRC_URI:append:class-native = " file://relocate-modules.patch" |
| 21 | 21 | ||
