Skip to content

Don't corrupt TAP output with multi-line debug messages

Simon McVittie requested to merge wip/smcv/test-messages into master
  • tests: Add _srt_tests_init

    This wraps g_test_init and automatically calls _srt_tests_global_debug_log_to_stderr(); it can also do any other setup we need in the future.

    A few test helpers (which are not, themselves, tests) continue to use _srt_tests_global_debug_log_to_stderr() directly.

  • tests: Work around GLib < 2.70 not handling multi-line messages correctly

    GLib older than 2.70 corrupts TAP output when a g_test_message() contains newlines. For example, "hello\nworld" ends up as:

      # hello
      world

    rather than the correct TAP diagnostic

      # hello
      # world

    We are particularly susceptible to this when we output debug-log messages, which sometimes contain commands' multi-line output. We already send the output of the default log handler to stderr, but the GLib test framework also turns log messages into TAP diagnostics, for which we need to be prepared to split the lines ourselves.


Yet another prerequisite for !462 (merged). The change that fixed this in 2.70 was https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2026.

Edited by Simon McVittie

Merge request reports

Loading