Simon McVittie [Fri, 15 Jul 2022 11:13:43 +0000 (12:13 +0100)]
meson: Set up functionally necessary compiler arguments separately
We have to set up feature-flag options like _GNU_SOURCE before we
do compiler checks like cc.has_header_symbol, otherwise we'll miss
symbols that are guarded by a feature-flag test, like environ in Linux
unistd.h.
However, we don't want to pass flags for extra compiler warnings
when doing these checks, because that can cause false negatives:
in particular, Meson's check programs nearly always trigger -Wunused.
So the warnings need to be in a separate list.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 15 Jul 2022 00:37:47 +0000 (01:37 +0100)]
test: Work around TAP test regression in Meson 0.63.0
With Meson 0.63.0, detailed output of TAP tests is not logged, and the
test deadlocks if the stderr pipe fills up. I'm hoping this will be fixed
before 0.63.1, but in the meantime we can work around it by falling back
to the 'exitcode' protocol: this means we lose machine-readable detailed
test results, but at least our tests pass.
See https://github.com/mesonbuild/meson/issues/10577 and
https://github.com/mesonbuild/meson/issues/10563 for details of the
Meson regression.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 16:13:52 +0000 (17:13 +0100)]
CI: Explicitly build before running tests
If we don't do this, Meson will build everything that is a direct
dependency of the test executables, but it won't build indirect
dependencies like GLib's gspawn-win32-helper.exe.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 10:14:06 +0000 (11:14 +0100)]
CI: Enable Ducktype-based documentation on Debian/Ubuntu
We don't currently know the equivalent of python3-mallard-ducktype on
other OSs like openSUSE, but we know this should work on Debian (it does
when we do Autotools builds).
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 11:41:41 +0000 (12:41 +0100)]
CI: Verify that Autotools `make dist` includes everything needed for Meson
This is similar to what we have done for CMake since dbus/dbus!87
(commit 1063bba "CI: Do the CMake native debug build from an Autotools
`make dist`"). Our official source releases are Autotools `make dist`
tarballs, so our CI should assert that such tarballs contain everything
necessary to do a CMake or Meson build, so that downstream distributions
using our tarballs as source can choose their preferred build system.
When the Meson build system is ready to be recommended as more preferred
than Autotools, we can do as GLib did: stop releasing `make dist`
tarballs, and start releasing `meson dist` tarballs instead (which will
change nothing for Meson or CMake users, but Autotools users will have
to run autoreconf or autogen.sh before building).
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 13 Jul 2022 16:55:27 +0000 (17:55 +0100)]
meson: Don't use cc.has_function to check for va_copy
va_copy is not an ordinary function (an extern symbol), so we can't
treat it as one. Instead, use the same compilation/linking check as
in the Autotools build system.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[smcv: Rename to avoid using "Win32" to refer to both 32- and 64-bit] Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Wed, 13 Jul 2022 18:02:44 +0000 (19:02 +0100)]
test: Set PATH or WINEPATH to find dbus-daemon.exe in build-time tests
When building for Windows, either natively or cross-compiling and
running tests with Wine, test-autolaunch-win expects to be able to
find the just-built dbus-daemon.exe in the PATH.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Tue, 28 Jun 2022 12:23:31 +0000 (13:23 +0100)]
meson: Allow disabling Valgrind instrumentation
This would currently result in a hard dependency on Valgrind headers
when linking dependent projects to libdbus (see
https://github.com/mesonbuild/meson/pull/10544 for an attempt to
avoid this), so distributions likely don't want to enable this feature
in their main builds of valgrind (although they could enable it in
special debug builds like the one in Debian's dbus-tests package if
desired).
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 24 Jun 2022 14:10:40 +0000 (15:10 +0100)]
test: Extend some timeouts
Group slow tests (those taking about a minute or more in one of the
configurations built on Gitlab-CI) into a new 'slow' suite, which can
be used with `meson test --no-suite=slow` to run just the faster tests.
They default to a 5 minute timeout (usually enough) unless overridden
(bus/dispatch.c can be *very* slow when OOM testing is enabled, and
gets a 30 minute timeout).
For the remaining tests, default to Meson's usual 30 second timeout,
but bump up the timeout a bit in some cases to have a safety margin
(my method was to take the slowest run on our Gitlab-CI, and make sure
we're allowing about 3 times that long).
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 14:37:17 +0000 (15:37 +0100)]
build: Change how we create empty directories from Meson
Use install_emptydir() in Meson versions that support it, or a script
with similar invocation in versions that do not. This will make it
straightforward to migrate to install_emptydir() when we drop support
for Meson versions older than 0.60.0.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 14:12:54 +0000 (15:12 +0100)]
build: Change how we create symlinks from Meson
Use install_symlink() in Meson versions that support it, or a script
with similar invocation in versions that do not. This will make it
straightforward to migrate to install_symlink() when we drop support
for Meson versions older than 0.61.0.
Based on an implementation in the game-data-packager package, which used
a shell script.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 14:14:18 +0000 (15:14 +0100)]
build: Don't replace prefix in .pc file if relocation is disabled
Replacing the prefix with a path relative to ${pcfiledir} can be harmful
if the number of path components between the prefix and the ${libdir}
is not what we expect, in particular on Debian-derived systems where the
${libdir} is normally lib/x86_64-linux-gnu or similar.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Mon, 27 Jun 2022 11:54:52 +0000 (12:54 +0100)]
doc: Make Meson yelp-build invocation compatible with older versions
Older versions of yelp-build like the one in Debian 11 do not allow
permuting arguments, so all options (in this case -o) must appear
before all positional parameters.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 24 Jun 2022 14:20:12 +0000 (15:20 +0100)]
test: Make environment variables consistent with Autotools
DBUS_SESSION_BUS_LISTEN_ADDRESS is the same as in non-test files:
the test data distinguishes between DBUS_SESSION_BUS_LISTEN_ADDRESS,
the real session bus configuration, and TEST_LISTEN, the test-only
configuration.
DBUS_TEST_HOMEDIR and HOME should be in the build directory, not
the source directory.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 24 Jun 2022 12:17:26 +0000 (13:17 +0100)]
build: Implement a runtime_dir option
If the prefix is /usr, then this defaults to /run, similar to the
special cases for /var and /etc built into Meson. This is correct for
typical modern Linux distributions implementing FHS 3.0. This is
intentionally not consistent with Autotools and CMake: if distributions
are transitioning to a different way to build dbus, then that's a good
time to re-evaluate their build options.
Otherwise, this defaults to LOCALSTATEDIR/run, consistent with Autotools
and CMake.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 24 Jun 2022 12:01:54 +0000 (13:01 +0100)]
test: Correct generation of .test metadata
If a helper executable is not, in itself, a test-case, then we should
not generate metadata that tells ginsttest-runner to run it as a
test-case.
Meanwhile, we were previously generating foo_with_config.test metadata
for tests that don't get installed; stop doing that.
We also need to distinguish between the abstract name of the test
(which usually does not start with test-), the name of the .test file
(which does start with test- for compiled executables), and the name
of the executable (which may include .exe as well). To make validation
against the Autotools build system as straightforward as possible,
generate exactly the same names as in Autotools. We can consider removing
the test- prefix later, if we remove the Autotools build system.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 24 Jun 2022 11:59:40 +0000 (12:59 +0100)]
test: Don't run integration tests at build-time
Some items listed in the tests array are helper executables rather
than actually being tests, and should not be run as a test at any time.
Those have {"test": false}. Expand this special case to the scripts
array for completeness (although currently, no scripts need this).
Meanwhile, some items listed in the scripts array are "as-installed"
integration tests which cannot safely be run at build-time, because
they make assertions about the state of the installed system.
Introduce {"build_time_test": false} for these, and expand this special
case to the tests array for completeness (although currently, no
compiled executables need this).
Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie [Fri, 24 Jun 2022 11:47:25 +0000 (12:47 +0100)]
build: Resolve localstatedir, sysconfdir relative to prefix
If the prefix is something like /opt/dbus, then --localstatedir=var
should result in using /opt/dbus/var, and so on. However, if configured
with --localstatedir=/var, then the prefix is ignored.
Meson special-cases these to default to /var and /etc (respectively),
as absolute paths, if the prefix is /usr; so distribution builds will
typically still end up using /var and /etc.
Signed-off-by: Simon McVittie <smcv@collabora.com>