From d73609b6816af90b831bbeeef94f560e766370e6 Mon Sep 17 00:00:00 2001 From: han_hui_hui Date: Wed, 14 Dec 2022 08:36:02 +0000 Subject: [PATCH] fix failed tests --- ...-the-642026-test-take-100x-less-time.patch | 77 +++++++++++++++++++ glib2.spec | 7 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 backport-tests-Make-the-642026-test-take-100x-less-time.patch diff --git a/backport-tests-Make-the-642026-test-take-100x-less-time.patch b/backport-tests-Make-the-642026-test-take-100x-less-time.patch new file mode 100644 index 0000000..572d790 --- /dev/null +++ b/backport-tests-Make-the-642026-test-take-100x-less-time.patch @@ -0,0 +1,77 @@ +From 80d3018c1d3e3abf3b2440140ceff8cefa5b8902 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Fri, 4 Mar 2022 19:21:40 +0000 +Subject: [PATCH] =?UTF-8?q?tests:=20Make=20the=20642026=20test=20take=2010?= + =?UTF-8?q?0=C3=97=20less=20time?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It’s a tradeoff of time against reproducibility of the failure conditions +this test is testing for. If this test is run 100× on CI (which it will +be every few weeks), that should be often enough to catch a regression +here. + +A regression in this code is unlikely, though. + +This change is motivated by the fact that periodically this test times +out, and even when it doesn’t, it takes on average 240s of CI runner +time during each CI run. That’s a lot of resources. + +See: https://gitlab.gnome.org/GNOME/glib/-/jobs/1862013 + +Conflict:NA +Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/80d3018c1d3e3abf3b2440140ceff8cefa5b8902 + +Signed-off-by: Philip Withnall +--- + glib/tests/642026.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/glib/tests/642026.c b/glib/tests/642026.c +index aface4ea02..6fed6cd08c 100644 +--- a/glib/tests/642026.c ++++ b/glib/tests/642026.c +@@ -16,10 +16,6 @@ + + #include + +-/* On smcv's laptop, 1e4 iterations didn't always exhibit the bug, but 1e5 +- * iterations exhibited it 10/10 times in practice. YMMV. */ +-#define ITERATIONS 100000 +- + static GStaticPrivate sp; + static GMutex *mutex; + static GCond *cond; +@@ -51,6 +47,19 @@ static gpointer thread_func (gpointer nil) + static void + testcase (void) + { ++ /* On smcv's laptop, 1e4 iterations didn't always exhibit the bug, but 1e5 ++ * iterations exhibited it 10/10 times in practice. YMMV. ++ * ++ * If running with `-m slow` we want to try hard to reproduce the bug 10/10 ++ * times. However, as of 2022 this takes around 240s on a CI machine, which ++ * is a long time to tie up those resources to verify that a bug fixed 10 ++ * years ago is still fixed. ++ * ++ * So if running without `-m slow`, try 100× less hard to reproduce the bug, ++ * and rely on the fact that this is run under CI often enough to have a good ++ * chance of reproducing the bug in 1% of CI runs. */ ++ const guint n_iterations = g_test_slow () ? 100000 : 1000; ++ + g_test_bug ("642026"); + + mutex = g_mutex_new (); +@@ -58,7 +67,7 @@ testcase (void) + + g_mutex_lock (mutex); + +- for (i = 0; i < ITERATIONS; i++) ++ for (i = 0; i < n_iterations; i++) + { + GThread *t1; + +-- +GitLab + diff --git a/glib2.spec b/glib2.spec index 970fc79..6e276a7 100644 --- a/glib2.spec +++ b/glib2.spec @@ -1,6 +1,6 @@ Name: glib2 Version: 2.68.1 -Release: 13 +Release: 14 Summary: The core library that forms the basis for projects such as GTK+ and GNOME License: LGPLv2+ URL: http://www.gtk.org @@ -61,6 +61,7 @@ Patch6051: backport-gio-tests-gdbus-peer-Unref-cached-property-GVariant-val Patch6052: backport-gdesktopappinfo-Unref-the-GDBus-call-results.patch Patch6053: backport-Handling-collision-between-standard-i-o-file-descriptors-and-newly-created-ones.patch Patch6054: backport-glocalfileoutputstream-Do-not-double-close-an-fd-on-unlink-error.patch +Patch6055: backport-tests-Make-the-642026-test-take-100x-less-time.patch BuildRequires: chrpath gcc gcc-c++ gettext perl-interpreter BUildRequires: glibc-devel libattr-devel libselinux-devel meson @@ -226,6 +227,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %endif %changelog +* Wed Dec 14 2022 hanhuihui - 2.68.1-14 +- Type:bugfix +- DESC:fix failed tests + * Sat Oct 15 2022 hanhuihui - 2.68.1-13 - Type:bugfix - DESC:backport some patches from community -- Gitee