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
+5 -2
View File
@@ -175,6 +175,7 @@ compositor_setup_defaults_(struct compositor_setup *setup,
const char *testset_name)
{
*setup = (struct compositor_setup) {
.test_quirks = (struct weston_testsuite_quirks){ },
.backend = WESTON_BACKEND_HEADLESS,
.renderer = RENDERER_NOOP,
.shell = SHELL_DESKTOP,
@@ -276,6 +277,7 @@ int
execute_compositor(const struct compositor_setup *setup,
struct wet_testsuite_data *data)
{
struct weston_testsuite_data test_data;
struct prog_args args;
char *tmp;
const char *ctmp, *drm_device;
@@ -418,9 +420,10 @@ execute_compositor(const struct compositor_setup *setup,
if (setup->xwayland)
prog_args_take(&args, strdup("--xwayland"));
wet_testsuite_data_set(data);
test_data.test_quirks = setup->test_quirks;
test_data.test_private_data = data;
prog_args_save(&args);
ret = wet_main(args.argc, args.argv);
ret = wet_main(args.argc, args.argv, &test_data);
prog_args_fini(&args);
+2
View File
@@ -71,6 +71,8 @@ enum shell_type {
* \ingroup testharness
*/
struct compositor_setup {
/** The test suite quirks. */
struct weston_testsuite_quirks test_quirks;
/** The backend to use. */
enum weston_compositor_backend backend;
/** The renderer to use. */
+1 -1
View File
@@ -750,7 +750,7 @@ static void
idle_launch_testsuite(void *test_)
{
struct weston_test *test = test_;
struct wet_testsuite_data *data = wet_testsuite_data_get();
struct wet_testsuite_data *data = weston_compositor_get_test_data(test->compositor);
if (!data)
return;