[PATCH 1/3] tests: Explicitly define the test client to launch

Jan Arne Petersen jpetersen at openismus.com
Tue Aug 21 09:28:48 PDT 2012


From: Jan Arne Petersen <jpetersen at openismus.com>

Allow different test clients to launch. The test client is defined by
an argument in the test_client_launch() function.
---
 tests/client-test.c | 2 +-
 tests/event-test.c  | 2 +-
 tests/test-runner.c | 4 ++--
 tests/test-runner.h | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/client-test.c b/tests/client-test.c
index 623163e..979b564 100644
--- a/tests/client-test.c
+++ b/tests/client-test.c
@@ -60,7 +60,7 @@ TEST(client_test)
 	assert(context);
 	context->compositor = compositor;
 	context->done = 0;
-	context->client = test_client_launch(compositor);
+	context->client = test_client_launch(compositor, "test-client");
 	context->client->terminate = 1;
 
 	context->compositor_destroy_listener.notify = compositor_destroy;
diff --git a/tests/event-test.c b/tests/event-test.c
index ba048d6..e137213 100644
--- a/tests/event-test.c
+++ b/tests/event-test.c
@@ -70,7 +70,7 @@ TEST(event_test)
 	struct test_client *client;
 	struct weston_layer *layer;
 
-	client = test_client_launch(compositor);
+	client = test_client_launch(compositor, "test-client");
 	client->terminate = 1;
 
 	test_client_send(client, "create-surface\n");
diff --git a/tests/test-runner.c b/tests/test-runner.c
index e60e006..09c2b1f 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -71,7 +71,7 @@ test_client_data(int fd, uint32_t mask, void *data)
 }
 
 struct test_client *
-test_client_launch(struct weston_compositor *compositor)
+test_client_launch(struct weston_compositor *compositor, const char *file_name)
 {
 	struct test_client *client;
 	struct wl_event_loop *loop;
@@ -87,7 +87,7 @@ test_client_launch(struct weston_compositor *compositor)
 	assert(client_fd >= 0);
 	snprintf(buf, sizeof buf, "%d", client_fd);
 	setenv("TEST_SOCKET", buf, 1);
-	snprintf(buf, sizeof buf, "%s/test-client", getenv("abs_builddir"));
+	snprintf(buf, sizeof buf, "%s/%s", getenv("abs_builddir"), file_name);
 	fprintf(stderr, "launching %s\n", buf);
 
 	client->terminate = 0;
diff --git a/tests/test-runner.h b/tests/test-runner.h
index ea353bc..88a08cf 100644
--- a/tests/test-runner.h
+++ b/tests/test-runner.h
@@ -36,7 +36,7 @@ struct test_client {
 	void *data;
 };
 
-struct test_client *test_client_launch(struct weston_compositor *compositor);
+struct test_client *test_client_launch(struct weston_compositor *compositor, const char *file_name);
 void test_client_send(struct test_client *client, const char *fmt, ...);
 
 #endif
-- 
1.7.11.4



More information about the wayland-devel mailing list