Test harness with weston.ini
Currently it is not possible to use weston.ini to configure Weston behavior when running a test, limiting the configuration to what the command line supports. Here is a proposal to address this issue.
Related discussion: !287 (merged)
Changing the current signature
A very straightforward way is changing the signature of weston_test_harness_execute_as_client and execute_compositor.
From:
static enum test_result_code
weston_test_harness_execute_as_client(struct weston_test_harness *harness, struct compositor_setup *setup)
int
execute_compositor(struct weston_test_harness *harness, struct compositor_setup *setup)
void
compositor_setup_defaults_(struct compositor_setup *setup,
const char *testset_name);
To:
static enum test_result_code
weston_test_harness_execute_as_client(struct weston_test_harness *harness,
struct compositor_setup *setup,
struct weston_ini_config *config)
int
execute_compositor(struct weston_test_harness *harness,
struct compositor_setup *setup,
struct weston_ini_config *config)
void
compositor_setup_defaults_(struct compositor_setup *setup,
struct tweston_ini_config* config,
const char *testset_name);
Currently, there is a code to handle the compositor_setup inside execute_compositor, the idea is implement a similar code to weston_ini_config. Then save weston.ini inside /tmp/weston/<test>.ini, and pass this path in the args.
The <test> is the weston_test_harness.chosen_testname, which is unique.
The representation of Weston.ini
Ideally, this has to be scalable, easy to maintain, and easy to fill by the test writer.
I prefer this solution because it is following what has been made in the compositor_setup, it is easy to fill and has defined values to each possible parameter. Even though it is not the optimal solution in terms of maintainability.
struct weston_ini_config {
int repaint-window;
bool require-input;
[…]
}
Example:
[...]
#include "weston-test-fixture-compositor.h"
static enum test_result_code
fixture_setup(struct weston_test_harness *harness)
{
struct compositor_setup setup;
struct weston_ini_config ini;
compositor_setup_defaults(&setup, &ini);
ini.repaint-window = 2;
ini.require-input = true;
return weston_test_harness_execute_as_client(harness, &setup, &ini);
}
DECLARE_FIXTURE_SETUP(fixture_setup);
[...]