]> code.ossystems Code Review - openembedded-core.git/commitdiff
glib-2.0: fix g-file-into modification time test
authorRoss Burton <ross@burtonini.com>
Wed, 7 Jul 2021 09:04:14 +0000 (10:04 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 7 Jul 2021 10:39:56 +0000 (11:39 +0100)
The GFileInfo modification time test assumed that the difference between
a modification timestamp in seconds and in microseconds must be greater
than 0.

Mathmatically, there's a one-in-a-million chance that it will be 0.  It
turns out that one-in-a-million chances happen approximately once every
fortnight on the autobuilder.

[ YOCTO 14373 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/glib-2.0/glib-2.0/time-test.patch [new file with mode: 0644]
meta/recipes-core/glib-2.0/glib-2.0_2.68.3.bb

diff --git a/meta/recipes-core/glib-2.0/glib-2.0/time-test.patch b/meta/recipes-core/glib-2.0/glib-2.0/time-test.patch
new file mode 100644 (file)
index 0000000..4d7ef97
--- /dev/null
@@ -0,0 +1,40 @@
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2177]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 289f8be1b397a453cfcf35641455f3ae5fb4faeb Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Tue, 6 Jul 2021 19:26:03 +0100
+Subject: [PATCH] gio/tests/g-file-info: don't assume million-in-one events
+ don't happen
+
+The modification time test creates a file, gets the modification time in
+seconds, then gets the modification time in microseconds and assumes
+that the difference between the two has to be above 0.
+
+As rare as this may be, it can happen:
+
+$ stat g-file-info-test-50A450 -c %y
+2021-07-06 18:24:56.000000767 +0100
+
+Change the test to simply assert that the difference not negative to
+handle this case.
+---
+ gio/tests/g-file-info.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
+index c11c50462..fd0c64b55 100644
+--- a/gio/tests/g-file-info.c
++++ b/gio/tests/g-file-info.c
+@@ -178,7 +178,7 @@ test_g_file_info_modification_time (void)
+   g_assert_nonnull (dt_usecs);
+   ts = g_date_time_difference (dt_usecs, dt);
+-  g_assert_cmpint (ts, >, 0);
++  g_assert_cmpint (ts, >=, 0);
+   g_assert_cmpint (ts, <, G_USEC_PER_SEC);
+   /* Try round-tripping the modification time. */
+-- 
+2.25.1
+
index 2a3a00fadae9fb41eca871cefa03b9f5d15f8935..62c8d49464f53dab92107c118cfb24b434eebded 100644 (file)
@@ -17,6 +17,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
            file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
            file://0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch \
+           file://time-test.patch \
            "
 SRC_URI_append_class-native = " file://relocate-modules.patch"