mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
glib-2.0: fix rare GFileInfo test case failure
If a access or creation timestamp has 0 microseconds, then the test fails as it doesn't expect this to be a valid value. Expand a previous fix for modification times to cover these timestamps too. [ YOCTO #14373 ] (From OE-Core rev: a4e29fe2bd3f834f8253716790fbbf032aad9fcc) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 15715e6ad81c97cd50e288f3745615eb19be90d1) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
a8ed5babd5
commit
a6081883a3
@@ -0,0 +1,51 @@
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2990]
|
||||
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||
|
||||
From 14838522a706ebdcc3cdab661d4c368099fe3a4e 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 access and creation time tests create a file, gets the time in
|
||||
seconds, then gets the 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.
|
||||
|
||||
This is the same fix as 289f8b, but that was just modification time.
|
||||
---
|
||||
gio/tests/g-file-info.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
|
||||
index 59411c3a8..a213e4b92 100644
|
||||
--- a/gio/tests/g-file-info.c
|
||||
+++ b/gio/tests/g-file-info.c
|
||||
@@ -239,7 +239,7 @@ test_g_file_info_access_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 access time. */
|
||||
@@ -316,7 +316,7 @@ test_g_file_info_creation_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 creation time. */
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -16,6 +16,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
|
||||
file://0001-Do-not-write-bindir-into-pkg-config-files.patch \
|
||||
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-g-file-info-don-t-assume-million-in-one-ev.patch \
|
||||
"
|
||||
SRC_URI:append:class-native = " file://relocate-modules.patch"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user