mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
tests: Change the time function used in the bookmark tests
The current comparison has been seen to fail on vs2017-x86 (https://gitlab.gnome.org/pwithnall/glib/-/jobs/2643197): ``` not ok /bookmarks/deprecated - GLib:ERROR:../glib/tests/bookmarkfile.c:921:test_deprecated: assertion failed (t >= now): (1678122080 >= 1678122081) ``` I guess this is caused by a mismatch between the system clock as used by `time (NULL)` and `g_get_real_time ()` (which is ultimately what `g_bookmark_file_set_added()` uses) on Windows. Attempt to fix that by using `g_get_real_time()` in the test harness too, so the clock being used is consistent. If that doesn’t work, my next guess is that some of the code in `test_deprecated()` is being reordered by the compiler. But that shouldn’t happen, because the `time()` call has side-effects, and `g_bookmark_file_set_added()` has side-effects, so they shouldn’t be reordered with respect to each other. And certainly not so that the latter one (in code order) ends up being called 1s after the other. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
e75ba524fd
commit
e35f4a04cc
@ -911,7 +911,7 @@ test_deprecated (void)
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
now = time (NULL);
|
||||
now = g_get_real_time () / G_USEC_PER_SEC;
|
||||
file = g_bookmark_file_new ();
|
||||
|
||||
/* added */
|
||||
|
Loading…
Reference in New Issue
Block a user