diff mbox series

[v1] glib-2.0: skip a timing sensitive monotonic-time ptest

Message ID 20260805131657.35726-1-pratik.farkase@est.tech
State Under Review
Headers show
Series [v1] glib-2.0: skip a timing sensitive monotonic-time ptest | expand

Commit Message

Pratik Farkase Aug. 5, 2026, 1:16 p.m. UTC
The /monotonic-time-ns/similar test compares g_get_monotonic_time() and
g_get_monotonic_time_ns() by spinning until the microsecond clock ticks
and asserting the two clocks haven't diverged. This is inherently racy
under QEMU emulation on loaded hosts, as the process can be preempted
between the clock reads.

[YOCTO #16230] : https://bugzilla.yoctoproject.org/show_bug.cgi?id=16230

Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
---
 .../files/skip-monotonic-time-similar.patch   | 32 +++++++++++++++++++
 meta/recipes-core/glib-2.0/glib.inc           |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta/recipes-core/glib-2.0/files/skip-monotonic-time-similar.patch

Comments

Alexander Kanavin Aug. 5, 2026, 2:26 p.m. UTC | #1
On Wed, 5 Aug 2026 at 15:17, Pratik Farkase via lists.openembedded.org
<pratik.farkase=est.tech@lists.openembedded.org> wrote:
> +Subject: [PATCH] Skip /monotonic-time-ns/similar test
> +
> +The test_similar test compares g_get_monotonic_time() and
> +g_get_monotonic_time_ns() by spinning until the microsecond clock ticks
> +and then asserting the two clocks haven't diverged beyond a factor of
> +50. This is inherently racy under QEMU emulation on loaded hosts: the
> +process can be preempted between the two clock reads, causing the
> +assertion "50 * ns_elapsed > 1000 * us_elapsed" to fail.
> +
> +https://bugzilla.yoctoproject.org/show_bug.cgi?id=16230
> +
> +Upstream-Status: Inappropriate [OE-specific]

Hello Pratik,

the patch is Inappropriate, but it is not oe-specific; the issue can
happen on any loaded host. The actual reason for Inappropriate status
is: it does not address the issue in the test, but simply disables it
altogether, which is not an appropriate fix to suggest to upstream.

Can you please open a ticket upstream, and include the link in the
patch, like below?

Upstream-Status: Inappropriate [upstream ticket: <link>]

Alex
diff mbox series

Patch

diff --git a/meta/recipes-core/glib-2.0/files/skip-monotonic-time-similar.patch b/meta/recipes-core/glib-2.0/files/skip-monotonic-time-similar.patch
new file mode 100644
index 0000000000..75eda15c98
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/files/skip-monotonic-time-similar.patch
@@ -0,0 +1,32 @@ 
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Pratik Farkase <pratik.farkase@est.tech>
+Date: Tue, 5 Aug 2026 08:00:00 +0000
+Subject: [PATCH] Skip /monotonic-time-ns/similar test
+
+The test_similar test compares g_get_monotonic_time() and
+g_get_monotonic_time_ns() by spinning until the microsecond clock ticks
+and then asserting the two clocks haven't diverged beyond a factor of
+50. This is inherently racy under QEMU emulation on loaded hosts: the
+process can be preempted between the two clock reads, causing the
+assertion "50 * ns_elapsed > 1000 * us_elapsed" to fail.
+
+https://bugzilla.yoctoproject.org/show_bug.cgi?id=16230
+
+Upstream-Status: Inappropriate [OE-specific]
+Signed-off-by: Pratik Farkase <pratik.farkase@est.tech>
+---
+ glib/tests/monotonic-time.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/glib/tests/monotonic-time.c b/glib/tests/monotonic-time.c
+index 1234567..abcdef0 100644
+--- a/glib/tests/monotonic-time.c
++++ b/glib/tests/monotonic-time.c
+@@ -153,7 +153,6 @@ main (int argc, char *argv[])
+   g_test_add_func ("/monotonic-time-ns/increasing", test_increasing_ns);
+   g_test_add_func ("/monotonic-time/usleep", test_usleep);
+   g_test_add_func ("/monotonic-time-ns/usleep", test_usleep_ns);
+-  g_test_add_func ("/monotonic-time-ns/similar", test_similar);
+ 
+   return g_test_run ();
+ }
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index f554145bb0..903d56e05f 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -235,6 +235,7 @@  SRC_URI += "\
            file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
            file://0010-Do-not-hardcode-python-path-into-various-tools.patch \
            file://skip-timeout.patch \
+           file://skip-monotonic-time-similar.patch \
            file://CVE-2026-58016-1.patch \
            file://CVE-2026-58016-2.patch \
            file://0001-gio-tests-services-Fix-installed-service-file-using-.patch \