Commit Graph

81 Commits

Author SHA1 Message Date
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
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 9336263d9b Move libweston-desktop into libweston
It's not really useful to have libweston without libweston-desktop. It's
also very little code.

Merging both into the same DSO will allow us to cut out a bunch of
indirection and pain.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-06-28 10:35:52 +00:00
Pekka Paalanen 6393e43357 tests: rename color-shaper-matrix-test.c to color-icc-output-test.c
The new name better matches the contents of the test.

Currently the test creates output ICC profiles with matrix-shaper and
cLUT forms, and tests that basic color conversion from input to output
color space is correct.

The common theme in this test program is to create ICC profiles to be
used as output profiles. In the future this can include more kinds of
testing, e.g. linear blending. OTOH, this test program will always be
limited to SDR because HDR testing probably will not use ICC files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-10 10:49:47 +00:00
Vitaly Prosyak 0c5860fafb tests/color-shaper-matrix: add creation and usage cLUT profiles
Added cLUT profile creation to validate linearization algorithm
for DToB3 tag (direction dev to PCS). The 3DLUT is
built by using raw matrix conversion from dev to XYZ and reverse
(XYZ to device).

The test uses floating point pipeline, known as unbounded mode of LCMS.
The details are described in ICCSpecRevision_02_11_06_Float.pdf

The purpose of these new test cases is to keep the GL-renderer 3D LUT
path tested even after color-lcms and GL-renderer start using
specialized matrix-shaper paths.

These also exercise build_eotf_from_clut_profile() in color-lcms, but do
not actually verify it. These cases only test that the recovered EOTF
and its inverse produce an identity mapping together.

BT.2020 is not used in these tests, because the RGB-XYZ conversion
matrix does not stay inside [0.0, 1.0] in either direction, which would
be a problem for the 3D LUT element in the multiProcessingElement
pipelines. Handling that would have been possible, but testing with
AdobeRGB color space should suffice while keeping the test code from
being even more complicated.

roundtrip_verification() tests that we succeed in creating cms
pipelines correctly in both directions so that the resulting ICC file is
better behaved. The Weston test itself only cares about the BToD
direction.

Credits to:
Vladimir  Lachine <vladimir.lachine@amd.com>
Graeme Gill <graeme@argyllcms.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-03 10:22:25 +00:00
Pekka Paalanen 44c3079567 tests: add lcms-util with MPE curves
This adds a new test helper library that depends on LittleCMS 2.

For starters, the library implements conversion from enum transfer_fn to
ICC multiProcessingElements compatible LittleCMS curve object.

That conversion allows encoding transfer funtions in ICC files and
LittleCMS pipelines with full float32 precision instead of forcing a
conversion to a 1D LUT which for power-type curves is surprisingly
imprecise.

This also adds CI tests to make sure the conversion matches our
hand-coded transfer functions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-03 10:22:25 +00:00
Pekka Paalanen 7fa9b15348 build: consolidate lcms2 dependencies
It's bad form to set the same variable in multiple places, and not all
of them were even equivalent.

Move lcms2 finding to the root level build file only. It is still an
optional dependency like before, and the if-not-found checks are still
in place where actually needed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-03 10:22:25 +00:00
Pekka Paalanen 892421a93e tests: add matrix-test for CI
This a new matrix inversion test written from scratch to be suitable for
running in CI: quick to run and automatically detects success/failure.

This all is a result of what I learnt while working on
https://gitlab.freedesktop.org/pq/fourbyfour

Computing the residual error with infinity norm comes straight from
fourbyfour documentation on how to evaluate matrix inversion error.

Most of the hard-coded test matrices have been generated with fourbyfour
project as well, as it contains the generator code. The matrices are
hard-coded here also to make testing faster, but primarily because the
generator code needs BLAS and LAPACK, and having those as Weston
dependencies would be far too much just for this.

Now, if someone wants to modify weston_matrix stuff, we should at least
detect matrix inversion and multiplication bugs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-31 12:26:09 +00:00
Pekka Paalanen 8bbd1a995b libweston: remove UNIT_TEST
This #define was used only by the matrix-test program, which was removed
in the previous commit.

Remove it as unused and fold away MATRIX_TEST_EXPORT.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-31 12:26:09 +00:00
Pekka Paalanen a1e5d46d91 tests: delete the manual matrix-test
This test program was useful a decade ago when weston_matrix_invert()
was being developed. It was a manual test program that ran for a certain
number of seconds and required human interpretation of numbers to see if
results were acceptable or not. Hence it was foundamentally unsuitable
for CI.

The way it generated random matrices for inversion testing was also very
naive, and it used the determinant value to determine invertability
which is completely bogus. This made it also a bad test for correctness.

Much better speed and correctness testing is implemented in

    https://gitlab.freedesktop.org/pq/fourbyfour

with documented testing procedures. It has a copy of the weston_matrix
implementation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-31 12:26:09 +00:00
Pekka Paalanen ccb4c383d7 tests: add color-metadata-errors test
'color_characteristics_config_error' test ensures that all code paths in
parse_color_characteristics() and wet_output_set_color_characteristics()
get exercised.  The return value and logged error messages are checked.

Other cases test the weston_hdr_metadata_type1 validation.

These are for the sake of test coverage, but also an example of how to
test a function from main.c, and how to capture messages from
weston_log().

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-27 10:30:35 +00:00
Pekka Paalanen e13e64c4e0 tests: add color-metadata-parsing
Check that weston.ini settings to eotf-mode and basic color
characteristics are correctly parsed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-05-27 10:30:35 +00:00
Daniel Stone 577a832f41 test/desktop-shell: Use weston_curtain
Use the helper we have for these, rather than open-coding.

This commit is not believed to result in any functional changes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Daniel Stone 6cb2526b67 Move shell-utils to its own directory
shell-utils contains a number of helpers which are currently in use by
both desktop-shell and kiosk-shell. In order to extend this use to
fullscreen-shell as well (which can benefit from reusing the
weston_curtain infrastructure to be able to create solid-colour views
which may or may not be opaque, as well as one function within
fullscreen-shell which was copied wholesale to shell-utils), we need to
create a separate Meson dependency object, and avoid the existing
pattern of including the source from shared/ within the source list for
each shell.

This requires creating a new top-level directory for these shared helper
functions which are required by each shell, but are not part of
libweston in and of itself.

shell-utils depends on libweston-desktop; libweston-desktop depends on
libweston; libweston depends on shared.

Thus it is not possible to expose a dependency object from the shared/
directory which declares a dependency on the libweston-desktop
dependency, as Meson processes directories in order and resolves
variable references as they are parsed.

In order to break this deadlock, this commit creates a new top-level
directory called 'shell-utils' containing only this file, which can be
parsed by Meson after libweston-desktop (making the libweston-desktop
Meson dependency variable available to the build file to declare a
dependency on that), but before the shells (making the new Meson
depenendency object available to each shell which wishes to use it).

This commit contains no functional changes to any observable code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-03-31 17:15:55 +00:00
Pekka Paalanen e2ee2b56f9 tests: make vertex-clip use WESTON_EXPORT_FOR_TESTS
This is probably the simplest case to demonstrate how to use
WESTON_EXPORT_FOR_TESTS.

Previously, vertex-clip test re-built vertex-clipping.c for itself. Now
it directly links in gl-renderer.so instead as that is where
vexter-clipping.c gets built into for actual use. This probably will not
work for any installed program, but luckily tests are never installed,
so Meson makes sure the DSO is found.

Unfortunately we cannot remove the definition of dep_vertex_clipping
yet, because clients/cliptest.c needs it.

This makes vertex-clip test depend on GL-renderer, but that is where the
code is really used.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-03-01 13:32:15 +00:00
Daniel Stone 2ac6b6b084 tests: Add dependency on screenshooter client protocol
Given that the test-helper code relies on the screenshooter protocol,
make sure it's available for us to build, and the dependency ensures we
build in order.

Fixes: #588

Signed-off-by: Daniel Stone <daniels@collabora.com>
2022-02-18 12:24:01 +00:00
Vitaly Prosyak fe35ca2d68 tests: color shaper-matrix test
1. Use fixture_setup to set the generated by LCMS output profile based on
   given chromaticities and white points. The following  list of well known
   chromaticities:
    - sRGB
    - adobe RGB
    - bt2020
   and white point is D65. Use INTENT_ABSOLUTE_COLORIMETRIC to avoid BPC.
   Input profile is always sRGB and it is used internally by Weston as
   stock profile.

2. Use these hardcoded matrixes as part of pipeline 1DLUT->3x3->1DLUT.
   The diagnostic code to retrieve the transform matrix is availble into
   test in the comments. The conversion matrixes generated for the
   following cases:
    - sRGB to sRGB (unity)
    - sRGB to adobeRGB
    - sRGB to BT2020
3. Compare GPU shaders(gl texture3D) vs manual pipeline calculation
   Use different max tolerable error per transform.
   There are comments how number of points in 3DLUT is related to tolerance.
   Tolerance depends more on the 1D LUT used for the inv EOTF than
   the tested 3D LUT size: 9x9x9, 17x17x17, 33x33x33, 127x127x127.

4. Enable build matrix-shaper test if color-management-lcms is enabled.

Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-02-12 23:19:02 -05:00
Marius Vlad ee5716798a tests/safe-signal-output-removal: Add test for output removal
This simulates an output removal which should trigger a crash when
the compositor is shutdown abruptly by having a view with a listener installed
on its output_destroy signal.

This patch assumes that weston_compositor_remove_output() has already
been amended to use the more safer version for triggering signal
emission.

As both shells use this construct it should catch any potential signal
corruption.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-12-14 17:55:06 +00:00
Marius Vlad 990173050c test/safe-signal: Add a basic test for weston_signal_emit_mutable
Basic test to verify that weston_signal_emit_mutable() would not
corrupt the signal list.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2021-12-14 17:55:06 +00:00
Daniel Stone 533950cc31 tests: Serialise drm-smoke-test against everything else
drm-smoke-test can't run at the same time as anything else which touches
DRM devices. This includes any test which would use the GL renderer or
GL/GBM on the client side, since they will open DRM devices to probe
them at init time.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2021-11-30 15:56:42 +00:00
Vitaly Prosyak 15d7546b2d tests: refactoring alpha-blending
No functional change. Moved color processing
functions into shared files which can be used
between different tests.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2021-11-13 00:17:03 +00:00
Pekka Paalanen 645df9556d ci: bump test timeouts
This is prompted by the spurious CI failure
https://gitlab.freedesktop.org/wayland/weston/-/jobs/13891809
saying:

31/36 output-damage                          TIMEOUT        122.52s   8 subtests passed
32/36 output-transforms                      TIMEOUT        122.52s   16 subtests passed
33/36 subsurface                             TIMEOUT        122.52s
34/36 xwayland                               TIMEOUT        122.51s
35/36 ivi-shell-app                          TIMEOUT        122.51s
ERROR: Job failed: execution took longer than 5m0s seconds

That is hitting both kinds of timeouts at the same time: the per-test
timeouts, and the CI job total timeout.

That run seems to have had a particularly ill fortune, as a simple retry
finished the same job in 2 minutes, and the longest running test took
only 24 seconds.

Nevertheless, by Daniel Stone's suggestion let's bump both timeouts:

- the per-test timeout to 120 seconds, which with the multiplier in CI
  goes up to 8 minutes

- the job timeout for all build related jobs to 15 minutes

The timeout for tests_standalone is not bumped as we are not adding
significant amounts of new tests there.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-09-22 16:29:05 +03:00
Simon Ser b46d0e3304 tests/roles: switch to xdg-shell
Stop using wl_shell for the roles tests, since it'll get disabled
and removed eventually.

Signed-off-by: Simon Ser <contact@emersion.fr>
2021-07-23 17:26:02 +01:00
Pekka Paalanen e70aa1fde2 tests/alpha-blending: reference blending
Instead of checking just the monotonicity of the blending results, this
changes the alpha-blending test to compute the reference blend result
itself and then comparing to the compositor result. This way we can be
sure that the compositor implements the exact correct formula and not
something that just looks nice, as verifying the reference images are
actually correct is hard.

The reference image is renamed to follow the fact that this is not
primarily a monotonicity test anymore. The reference image is also
redundant, but I think it has documentary value.

The #if 0'd block of code was very useful in figuring out blending
errors in a future test case, so it is included here. I have a feeling
we are going to need it again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-21 14:36:33 +00:00
Pekka Paalanen 21b8ad5a16 tests: ensure color-lcms plugin loads
This is a trivial smoke test to ensure that the color-lcms plugin is
loadable.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-06-14 12:53:41 +00:00
Alexandros Frantzis 6ee80ecc9d tests: Add shot test for pointer cursor behavior
Add a regression test to verify that the cursor image is correctly
updated when setting a cursor surface with an already committed buffer
from a previous pointer entry, without recommitting a cursor buffer for
the current entry.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
2021-06-10 17:20:30 +03:00
Leandro Ribeiro 859e3f220d tests: add unit tests for struct weston_drm_format
In commit "libweston: add struct weston_drm_format" we've added an API
to store and manage DRM formats and modifiers. As it has a couple of set
operations that are not so obvious, this adds unit tests to ensure
correctness. In the future we may expand this API and also improve
performance, so it is important to have this.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2021-04-27 19:56:38 +00:00
Pekka Paalanen ee38ed80d8 tests: add build option to force skips as failures
This will be useful in CI, where we do not want to see any skips. If
something starts to skip, that's a mistake somewhere, and want to catch
it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-03-12 16:14:28 +02:00
Pekka Paalanen e88de3ef37 tests: define ENABLE_JUNIT_XML to 1 or 0
Code is using the form
  #if ENABLE_JUNIT_XML
which is fine until we start using -Wundef. I think the existing code
would fail or at least warn if you disabled test-junit-xml with -Wundef.

Make sure ENABLE_JUNIT_XML is always defined so that -Wundef can be
added to build flags.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-03-12 16:14:28 +02:00
Pekka Paalanen fbd4160474 tests: add output damage test
This test ensures that client submitted damage goes to the screen
correctly, regardless of output scale or transform.

The added quirk is explained in the test that uses it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-25 12:54:17 +02:00
Pekka Paalanen 5580cb13c9 tests: switch to TAP
This makes sub-tests visible in the junit output, making Gitlab test
reports more detailed.

This does not apply to zuc tests, which look like they could produce
junit XML directly. And maybe TAP? Left for another time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2021-02-15 11:17:17 +02:00
Pekka Paalanen ae12b9596d tests: add yuv-buffer test
This adds a test to ensure that the wl_shm formats YUV420, NV12 and YUYV
are decoded and converted to RGB correctly in GL-renderer.

The test deliberately uses a 256 x 256 test image so that effects from
width vs. pitch vs. stride cannot be observed, and row padding is zero.
Also padding between planes is zero. Attempting to use a test image with
less "round" dimensions lead to stride mismatch in GL-renderer, likely
due to GL_UNPACK_ALIGNMENT being left at value 4. It is unclear if YUV
wl_shm buffers' row stride needs to be aligned to 4 bytes or not, so I
did not pursue fixing it. GL-renderer seems to be confusing width, pitch
and stride even further, and not e.g. allow padding with ARGB buffers.
See also: https://gitlab.freedesktop.org/wayland/weston/-/issues/354

Furthermore, the test arranges so that each 2x2 pixel block has the same
color. This avoids having to consider chroma siting when sub-sampling.
This way all the test cases can use the same reference image.

The source image chocolate-cake.png is taken and copyright by Pekka
Paalanen, hereby licensed as
http://creativecommons.org/licenses/by-sa/4.0/ .

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-12-17 09:34:09 +00:00
Pekka Paalanen 26258817fc tests: add alpha-blending test
In anticipation of invasive future work on color management, add an
alpha blending test to make sure we don't break alpha blending.

The idea for doing a monotonicity test came from glennk on #dri-devel in
Freenode IRC.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-12-09 14:06:43 +02:00
Pekka Paalanen a3bfa1b27d tests: re-order drm-smoke in test list
To keep the list in alphabetical order so it's easy to search.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-12-09 14:06:43 +02:00
Leandro Ribeiro 9e90760ab0 tests: start to use Weston's default screenshooter in the test suite
Until now we had two different protocol extensions: one for the
test suite screenshooter and other for the screenshooter client.
As they are identical and this won't change, make the test suite
use the same protocol that the screenshooter client uses.

Besides the cleanup, this change will also allow us to use the
DRM writeback screenshooter in the test suite, as the test suite
implementation is hardcoded to use a renderer based screenshooter.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-10-27 12:19:39 +00:00
Igor Matheus Andrade Torrente d8e09afc9f tests: Convert ivi-shell-app-test.c to use `weston_ini_setup`
Convert ivi-shell-app-test.c to use `weston_ini_setup`. It also removes
the pre-made weston.ini and all the related code in the meson files.

Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
2020-09-30 09:41:34 -03:00
Igor Matheus Andrade Torrente ad41a88535 tests: Add a way to write a Weston.ini inside the test
Currently doesn't exist a standard way to write a weston.ini inside a test.

Here, two new functions `weston_ini_setup` and `cfgln` are introduced to
help the test writer to write a weston.ini file and load it to the test.
And `internal-screenshot-test` is converted to use the new method of write
a weston.ini. This conversion serves as example and initial API test.

The tester needs to call `weston_test_harness_execute_as_client` or
`weston_test_harness_execute_as_plugin` in the same way as before.
The `weston_ini_setup` will fill the setup->config_file with the
correct path to the weston.ini file.

The main design goal is to avoid pre-made or build-made weston.ini(s)
and keep the test as self-contained as possible.

Closes:#410
Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
2020-09-05 07:14:49 +00:00
Leandro Ribeiro b1c529e9d7 tests: add drm-backend smoke test
This adds the first DRM-backend test. It is very simple
and was made in order to make easier to add more complex
DRM-backend tests in the future.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-06-02 13:47:15 +00:00
Leandro Ribeiro e8a8c13e0d tests: add support to run drm-backend tests locally
With this patch we add support to run DRM-backend tests locally
in the test suite. For now this won't work in the CI, as there
are no cards available. But the plan is to achieve this by using
VKMS (virtual KMS) in the future.

To run DRM-backend tests locally, first of all the user has to
set the environment variable WESTON_TEST_SUITE_DRM_DEVICE to
'card0', 'card1' or any other device where he wants to run
the tests. Also, for now it only works if it is run as root,
but in the future this problem will be solved.

The tests will run on a non-default seat. The reason for that
is that we want to avoid opening input devices unnecessarily.
Also, since DRM-backend usage requires gaining DRM master status
on a DRM KMS device, nothing else must be using the device at
the same time. To achieve this we use a lock to run the
DRM-backend tests sequentially.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2020-06-02 13:47:15 +00:00
Pekka Paalanen 4505f81111 tests: add viewport test for repeat mode
This test ensures that
	"pixman-renderer: half-fix bilinear sampling on edges"
keeps on working.

Unlike in the original report
https://gitlab.freedesktop.org/wayland/weston/issues/373, here we use buffer
scale 2 instead of output scale 2 to trigger bilinear filter. The effect is the
same, the actual resulting image in the failing case is just a little
different. This is so that it will be easy to add more viewport screenshooting
tests in this program in the future.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-03-12 13:22:06 +02:00
Pekka Paalanen 9c267e5b55 tests: move viewport creation into helpers
There will be a new test program using viewports and would like to share this
bit of code.

There are two behavioral changes:
- Compositor wp_viewporter interface version is no longer checked.
- client_create_viewport() does not leak the viewporter object.

test_viewporter_double_create needs to call bind_to_singleton_global() itself
so that the viewporter object still exists when the error event arrives.
Otherwise error verification fails.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-03-11 17:11:03 +02:00
Pekka Paalanen 147e67c425 tests: add buffer transform tests
This patch continues the buffer and output transforms testing by iterating
through a representative selection of buffer transforms and scales.

For more details, see the previous patch "tests: add output transform tests".

https://gitlab.freedesktop.org/wayland/weston/issues/52

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-02-28 16:02:10 +02:00
Pekka Paalanen 97359ba5c5 tests: add output transform tests
This goes through all output transforms with two different buffer transforms
and verifies the visual output against reference images.

This commit introduces a new test input image 'basic-test-card.png'. It is a
small image with deliberately odd and indivisible dimensions to provoke bad
assumptions about image sizes. It contains red, green and blue areas which are
actually text that makes it very obvious if you have e.g. color channels
swapped. It has a white thick circle to highlight aspect ratio issues, and an
orange cross to show a mixed color. The white border is for contrast and a 1px
wide detail. The whole design makes it clear if the image happens to be rotated
or flipped in any way.

The image has one pixel wide transparent border so that bilinear sampling
filter near the edges of the image would produce the same colors with both
Pixman- and GL-renderers which handle the out-of-image samples fundamentally
differently: Pixman assumes (0, 0, 0, 0) samples outside of the image, while
GL-renderer clamps sample coordinates to the edge essentially repeating the
edge pixels.

It would have been "easy" to create a full matrix of
every output scale & transform x every buffer scale & transform, but that
would have resulted in 2 renderers * 8 output transforms * 3 output scales *
8 buffer transforms * 3 buffer scales = 1152 test cases that would have all
ran strictly serially because our test harness has no parallelism inside one
test program. That would have been slow to run, and need a lot more reference
images too.

Instead, I chose to iterate separately through all output scales & transforms
(this patch) and all buffer scales & transforms (next patch). This limits the
number of test cases in this patch to 56, and allows the two test programs to
run in parallel.

I did not even pick all possible scale & transform combinations here, but just
what I think is a representative sub-set to hopefully exercise all the code
paths.

https://gitlab.freedesktop.org/wayland/weston/issues/52

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-02-28 15:07:51 +02:00
Pekka Paalanen 7df5349763 tests: remove tests_weston and WESTON_TEST_CLIENT_PATH
This test category is empty, so it and all the supporting code can go.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-30 10:10:35 +00:00
Pekka Paalanen 56b94b5894 tests: migrate xwayland
Move xwayland test to the new harness.

This is the only test that can actually skip. It does it by exit(77) and that
is fine, because there is only one test case in the file so far. To get rid of
the exit() calls we need to return a value from the TEST() function but that is
a big surgery for another time.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2020-01-30 10:10:35 +00:00