Commit Graph

12 Commits

Author SHA1 Message Date
Daniel Stone
6c8ae362bb CI: Never unload llvmpipe DSO whilst testing
This commit is truly horrible.

We want to run ASan with leak checking enabled in CI so we can catch
memory leaks before they're introduced. This works well with Pixman, and
with NIR-only drivers like iris or Panfrost.

But when we run under llvmpipe - which we do under CI - we start failing
because:
  - Mesa pulls in llvmpipe via dlopen
  - llvmpipe pulls in LLVM itself via DT_NEEDED
  - initialising LLVM's global type/etc systems performs thread-local
    allocations
  - llvmpipe can't free those allocations since the application might
    also be using LLVM
  - Weston stops using GL and destroys all GL objects, leading to Mesa
    unloading llvmpipe like it should
  - with everything disappearing from the process's vmap, ASan can no
    longer keep track of still-reachable pointers
  - tests fail because LLVM is 'leaking'

Usually, an alternative is to LD_PRELOAD a shim which overrides
dlclose() to be a no-op. This is not usable here, because when
$LD_PRELOAD is not empty and ASan is not first in it, ASan immediately
errors out. Prepending ASan doesn't work, because we run our tests
through Meson (which also invokes Ninja), leading to LSan exploding
over CPython and Ninja, which is not what we're interested in.

It would be possible to inject _both_ ASan and a dlclose-does-nothing
shim DSO into the LD_PRELOAD environment for every test, but that seems
even worse, especially as Meson strongly discourages globbing for random
files in the root.

So, here we are, doing what we can: finding where swrast_dri.so (aka
llvmpipe) lives, stashing that in an environment variable, and
deliberately leaking a dlopen handle which we never close to ensure that
neither llvmpipe nor LLVM leave our process's address space before we
exit.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-05 10:15:49 +01:00
Daniel Stone
c5ed892b1b CI: Disable ASan fast unwinding for suppressions
Unfortunately just adding suppressions isn't enough; the build of Expat
we have in our CI system does not have frame pointers, so ASan's fast
unwinder can't see through it. This means that the suppressions we've
added won't be taken into account.

For now, disable the fast unwinder for the Xwayland test only. Disabling
it globally is not practical as it massively increases the per-test
runtime, so here (to avoid polluting the build system), we use a
per-test wrapper to selectively choose the unwinder.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-05 10:15:48 +01:00
Leandro Ribeiro
08dbd29e33 gitlab-ci: compile Linux image with support to VGEM
Add VGEM to the Linux image that runs in the CI. There are tests that we
plan to add in the future that need this.

This brings a complication, as we already have VKMS in the image. The
order in which DRM devices are loaded is not always the same, so the
node they receive is non-deterministic. Until now we were sure that VKMS
(the virtual device we use to run the DRM-backend tests in the CI) would
be in "/dev/dri/card0", but now we can't be sure. To deal with this
problem we find the node of each device using a one-liner shell script.

This commit also updates the documentation section that describes
specificities of DRM-backend tests in our test suite.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2022-02-09 08:13:50 +00:00
Marius Vlad
07326040b9 .gitlab-ci: Retrieve return value before any other command
This was previously introduced with commit '.gitlab.ci: Enable debug for
libsteat and for the DRM backend' in order to figure out another CI
issue we were seeing.

Unfortunatelly, not keeping the return value after the tests ran it
would silently make the entire CI succeed when it should actually fail.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-12-13 14:48:46 +02:00
Marius Vlad
288214323c .gitlab.ci: Enable debug for libsteat and for the DRM backend
As the drm-smoke test randomly reports having the connector disabled,
and with it libseat reports setMaster errors, this enables DRM backend
debug messages for the kernel, and for libseat in an attempt to
track down the issue, whenever it might happen again.

These are pretty harmless, in terms of data being generated as we only
have a single DRM test using VKMS, and the libseat debug message aren't
that verbose, so we're safe keeping them for the time being.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-11-30 17:36:58 +02:00
Simon Ser
448f05e82d ci: use seatd-launch
Instead of manually waiting for the seatd socket to come up, use
seatd-launch.

Add /usr/local/bin to PATH to avoid having to specify the whole
path to seatd-launch.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-09-14 16:19:45 +02:00
Simon Ser
3e53a8d478 ci: export ASAN_OPTIONS
This allows splitting the `meson test` command on multiple lines.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-09-14 16:19:45 +02:00
Daniel Stone
29c1087b7b CI: Don't rebuild when running tests
Just cosmetic for now, but tell Meson to just run our tests rather than
trying to rebuild them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-08-03 11:13:23 +00:00
Daniel Stone
e649c12316 CI: Use larger timeout multiplier for ASan tests
Running under ASan introduces a good amount of overhead. Using the Meson
test wrapper rather than invoking a Ninja target lets us set a timeout
multiplier, which we smash up pretty high to account for this overhead
and prevent some of the larger tests from hitting timeout.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-05-17 12:27:03 +01:00
Pekka Paalanen
5de3b047b7 CI: use address sanitizer without leak checks
Use address sanitizer to catch use-after-free and other errors when
running the test suite.

Leak detection is disabled, because currently there are too many leaks,
making almost all tests fail otherwise.

The atexit=1 is for verifying that ASan was actually used.

The default 128 MB of RAM in the qemu machine leads to oom-killer
killing most tests, so bump the memory size to 1 GB.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-05-12 14:23:21 +03:00
Kenny Levinsen
2995f77bd0 ci: Test using seatd instead of direct launcher
While the commonly used Weston launchers are weston-launch and launcher-logind,
the direct backend was used in CI out of convenience, and due to logind being a
bit cumbersome to get to work in a CI environment.

The new libseat launcher can be used with seatd as well as logind. seatd is easy
to start in a CI environment, allowing us to test the libseat launcher codepath
instead of the less user relevant direct launcher.

This also prepares us for the future intended removal of non-libseat launchers.

Signed-off-by: Kenny Levinsen <kl@kl.wtf>
2021-04-27 13:38:31 +00:00
Leandro Ribeiro
a12ba0b30a gitlab CI: add support for DRM-backend tests
In order to run DRM-backend tests, a DRM-device is needed. As we
do not necessarily have control of the hardware that is going to
run our tests in GitLab CI, DRM-backend tests were being skipped.
This patch add support to run the tests using VKMS (virtual KMS).
To achieve this, virtualization is needed, as we need to run a
custom kernel during the CI job. We've decided to go with virtme,
as it is simpler to setup and works good for our use case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-06-25 10:17:31 +00:00