Commit graph

125 commits

Author SHA1 Message Date
Robert Mader
75d75ac6cd tests: Add color-representation tests for DRM and GL
Test the various combinations of:
1. Renderer backends - currently GL only.
2. Renderer modes - plane-offloading/vkms, shaders in Mesa, internal
   shaders.
3. Buffer-types - SHM and DMABuf.
4. Coefficient/range combinations.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:39 +01:00
Robert Mader
f709b8a798 tests: client-helper: Add color-representation protocol support
In order to test coefficients and ranges.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:39 +01:00
Derek Foreman
a3f0e97a71 compositor: Support the commit-timing protocol
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.

We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Marius Vlad
1e55fd2449 gitlab-ci: Bump CI to Trixie and LTS to bookworm
This includes a few changes, but given that we still want to bisect
things when they break I'm pulling some of the changes into a bigger change.

Here's a list of most noticeable that I had to address in order to make
this switch:

- added a PACKAGES_SPECIFIC env variable to able to pass different
  packages to each version. Some packages basically changed their names
  and need to pass a different name
- added USE_DEBIAN_BACKPORTS and use it when adding -backport apt
  sources for each Debian version
- llvm-19 now requires some additional packages for trixie
- add imghdr for sphinx for trixie
- had to keep use_tls=0 and modified the notes to point now to Trixie
  instead of Bookworm

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-12-16 11:46:39 +00:00
Derek Foreman
cb97abd4f7 compositor: Add the fifo-v1 protocol
Add support for the fifo protocol, which allows an application to submit
a content update that can only be applied after the previous content
update has been active for a display refresh.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:13 -06:00
Derek Foreman
23204eca75 tests: Bind the fifo protocol
Add the fifo protocol to the helper framework.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:13 -06:00
Robert Mader
e5cbd8536a tests: Add drm offloading test
Recent improvements to llvmpipe made it possible to test dmabuf import
and offloading on vkms. Use our new client-buffer helper and the
presentation protocol to implement tests for simple offloading
scenarios.

Right now this is limited to the vkms default config, only providing us
with one primary and one cursor plane. In the future we can extend the
test to include more advanced scenarios.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 12:53:44 +02:00
Robert Mader
a1c0d33700 tests: client-helper: Add various globals by default
To make them more easily available for tests.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-10 11:47:08 +02:00
Pekka Paalanen
a06ef0f8aa tests: add color-output-parsing
This tests the [output] section key 'color-profile', which is meant for
setting up parametric color profiles. It tests the special names, and
fetching values from EDID. There are also tests for all accepted keys in
a [color-profile] section.

These tests are all positive. Error messages are tested in another
patch.

The test client helper changes are needed for loading the EDID file.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Leandro Ribeiro
3026c44897 test: add color-effects test
Follow-up of "color: introduce output color effects". This adds a few
sanity tests for color effects.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-18 12:32:15 -03:00
Robert Mader
af834d1419 tests/client-buffer: Use shared client-buffer utils
Use the shared helper in order to avoid duplication. This will also
ensure that any format added to the test will also be usable by other
tests and clients.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-05 11:47:18 +02:00
Derek Foreman
e91eccd709 lua-shell: Add lua-shell
lua-shell is a new meta-shell for Weston. It does nothing in and of
itself, but is defined to be user-scriptable and configurable. A
supplied Lua script will be interpreted and executed by Weston, allowing
full control over window management in response to events.

This includes a shell.lua example script which behaves as a tiling WM.

Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Co-authored-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-06-04 15:47:06 +03:00
Leandro Ribeiro
3187999208 tests: add color-math-test
This tests a few mathematical operations that are common to color work.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-05-13 17:36:52 +03:00
Marius Vlad
3b7d29f871 tests: Add xdg-client-helper library
And make use of it in kiosk-shell-test. There's no functional change,
this is for other shells to re-use the code here.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-05-06 15:27:58 +03:00
Robert Mader
33db73f134 tests: client-helper: Add dmabuf protocol support
Allow querying supported formats and modifiers.
We use version 3 as it is easier to implement and also works
if no main device is present - such as when using llvmpipe.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-04-30 11:13:06 +02:00
Robert Mader
9f0ac15ce6 tests: Rename shm-buffer to client-buffer
In preparation to also test dmabufs.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-04-30 11:12:38 +02:00
Pekka Paalanen
2bbd2e4364 tests: add linalg-4 tests
Ensure our basic computations are correct.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:53 +03:00
Pekka Paalanen
a97ccc4a1a tests: add idalloc
Get the realloc() code path executed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-03-03 15:05:30 +02:00
Loïc Molinari
1b7655636d tests: Don't abort on failure
Setup a custom assertion handler that increases an assertion counter
instead of aborting on failure. This allows to run all the sub tests
defined for a test and to correctly report which sub test failed.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 23:50:45 +01:00
Loïc Molinari
fbe2f27915 tests: Remove zunitc testing framework
This framework isn't used anymore.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 23:50:45 +01:00
Loïc Molinari
d92560a0e4 tests: Port config-parser test to Weston testing framework
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 22:50:51 +01:00
Loïc Molinari
1f169c044c tests: Port timespec test to Weston testing framework
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-26 22:50:51 +01:00
Loïc Molinari
d254cb14fc tests: Rename yuv-buffer test to shm-buffer
Next commit will add tests for RGB formats.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-02-17 15:54:52 +00:00
Leandro Ribeiro
c01a1f7c64 tests: add color-management tests for the parametric interface
This adds tests to create image descriptions through color parameters
using the CM&HDR protocol extension.

The code for that was added in commit "color: allow clients to create
image description from parameters".

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-01-20 09:30:46 +00:00
James Le Cuirot
9a536962a5
tests: Make some tests dependent on the shell-desktop option
The internal-screenshot and text tests are dependent on the feature and
fail with it disabled.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2024-10-14 22:47:13 +01:00
James Le Cuirot
486d96a162
tests: Make the kiosk test dependent on the shell-kiosk option
The test is dependent on the feature and fails with it disabled.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2024-10-14 22:46:34 +01:00
Jan Engelhardt
f86ff8c07d build: insert missing wayland-server-protocol dependency
A new build error sprung up in weston-14 compared to 13.0.0.
Fix it.

FAILED: tests/liblib_lcms_util.a.p/lcms_util.c.o
cc -Itests/liblib_lcms_util.a.p -Itests -I../tests -I. -I.. -Iinclude
-I../include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Wextra -Wpedantic -std=gnu99 -Wmissing-prototypes
-Wno-unused-parameter -Wno-shift-negative-value
-Wno-missing-field-initializers -Wno-pedantic -Wundef
-fvisibility=hidden -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
-fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
-fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -MD
-MQ tests/liblib_lcms_util.a.p/lcms_util.c.o -MF
tests/liblib_lcms_util.a.p/lcms_util.c.o.d -o
tests/liblib_lcms_util.a.p/lcms_util.c.o -c ../tests/lcms_util.c
In file included from ../tests/lcms_util.c:35:
../include/libweston/matrix.h:33:10: fatal error:
wayland-server-protocol.h: No such file or directory

   33 | #include <wayland-server-protocol.h>

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2024-10-08 19:36:09 +02:00
Daniel Stone
329f5f49e1 tests: Add kiosk-shell testing
Test xdg-shell apps with kiosk-shell, including transition and focus
handling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2024-05-01 14:18:43 +03:00
Pekka Paalanen
3179e0f0e0 CI: work around LeakSanitizer crashes with use_tls=0
Without this fix, we have randomly been getting CI failures due to
LeakSanitizer itself crashing after all the tests in a program have
succeeded. This has been happening randomly for a long time, but
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486
made it very reliably repeatable in the job x86_64-debian-full-build
(and no other job) in the test-subsurface-shot program.

--- Fixture 2 (GL) ok: passed 4, skipped 0, failed 0, total 4
Tracer caught signal 11: addr=0x1b8 pc=0x7f6b3ba640f0 sp=0x7f6b2cc77d10
==489==LeakSanitizer has encountered a fatal error.

I was also able to get a core file after twiddling, but there it ended
up with lsan aborting itself rather than a segfault.

We got some clues that use_tls=0 might work around this, from
https://github.com/google/sanitizers/issues/1342
https://github.com/google/sanitizers/issues/1409
and some other projects that have cargo-culted the same workaround.

Using that cause more false leaks to appear, so they need to be
suppressed. I suppose we are not interested in catching leaks in glib
using code, so I opted to suppress g_malloc0 altogether. Pinpointing it
better might have required much more slower stack tracing.

wl_shm_buffer_begin_access() uses TLS, so no wonder it gets flagged.

ld-*.so is simply uninteresting to us, and it got flagged too.

Since this might have been fixed already in LeakSanitizer upstream, who
knows, leave some notes to revisit this when we upgrade that in CI.

This fix seems to make the branch of
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1486
in my quick testing.

Suggested-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-04-09 17:29:00 +03:00
Leandro Ribeiro
0ade70fb6c tests: add tests for the color management protocol implementation
Exercise the color-management protocol mechanics.

This lacks a few test cases that are a bit harder to have, e.g. testing
that a bad ICC file gets rejected. In the future we plan to add them.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-14 12:13:04 -03:00
Pekka Paalanen
f18455c3a8 tests: remove color-manager test
This is very trivial test, which does not skip correctly when built with
color-management-lcms=false. It fails instead.

Since alpha-blending test already covers everything that color-manager
test did, remove color-manager test.

My editor eliminated a stray whitespace, too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-01-26 14:19:12 +02:00
Pekka Paalanen
d2b70d2fa9 shared: add weston-assert
Add yet another flavor of assertion macros.

Unlike libc assert.h assert(), these cannot be easily disabled by the
build. They also print both the implied expression and the compared
values.

Unlike ZUC macros, there is much less framework code and it can handle
also floating-point types.

The function custom_assert_fail_ can be redefined, meaning that
different compilation units can do different things on failure.

Also the 'compositor' parameter was added to the new macros because we
plan to use these asserts in our log infrastructure, and we want to
print the "failure" messages in the right log scopes. Having the
compositor already in the macros will avoid double work.

Another future possibility is to write specific asserts for the test
suite. So we would be able to write a test suite failure function that
just print what "failed" without aborting.

There is also limited support for custom types.

These are actually pretty similar to libinput's litest macros.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-09-28 06:52:24 +00:00
Daniel Stone
ce113969e3 tests: Add paint-node test
This is a very simple test, mostly intended as a demonstration of the
new client<->compositor breakpoint infrastructure. It ensures that for a
simple test surface, a paint node has been created in the output's
paint-node list, reflecting the properties of the attached buffer.

This is an example of properties which are not observable by regular
clients.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Daniel Stone
efde2fa0b1 tests: Add client<->compositor breakpoint support
Add support for clients to request the server insert breakpoints at
various points in its processing. These breakpoints are handled
internally by semaphores (visible to tests through helpers): when the
server reaches the specified point, it will pause execution until the
client allows it to restart.

A weston_compositor pointer returned at each breakpoint allows the
client to reach across the thread boundary and access the server's
internal data structures. This can be used to, for example, inspect
paint nodes, internal damage, or any other work which is not necessarily
client-visible.

The majority of tests will not need to use this infrastructure; it is
only intended for tightly-coupled tests which can very specifically
dictate and anticipate the server's execution flow.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-30 11:42:00 +00:00
Leandro Ribeiro
9486740d21 tests: add color pipeline optimizer tests
This will help us to debug our color pipeline optimizer without the
need to craft special ICC profiles for that. In this initial patch,
we are able to add matrices and curve sets to the pipeline and assure
that the optimizer is doing the right thing.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-06-29 11:08:40 +00:00
Daniel Stone
249f68adb0 build: Run tests with leak-sanitizer suppressions
cf. the never-ending saga of how we can't neuter the fontconfig leaks,
also pass our CI leak-sanitizer suppression file when running tests
locally. This makes it easier to run with ASan enabled in your local
environment.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-22 14:31:57 +01:00
Sergio Gómez
65740ca9a7 tests: Add basic testing for pointer constraints protocol
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
2023-06-14 10:27:14 +03:00
Marius Vlad
4bc7bd73d7 libweston/weston-log: Add a iterator helper for debug scope
This adds three new helpers: one to iterate over all debug scopes
created/added and other two are for simpler getters for the scope name
and the description.

Included with this change is also a simple test to retrieve them.

This is an alternative to using the debug scope list advertised when
using the weston-debug private extension. libweston users can use this
directly to know which scopes they can subscribe to, and there's no need
to have a client implementation for the weston-debug protocol.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-05-30 11:05:14 +00:00
Marius Vlad
9e1c2056cf tests/meson.build: Add missing dependency for xcb-client-helper
This fixes the following build issue:

[    6s] cc -Itests/libtest-xwayland-client.a.p -Itests -I../tests -I. -I.. -Iinclude -I../include -Iprotocol -I/usr/include/pixman-1 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Wextra -Wpedantic -std=gnu99 -Wmissing-prototypes -Wno-unused-parameter -Wno-shift-negative-value -Wno-missing-field-initializers -Wno-pedantic -Wundef -fvisibility=hidden -O2
-Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -MD -MQ
tests/libtest-xwayland-client.a.p/xcb-client-helper.c.o -MF tests/libtest-xwayland-client.a.p/xcb-client-helper.c.o.d -o tests/libtest-xwayland-client.a.p/xcb-client-helper.c.o -c
../tests/xcb-client-helper.c
[    6s] ../tests/xcb-client-helper.c:39:10: fatal error: wayland-client.h: No such file or directory

Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-05-18 19:23:58 +03:00
Leandro Ribeiro
89d05db0b7 tests: add writeback sreenshooter test
This adds a test to ensure that the DRM-backend writeback screenshooter
is working properly.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2023-03-22 09:37:37 -03:00
Marius Vlad
640a3c7165 xcb-client-helper: Add a XCB client helper for tests
This patch introduces a small library wrapper around XCB to be used in
Xwayland tests.

It's being designed such that we do not advance without accounting for
all X11 events when changing the window state.  It adds a fence that
waits for all events to be processed, and only after all the events have
been accounted for, to proceed further, resuming execution of the
tests.

This works by keeping a tentative_state list for the client and a
window state that gets applied when the event we waited for has been
received.

This is useful in test clients, which could verify at the end after
receiving all events that the correct state has been applied. Acts as a
way to verify that the we never get or have a different state than the
one we expect.

With it, this converts test-xwayland to using libxcb (together with
xcb-cursor-dev) rather than using Xlib, and with it it removes any Xlib
dependency we might have in the tests.

This only adds support for map/unmap/create/destroy/property notify.
A follow-up would be to expand this library to track window movement
and resizing.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-03-03 08:30:46 +00:00
Marius Vlad
19d32da742 shell-utils: Integrate shell-utils into libweston
These shell utils functions are potentially useful to other shells as
well, so make them widely available.

Renamed all functions to weston_shell_utils namespace.

No functional change, copied ad litteram.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-01-09 22:13:07 +00:00
Pekka Paalanen
2cf85ab637 tests: add output-decorations
This adds a new test checking that output decorations (used in the
wayland-backend, here tested with headless-backend) are drawn correctly.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-12-02 13:36:25 +00:00
Pekka Paalanen
849b87e285 tests: rewrite screenshooting to use new protocol
Migrate the tst suite to using the new screenshooting protocol. This
ensures the new protocol and implementation work, and removes a user of
the old protocol so that the old protocol can be removed in the future.

Now that the compositor chooses the pixel format,
capture_screenshot_of_output() needs to convert to the expected format
in the tests when necessary.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-29 11:10:33 +02:00
Pekka Paalanen
e3046b129c tests: add output-capture-protocol test
For exercising various code paths in the server side protocol
implementation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-29 11:10:30 +02:00
Pekka Paalanen
c93b18ea54 tests: use pixel-formats.h in create_shm_buffer()
Instead of starting yet another hand-crafted pixel format mapping table,
use the one we have.

Following patches want to be able to create XRGB8888 buffers, and later
even other formats.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-29 11:00:52 +02:00
Derek Foreman
92a9860e1d libweston: Add function to find the output transform of a matrix
When we build up a matrix from a series of operations, it's very useful
to know if the combined operations still result in something that matches
a wl_output_transform.

This adds a function to test if a matrix leads to a standard output
transform, and returns the transform if it does.

Tests are provided that check if complex series of operations return
expected results - the weston_matrix_needs_filtering function is tested
at the same time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2022-11-25 08:29:05 -06:00
Daniel Stone
28caa08be6 Implement wp_single_pixel_buffer_v1 protocol
This protocol allows clients to create single-pixel RGBA buffers. Now
that we have proper support for these buffers internally within Weston,
we can expose them to clients.

This bumps the build container version, as we now depend on
wayland-protocols v1.26.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-26 10:26:55 +03:00
Daniel Stone
2a9cae17d8 custom-env: Add tests for environment handling
Test the basic stuff: initialising from a known environment, setting a
new variable, overwriting a previous variable, and getting the resulting
array to pass to execve.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-19 14:12:37 +00:00
Daniel Stone
759712ba05 zuc: Delete support for forking tests
ZUC's default mode is to fork for every test case. Unfortunately on
AArch64, fork in an ASan-traced program usually takes around 3.6 entire
seconds. This was leading to the config-parser test timing out.

As none of our remaining ZUC tests even need to fork, just remove all
support for it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-07-05 10:15:49 +01:00