Only use g_test_log() because it will prepend `#` to log messages when
using TAP protocol. Meson >=1.0 rightfully prints a warning when using
TAP protocol and stdout contains non-comment unknown TAP command.
Sadly meson 60 doesn't support parsing TAP 14 subtests properly, so it would
fail.
So temporary go back to the previous logic in a simple way so that this
commit can be reverted quickly when we can use a newer meson version.
Instead of just commenting all the output of sub-processes we can just use
the TAP 14 syntax for subtests, by using 4-spaces to indent the subtests
output.
This may not work perfectly when there are sub-process that may write
output mixed with the parent, but it should be enough to expose the
hierarchy.
If a gtest process is run as a child of another process, we should not print
the TAP output in plain mode or we'll break the parent results.
We can instead just comment their output so that it gets ignored by TAP
parsers.
Extra lines must be prepended with `#` which g_test_message() does for
us. Note that lines after "Bail out" are ignored, so we print
stdout/stderr before.
Do not write it in multiple lines, to ensure it's going to be written
all together, and nothing else could be written in the middle.
Also optimize a bit the code.
We used to send the test log to stderr in pieces, but this could be
problematic when running multiple tests in parallel, so let's just prepare
the string in pieces and write it all at once.
In some cases if verbose output was enabled we were using wrong output
format in TAP mode, so let's fix these cases and run the 'testing' test
case in --verbose mode to ensure we won't regress.
When running multiple tests in parallel using meson, the output could be
mixed and if we write the TAP reports in multiple steps the output could
be mangled together with other results.
An example is: https://gitlab.gnome.org/3v1n0/glib/-/jobs/2507620
Where we have:
ok 5 /cancellable/poll-fd# GLib-GIO-DEBUG: Collecting capable appnames: 0ms
# Allocating hashtables:...... 0ms
# Reading capable apps: 63ms
# Reading URL associations:... 0ms
# Reading extension assocs: 78ms
# Reading exe-only apps:...... 47ms
# Reading classes: 312ms
# Reading UWP apps: 47ms
# Postprocessing:..............16ms
# TOTAL: 563ms
# SKIP Platform not supported
Leading to a clear TAP parsing error
This is not required, but meson may warn about in future versions, so it's
safer to define it.
However, we must be sure that we only expose it once and in the root binary
if a test file launches another subprocess test file.
To avoid this, we set an environment variable at test init, so that it can
be inherited by children.
It's not the best solution, but for sure the best-effort one without having
to change gtest arguments and called binaries.
Non mentioning a version was considered as assuming we were using TAP
version 12, while no version earlier than 13 can be specified
explicitly so let's use it.
See: https://testanything.org/tap-specification.html
And: https://testanything.org/tap-version-13-specification.html
As per meson default, the project name is a suite per se that is always
added to a test, so running `meson test --suite=glib` is the same as not
passing the `--suite` argument at all, and so making all the tests to run.
To be able to only run the *glib* tests without using the `--no-suite` args,
add a `core` suite that only targets the glib folder tests.
In all these cases we don't really care about running the test file,
while building and basic execution it is relevant.
Also they don't support TAP at all.
Meson supports tap protocol results parsing, allowing us to track better
the tests that are running (and the ones that are actually skipped) without
manually parsing the test output.
However this also implies that using the verbose mode for a test doesn't
show its output by default (unless there are failures).
g_print(), g_printerr() and all the g_log() functions used to always
duplicating a string when printing even if there's nothing to format.
This can be avoided in many cases though, so if a string has no formatting
directive, we can just write it as it is without duplicating and free'ing
it.
From my tests the potential `strchr` overhead is minimal.
To try and debug why the following assert sometimes fails on
`msys2-clang64`, such as in this job:
https://gitlab.gnome.org/GNOME/glib/-/jobs/2515166.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #1371
We may not be able to fix GTasks broken design,
but at least we should document it and not let
users stumble into this bear trap without warning.
Helps: #1346
Add static inline versions of these functions
that boil down to just an memcpy. ag_string_append_len
is used quite a bit in GMarkup and GTK's css parser.
Due to an oversight (I guess), per-desktop default values (which come
from override files such as this one:
https://github.com/endlessm/gnome-shell/blob/master/data/00_org.gnome.shell.gschema.override)
were not checked when getting a GSettings value via a `GSettingsAction`.
Per-desktop default values are correctly returned via all other
GSettings query paths (see calls to
`g_settings_schema_key_get_translated_default()`).
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>