From 1051394c367a23242465bc0a1e4c5653dbd1e0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Barnab=C3=A1=20Silva?= Date: Sun, 9 Nov 2025 23:23:05 -0300 Subject: [PATCH] =?UTF-8?q?testfilemonitor:=20treat=20`CHANGES=5FDONE=5FHI?= =?UTF-8?q?NT`=20as=20optional=20when=20events=20don=E2=80=99t=20match?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This expands on the previous fixes to the kqueue backend testing, to always treat `CHANGES_DONE_HINT` as optional when there is a mismatch checking the expected events. Also re-enable the tests for macOS. Helps: #1392 --- gio/tests/meson.build | 2 -- gio/tests/testfilemonitor.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gio/tests/meson.build b/gio/tests/meson.build index e719008e4..54bbaf66b 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -139,8 +139,6 @@ gio_tests = { 'glistmodel' : {}, 'testfilemonitor' : { 'suite' : ['slow'], - # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 - 'can_fail' : host_system in ['darwin'], }, 'thumbnail-verification' : {}, 'tls-certificate' : {'extra_sources' : ['gtesttlsbackend.c']}, diff --git a/gio/tests/testfilemonitor.c b/gio/tests/testfilemonitor.c index 018e49f50..573141ac3 100644 --- a/gio/tests/testfilemonitor.c +++ b/gio/tests/testfilemonitor.c @@ -237,6 +237,17 @@ check_expected_events (RecordedEvent *expected, li++, l = l->next; continue; } + /* The ordering of 'CHANGES_DONE_HINT' can not be guaranteed + * so treat it as optional. */ + else if (e1->event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT && + e2->event_type != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT) + { + g_test_message ("Skipping expected 'CHANGES_DONE_HINT' " + "at index %" G_GSIZE_FORMAT, + i); + i++; + continue; + } /* If an event is marked as optional in the current environment and * the event doesn't match, it means the expected event has lost. */ else if (env & e1->optional)