]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: don't set G_DEBUG=fatal-warnings on macOS
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 28 Apr 2022 10:37:59 +0000 (11:37 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 28 Apr 2022 12:45:44 +0000 (13:45 +0100)
On macOS when BROKEN_POLL is set in GLib, our tests will periodically
trigger a warning:

  (process:50880): GLib-WARNING **: 02:54:15.272: poll(2) failed due to: Bad file descriptor.

Our code is inherantly racy, calling g_source_destroy which
removes the FD from the event thread poll asynchronously but
we close the FD immediately after g_source_destroy returns.

With poll() this results in POLLNVAL which we're ignoring, but
with select() it generates the BADF error on macOS.

We need to ignore the warnings on macOS to avoid abort()ing
our test programs.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/303
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
build-aux/syntax-check.mk
tests/meson.build

index a6e3ada3003c6fa3eea5c9865952c53e54416229..66ebc3e06683eb2494547b01fbc9cfadaa21d8c9 100644 (file)
@@ -1712,7 +1712,7 @@ exclude_file_name_regexp--sc_prohibit_backslash_alignment = \
   ^build-aux/syntax-check\.mk$$
 
 exclude_file_name_regexp--sc_prohibit_select = \
-  ^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c$$
+  ^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c|tests/meson\.build$$
 
 exclude_file_name_regexp--sc_prohibit_config_h_in_headers = \
   ^config\.h$$
index fd78d8a2fd6a3fb33df570e0889e043dd6a0b4ef..08d2ae67cb1ea1b215562457c0782a096ea12992 100644 (file)
@@ -39,9 +39,24 @@ tests_env = [
   'abs_top_srcdir=@0@'.format(meson.source_root()),
   'LC_ALL=C',
   'LIBVIRT_AUTOSTART=0',
-  'G_DEBUG=fatal-warnings',
 ]
 
+
+# On macOS when BROKEN_POLL is set for GLib, our tests will
+# periodically trigger a warning:
+#
+#  (process:50880): GLib-WARNING **: 02:54:15.272: poll(2) failed due to: Bad file descriptor.
+#
+# Our code is inherantly racy, calling g_source_destroy which
+# removes the FD from the event thread poll asynchronously
+# but we close the FD immediately after g_source_destroy returns.
+#
+# With poll() this results in POLLNVAL, but with select() it
+# generates the BADF error on macOS
+if host_machine.system() != 'darwin'
+  tests_env += ['G_DEBUG=fatal-warnings']
+endif
+
 if use_expensive_tests
   tests_env += 'VIR_TEST_EXPENSIVE=1'
 else