tests: add mechanism to change Weston's behavior when running certain tests

There are some specific cases in which we need Weston to
behave differently when running in the test suite. This
adds a new API to allow the tests to select these behaviors.

For instance, in the DRM backend we plan to add a writeback
connector screenshooter. In case it fails for some
reason, it should fallback to the renderer screenshooter
that all other backends use. But if we add a test to
ensure the correctness of the writeback screenshooter,
we don't want it to fallback to the renderer one, we
want it to fail. With this new API we can choose to
disable the fallback behavior specifically for this test.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro
2020-10-19 16:06:22 -03:00
committed by Pekka Paalanen
parent 526765ddfd
commit 32a5acde5b
10 changed files with 93 additions and 75 deletions
+30
View File
@@ -185,6 +185,27 @@ enum weston_hdcp_protection {
WESTON_HDCP_ENABLE_TYPE_1
};
/** Weston test suite quirks
*
* There are some things that need a specific behavior when we run Weston in the
* test suite. Tests can use this struct to select for certain behaviors.
*
* \sa compositor_setup
* \ingroup testharness
*/
struct weston_testsuite_quirks {
};
/** Weston test suite data that is given to compositor
*
* \sa compositor_setup
* \ingroup testharness
*/
struct weston_testsuite_data {
struct weston_testsuite_quirks test_quirks;
struct wet_testsuite_data *test_private_data;
};
/** Represents a head, usually a display connector
*
* \rst
@@ -1105,6 +1126,9 @@ struct weston_compositor {
/* Whether to let the compositor run without any input device. */
bool require_input;
/* Test suite data */
struct weston_testsuite_data test_data;
/* Signal for a backend to inform a frontend about possible changes
* in head status.
*/
@@ -1776,6 +1800,12 @@ struct weston_compositor *
weston_compositor_create(struct wl_display *display,
struct weston_log_context *log_ctx, void *user_data);
void
weston_compositor_test_data_init(struct weston_compositor *ec,
const struct weston_testsuite_data *test_data);
void *
weston_compositor_get_test_data(struct weston_compositor *ec);
bool
weston_compositor_add_destroy_listener_once(struct weston_compositor *compositor,
struct wl_listener *listener,