tests: Pass wet_testsuite_data to test runs

Make sure every test handler now gets a copy of wet_testsuite_data,
which we'll later use for client<->compositor synchronisation.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2023-06-28 10:49:48 +01:00
parent ae2c47045f
commit fec581ab7a
2 changed files with 22 additions and 14 deletions

View File

@ -150,7 +150,8 @@ find_test(const char *name)
}
static enum test_result_code
run_test(int fixture_nr, const struct weston_test_entry *t, void *data,
run_test(struct wet_testsuite_data *suite_data, int fixture_nr,
const struct weston_test_entry *t, void *data,
int iteration)
{
struct weston_test_run_info info;
@ -165,7 +166,7 @@ run_test(int fixture_nr, const struct weston_test_entry *t, void *data,
info.fixture_nr = fixture_nr;
test_run_info_ = &info;
t->run(data);
t->run(suite_data, data);
test_run_info_ = NULL;
/*
@ -277,10 +278,11 @@ run_case(struct wet_testsuite_data *suite_data,
suite_data->fixture_name, t->name, iteration_nr);
if (suite_data->type == TEST_TYPE_PLUGIN) {
ret = run_test(fixture_nr, t, suite_data->compositor,
ret = run_test(suite_data, fixture_nr, t, suite_data->compositor,
iteration);
} else {
ret = run_test(fixture_nr, t, (void *)test_data, iteration);
ret = run_test(suite_data, fixture_nr, t, (void *)test_data,
iteration);
}
switch (ret) {

View File

@ -51,17 +51,20 @@
*/
struct weston_test_entry {
const char *name;
void (*run)(void *);
void (*run)(struct wet_testsuite_data *, void *);
const void *table_data;
size_t element_size;
int n_elements;
} __attribute__ ((aligned (64)));
#define TEST_BEGIN(name, arg) \
static void name(arg)
static void name(struct wet_testsuite_data *_wet_suite_data, arg)
#define TEST_BEGIN_NO_ARG(name) \
static void name(struct wet_testsuite_data *_wet_suite_data)
#define TEST_COMMON(func, name, data, size, n_elem) \
static void func(void *); \
static void func(struct wet_testsuite_data *, void *); \
\
const struct weston_test_entry test##name \
__attribute__ ((used, section ("test_section"))) = \
@ -71,14 +74,15 @@ struct weston_test_entry {
#define NO_ARG_TEST(name) \
TEST_COMMON(wrap##name, name, NULL, 0, 1) \
static void name(void); \
static void wrap##name(void *data) \
static void name(struct wet_testsuite_data *); \
static void wrap##name(struct wet_testsuite_data *_wet_suite_data,\
void *data) \
{ \
(void) data; \
name(); \
name(_wet_suite_data); \
} \
\
TEST_BEGIN(name, void)
TEST_BEGIN_NO_ARG(name)
#define ARG_TEST(name, test_data) \
TEST_COMMON(name, name, test_data, \
@ -130,10 +134,12 @@ struct weston_test_entry {
*/
#define PLUGIN_TEST(name) \
TEST_COMMON(wrap##name, name, NULL, 0, 1) \
static void name(struct weston_compositor *); \
static void wrap##name(void *compositor) \
static void name(struct wet_testsuite_data *, \
struct weston_compositor *); \
static void wrap##name(struct wet_testsuite_data *_wet_suite_data,\
void *compositor) \
{ \
name(compositor); \
name(_wet_suite_data, compositor); \
} \
TEST_BEGIN(name, struct weston_compositor *compositor)