tests: remove static data from ivi-layout-test-plugin

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>
dev
Pekka Paalanen 5 years ago committed by Daniel Stone
parent 4058828b54
commit d19c55c75e
  1. 43
      tests/ivi-layout-test-plugin.c

@ -76,13 +76,6 @@ find_runner_test(const char *name)
return NULL; return NULL;
} }
struct test_launcher {
struct weston_compositor *compositor;
char exe[2048];
struct weston_process process;
const struct ivi_layout_interface *layout_interface;
};
struct test_context { struct test_context {
const struct ivi_layout_interface *layout_interface; const struct ivi_layout_interface *layout_interface;
struct wl_resource *runner_resource; struct wl_resource *runner_resource;
@ -94,16 +87,25 @@ struct test_context {
struct wl_listener surface_configured; struct wl_listener surface_configured;
}; };
static struct test_context static_context; struct test_launcher {
struct weston_compositor *compositor;
struct test_context context;
char exe[2048];
struct weston_process process;
const struct ivi_layout_interface *layout_interface;
};
static void static void
destroy_runner(struct wl_resource *resource) destroy_runner(struct wl_resource *resource)
{ {
assert(static_context.runner_resource == NULL || struct test_launcher *launcher = wl_resource_get_user_data(resource);
static_context.runner_resource == resource); struct test_context *ctx = &launcher->context;
static_context.layout_interface = NULL; assert(ctx->runner_resource == NULL ||
static_context.runner_resource = NULL; ctx->runner_resource == resource);
ctx->layout_interface = NULL;
ctx->runner_resource = NULL;
} }
static void static void
@ -118,13 +120,16 @@ runner_run_handler(struct wl_client *client, struct wl_resource *resource,
{ {
struct test_launcher *launcher; struct test_launcher *launcher;
const struct runner_test *t; const struct runner_test *t;
struct test_context *ctx;
assert(static_context.runner_resource == NULL ||
static_context.runner_resource == resource);
launcher = wl_resource_get_user_data(resource); launcher = wl_resource_get_user_data(resource);
static_context.layout_interface = launcher->layout_interface; ctx = &launcher->context;
static_context.runner_resource = resource;
assert(ctx->runner_resource == NULL ||
ctx->runner_resource == resource);
ctx->layout_interface = launcher->layout_interface;
ctx->runner_resource = resource;
t = find_runner_test(test_name); t = find_runner_test(test_name);
if (!t) { if (!t) {
@ -139,7 +144,7 @@ runner_run_handler(struct wl_client *client, struct wl_resource *resource,
weston_log("weston_test_runner.run(\"%s\")\n", test_name); weston_log("weston_test_runner.run(\"%s\")\n", test_name);
t->run(&static_context); t->run(ctx);
weston_test_runner_send_finished(resource); weston_test_runner_send_finished(resource);
} }
@ -166,7 +171,7 @@ bind_runner(struct wl_client *client, void *data,
wl_resource_set_implementation(resource, &runner_implementation, wl_resource_set_implementation(resource, &runner_implementation,
launcher, destroy_runner); launcher, destroy_runner);
if (static_context.runner_resource != NULL) { if (launcher->context.runner_resource != NULL) {
weston_log("test FATAL: " weston_log("test FATAL: "
"attempting to run several tests in parallel.\n"); "attempting to run several tests in parallel.\n");
wl_resource_post_error(resource, wl_resource_post_error(resource,

Loading…
Cancel
Save