Improve test diagnostics
Improve test diagnostics

- Replace `if (g_test_verbose ()) g_print("...\n")` with
  `g_test_message ("...")`, which prints the message if the test is
  either verbose or in TAP mode. Otherwise, post-mortem debugging
  of failing tests on an autobuilder is very difficult.
  In some cases, since commit f1dbe9bc "tests: Print spawned program
  argv in testlibrary" we already had the g_test_message(), but
  still had the redundant g_print() too.

- Factor out running a subprocess into a helper function to reduce
  duplication.

- Capture invoked subprocesses' stderr and stdout where possible, so we
  can log it as diagnostics. Again, this should make it easier to carry
  out post-mortem debugging based on autobuilder logs.

Signed-off-by: Simon McVittie <0e1aea601907c1a85c2dc96e5ea37e23c58d2e9b@collabora.com>

handsome-feng/flatpak,flatpak/flatpak,handsome-feng/flatpak,matthiasclasen/flatpak,matthiasclasen/flatpak,flatpak/flatpak,matthiasclasen/flatpak,handsome-feng/flatpak,flatpak/flatpak,handsome-feng/flatpak,flatpak/flatpak,handsome-feng/flatpak,flatpak/flatpak,matthiasclasen/flatpak,matthiasclasen/flatpak