Moving to the new harness.
It would be possible to convert every case here into a separate PLUGIN_TEST,
but I did not see the value in that at this time.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The ivi-layout-test comprises of two halves: the client and the plugin. This
migrates the test to the new test harness.
In the old harness, the plugin was built as the test in meson.build and it fork
& exec'd the client part. In the new harness client tests start from the client
program which sets up the compositor in-process, so now the client is built as
the test in meson.build and the plugin is just an additional file.
Therefore there is not need for the plugin for fork & exec anything anymore, so
all that code is removed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
These are the only remaining standalone non-ZUC tests. They do not need any
changes to be built with the new harness - in fact they have already been
running through the new harness.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Instead of relying on Meson setting up environment so that Weston and tests
find all their files, build those values into the tests. This way one can
execute a test program successfully wihtout Meson, simply by running it.
The old environment variables are still honoured if set. This might change in
the future.
Baking the source or build directory paths into the tests should not regress
reproducible builds, because the binaries where test-config.h values are used
will not be installed.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This replaces the old test harness with a new one.
The old harness relied on fork()'ing each test which makes tests independent,
but makes debugging them harder. The new harness runs client code in a thread
instead of a new process. A side-effect of not fork()'ing anymore is that any
failure will stop running a test series short. Fortunately we do not have any
tests that are expected to crash or fail.
The old harness executed 'weston' from Meson, with lots of setup as both
command line options and environment variables. The new harness executes
wet_main() instead: the test program itself calls the compositor main function
to execute the compositor in-process. Command line arguments are configured in
the test program itself, not in meson.build. Environment variables aside, you
are able to run a test by simply executing the test program, even if it is a
plugin test.
The new harness adds a new type of iteration: fixtures. For now, fixtures are
used to set up the compositor for tests that need a compositor. If necessary, a
fixture setup may include a data array of arbitrary type for executing the test
series for each element in the array. This will be most useful for running
screenshooting tests with both Pixman- and GL-renderers.
The new harness outputs TAP formatted results into stdout. Meson is not
switched to consume TAP yet though, because it would require a Meson version
requirement bump and would not have any benefits at this time. OTOH outputting
TAP is trivial and sets up a clear precedent of random test chatter belonging
to stderr.
This commit migrates only few tests to actually make use of the new features:
roles is a basic client test, subsurface-shot is a client test that
demonstrates the fixture array, and plugin-registry is a plugin test. The rest
of the tests will be migrated later.
Once all tests are migrated, we can remove the test-specific setup from
meson.build, leaving only the actual build instructions in there.
The not migrated tests and stand-alone tests suffer only a minor change: they
no longer fork() for each TEST(), otherwise they keep running as before.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
weston-test-runner.h includes wayland-util.h, therefore it needs
wayland-client. A partial dependency with just compile_args might have been
enough as it does not seem to use functions from wayland-util.c, but safer this
way and no harm.
Fixes: https://lists.freedesktop.org/archives/wayland-devel/2020-January/041149.html
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
test012 and test013 were exact duplicates of each other: asserting that
they could successfully look up a single boolean value.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Wayland innovated a lot of cool things, but non-binary boolean values is
the great advances of our time.
Make config_parser_get_bool() work on boolean values, and switch all its
users.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Instead of getting weston_output from the frame_signal argument 'void *data',
add weston_output in the private data struct of the users that are listening
to frame_signal. With this change we are able to pass previous_damage as the
data argument.
Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
Nothing is using FAIL_TEST or FAIL_TEST_P and that is good. Remove them to not
encourage using them.
If we need a test that should fail, it always needs to fail in a very specific
way which needs to be checked. For this we have e.g. expect_protocol_error().
We never want a fail-test to pass because it failed in a way we did not expect.
Therefore these macros are useless.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Use a different section name to make sure that if this plugin is loaded into
the same process as where weston-test-runner.h is used, the two different
sections cannot get mixed up. This is just a precaution, but it removes a bit
of reader confusion as well.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This avoids confusing it with the opaque struct weston_test from
protocol/weston-test.xml.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Successful tests should just return, not call exit() which breaks the new test
harness when it uses TAP.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When we move on to TAP, stdout will be reserved for TAP and stderr is for free
chatter. Set up an example that tests should use testlog() instead of fprintf
or printf to chat in the right place.
Most statements were already printing to stderr, so this just makes then a
little shorter. There are also some statements that printed to stdout and are
now corrected.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using the test name for the reference images will stop working when the new
test harness starts using fixtures. Fixtures allow running the same tests in
varying environments, so the test results file names will include fixture
index. However the reference images will remain the same for all fixtures.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This reverts 50b7b70835.
We didn't make Meson create a logs directory, so writing the images fails
because the directory does not exist. If you run a test without Meson, there is
even less expectation that it would write somewhere else than CWD by default.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This introduces a new convention of checking through the compositor destroy
listener if the plugin is already initialized. If the plugin is already
initialized, then the plugin entry function succeeds as a no-op. This makes it
safe to load the same plugin multiple times in a running compositor.
Currently module loading functions return failure if a plugin is already
loaded, but that will change in the future. Therefore we need this other method
of ensuring we do not double-initialize a plugin which would lead to list
corruptions the very least.
All plugins are converted to use the new helper, except:
- those that do not have a destroy listener already, and
- hmi-controller which does the same open-coded as the common code pattern
did not fit there.
Plugins should always have a compositor destroy listener registered since they
very least allocate a struct to hold their data. Hence omissions are
highlighted in code.
Backends do not need this because weston_compositor_load_backend() already
protects against double-init. GL-renderer does not export a standard module
init function so cannot be initialized the usual way and therefore is not
vulnerable to double-init.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This was forgetting to remove the compositor destroy listener if init failed,
which would lead to use-after-free on compositor tear-down. Found by
inspection.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
While get_presentation() will only ever be called once (making the caching of
the return value moot), it is good to stop using the static variable as it
would cause surprising problems if anyone adds more tests here and runs it
under the new test harness.
It was leaked before and continues to be so.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Using static data will mess things up when the test harness no longer fork()'s
each sub-test. Hence it needs to be converted to "normal" data.
Unfortunately here the cached value was actually used, so keeping that
behaviour is a handful. Yes, it was all leaked also before.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Just one test call this only once, so the cached value will never be useful.
Stop using static data, it sets a bad example. If more tests were added, things
would start failing when forking is removed from the test harness.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
I cannot see any reason why this should be static data. But if it is static
data, it will prevent re-entering wet_main() to run tests with this plugin, so
replace it with "normal" data.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This caching is actually never hit. I tested by making the early return abort()
instead and all works just fine.
Remove the caching. The static variable will cause problems when we stop
fork()'ing for each test case.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
surface-screenshot-test.c uses file_create_dated() provided by libshared, so it
needs to link libshared.
This was not a problem when unresolved symbols during build were allowed and
the symbols was provided by the weston executable which accidentally exported
all libshared symbols. This would become a problem when we disallow unresolved
symbols project-wide, so fix it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
All these plugins use symbols that were exported by the weston executable and
are now exported by libexec-weston.so. Linking these to libexec-weston.so fixes
unresolved symbols.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We have two kinds of libweston users: internal and external. Weston, the
frontend, counts as an external user, and should not have access to libweston
private headers. The shell plugins are external users as well, because we
intend people to be able to write them. Renderers, backends, and some plugins
are internal users who will need access to private headers.
Create two different Meson dependency objects, one for each kind.
This makes it less likely to accidentally use a private header.
Screen-share is a Weston plugin and therefore counts as an external user, but
it needs the backend API to deliver input. Until we are comfortable exposing
public API for that purpose, let it use internal headers.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This (so-far) Linux-only API lets users create file descriptors purely
in memory, without any backing file on the filesystem and the race
condition which could ensue when unlink()ing it.
It also allows seals to be placed on the file, ensuring to every other
process that we won’t be allowed to shrink the contents, potentially
causing a SIGBUS when they try reading it.
This patch is best viewed with the -w option of git log -p.
It is an almost exact copy of Wayland commit
6908c8c85a2e33e5654f64a55cd4f847bf385cae, see
https://gitlab.freedesktop.org/wayland/wayland/merge_requests/4
Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Define common_inc which includes both public_inc and the project root directory.
The project root directory will allow access to config.h and all the shared/
headers.
Replacing all custom '.', '..', '../..', '../shared' etc. include paths with
common_inc reduces clutter in the target definitions and enforces the common
#include directive style, as e.g. including shared/ headers without the
subdirectory name no longer works.
Unfortunately this does not prevent one from using private libweston headers
with the usual include pattern for public headers.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When all shared/ headers are included in the same way, we can drop unnecessary
include seach paths from the compiler.
This include style was chosen because it is prevalent in the code base. Doing
anything different would have been a bigger patch.
This also means that we need to keep the project root directory in the include
search path, which means that one could accidentally include private headers
with
#include "libweston/dbus.h"
or even
#include <libweston/dbus.h>
IMO such problem is smaller than the churn caused by any of the alternatives,
and we should be able to catch those in review. We might even be able to catch
those with grep in CI if necessary.
The "bad" include style was found with:
$ for h in shared/*.h; do git grep -F $(basename $h); done | grep -vF '"shared/'
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
matrix.c needs to be built differently for a test program vs. everything else,
so it cannot be in a helper lib. Instead, make a dependency object for it for
easy use which always gets all the paths correct automatically.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The member disable_planes of weston_output signifies the recording
status of the output, and is incremented and decremented from various
places. This patch provides helper functions to increment and decrement
the counter. These functions can then be used to do processing, before
and after the recording has started or stopped.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Although we already supported minor version 2 of the explicit sync
protocol, we couldn't advertise it previously, since it was not in any
released version of wayland-protocols. With the release of
wayland-protocols 1.18, which includes minor version 2 of this protocol,
and the recent update in weston to require 1.18, we can now safely
advertise minor version 2.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Was missed in the Meson migration.
This is built only if DRM-backend is built, because it exercises a sub-feature
of the DRM-backend.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The printf() format specifier "%m" is a glibc extension to print
the string returned by strerror(errno). While supported by other
libraries (e.g. uClibc and musl), it is not widely portable.
In Weston code the format string is often passed to a logging
function that calls other syscalls before the conversion of "%m"
takes place. If one of such syscall modifies the value in errno,
the conversion of "%m" will incorrectly report the error string
corresponding to the new value of errno.
Remove all the occurrences of the specifier "%m" in Weston code
by using directly the string returned by strerror(errno).
While there, fix some minor indentation issue.
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Making this into a dependency object not only carries the .c files with it, but
it also brings the include directories as well, which means the users can
simply use the object without guessing the paths.
This should help with moving GL-renderer into a new subdirectory.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This too is a public installed header.
The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is a public installed header used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
It is a public installed header used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
matrix.h is a public installed header and even used by libweston.h.
See "Rename compositor.h to libweston/libweston.h" for rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The main idea is to make libweston users use the form
#include <libweston/libweston.h>
instead of the plain
#include <compositor.h>
which is prone to name conflicts. This is reflected both in the installed
files, and the internal header search paths so that Weston would use the exact
same form as an external project using libweston would.
The public headers are moved under a new top-level directory include/ to make
them clearly stand out as special (public API).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
There is no automake anymore, I suppose it is ninja that handles it now.
There are still a couple references to automake left to point out where the
conventions originated, e.g. the exit code 77.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Weston 6.0.0 was released with both autotools and Meson build systems. That
should be enough for downstream to migrate to Meson build on their on pace.
Maintaining two build systems is a hassle, keep the one that is easier to work
with and let the other one go.
doc/dozygen/tool*.doxygen.in are not deleted, because they have not been
integrated with Meson yet.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>