[glib: 1/2] gio/tests/g-file-info: don't assume million-in-one events don't happen
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gio/tests/g-file-info: don't assume million-in-one events don't happen
- Date: Thu, 20 Oct 2022 15:12:06 +0000 (UTC)
commit ed3998b390f5ac7c711c2d3088192036168ad2b2
Author: Ross Burton <ross burton arm com>
Date: Thu Oct 20 14:41:56 2022 +0100
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.
Signed-off-by: Ross Burton <ross burton arm com>
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 d9ad045836..c9b12b031f 100644
--- a/gio/tests/g-file-info.c
+++ b/gio/tests/g-file-info.c
@@ -307,7 +307,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 again with nanosecond precision. */
@@ -442,7 +442,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 again with nanosecond precision. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]