Skip to content

self-test: Optionally install for as-installed testing

Simon McVittie requested to merge wip/smcv/insttest into master
  • self-test: Use g_test_message instead of printing to stdout

    GLib now defaults to structured TAP output on stdout, and printing unstructured messages to stdout corrupts this. In a TAP test, arbitrary diagnostics can either use g_test_message() or a GLib logging function like g_debug(), or be printed to stderr with g_printerr().

  • self-test: Optionally install for as-installed testing

    This follows the interface proposed in https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests and can be used for "as-installed" testing, which is a useful way to check for regressions (for example if a GLib upgrade might cause a regression in the already-compiled version of gcab), especially in frameworks like Debian's autopkgtest and Fedora's Standard Test Interface.

    To locate the test data in a way that is compatible with as-installed tests, use g_test_build_filename() instead of hard-coding the source directory into the test executable. This incidentally also avoids relying on PATH_MAX, which is not completely portable.


The first commit is suitable for cherry-picking if you'd prefer just that one.

Merge request reports