blob: 4d7ef97bb561fbb96a06afb8d43feb94e3e62c37 [file] [log] [blame]
Andrew Geissler5f350902021-07-23 13:09:54 -04001Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2177]
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From 289f8be1b397a453cfcf35641455f3ae5fb4faeb Mon Sep 17 00:00:00 2001
5From: Ross Burton <ross.burton@arm.com>
6Date: Tue, 6 Jul 2021 19:26:03 +0100
7Subject: [PATCH] gio/tests/g-file-info: don't assume million-in-one events
8 don't happen
9
10The modification time test creates a file, gets the modification time in
11seconds, then gets the modification time in microseconds and assumes
12that the difference between the two has to be above 0.
13
14As rare as this may be, it can happen:
15
16$ stat g-file-info-test-50A450 -c %y
172021-07-06 18:24:56.000000767 +0100
18
19Change the test to simply assert that the difference not negative to
20handle this case.
21---
22 gio/tests/g-file-info.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
26index c11c50462..fd0c64b55 100644
27--- a/gio/tests/g-file-info.c
28+++ b/gio/tests/g-file-info.c
29@@ -178,7 +178,7 @@ test_g_file_info_modification_time (void)
30 g_assert_nonnull (dt_usecs);
31
32 ts = g_date_time_difference (dt_usecs, dt);
33- g_assert_cmpint (ts, >, 0);
34+ g_assert_cmpint (ts, >=, 0);
35 g_assert_cmpint (ts, <, G_USEC_PER_SEC);
36
37 /* Try round-tripping the modification time. */
38--
392.25.1
40