[PATCH weston 3/4] weston-test: Get the test client path from args

Quentin Glidic sardemff7+wayland at sardemff7.net
Thu Jul 25 12:06:42 PDT 2013


From: Quentin Glidic <sardemff7+git at sardemff7.net>

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 tests/weston-test.c    | 16 ++++++++++------
 tests/weston-tests-env |  3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/tests/weston-test.c b/tests/weston-test.c
index b625f42..8feee9e 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -29,6 +29,7 @@
 #include "wayland-test-server-protocol.h"
 
 struct weston_test {
+	char *client;
 	struct weston_compositor *compositor;
 	struct weston_layer layer;
 	struct weston_process process;
@@ -204,19 +205,15 @@ idle_launch_client(void *data)
 	struct weston_test *test = data;
 	pid_t pid;
 	sigset_t allsigs;
-	char *path;
 
-	path = getenv("WESTON_TEST_CLIENT_PATH");
-	if (path == NULL)
-		exit(EXIT_FAILURE);
 	pid = fork();
 	if (pid == -1)
 		exit(EXIT_FAILURE);
 	if (pid == 0) {
 		sigfillset(&allsigs);
 		sigprocmask(SIG_UNBLOCK, &allsigs, NULL);
-		execl(path, path, NULL);
-		weston_log("compositor: executing '%s' failed: %m\n", path);
+		execl(test->client, test->client, NULL);
+		weston_log("compositor: executing '%s' failed: %m\n", test->client);
 		exit(EXIT_FAILURE);
 	}
 
@@ -244,6 +241,13 @@ module_init(struct weston_compositor *ec,
 			     test, bind_test) == NULL)
 		return -1;
 
+	const struct weston_option test_options[] = {
+		{ WESTON_OPTION_STRING, "test-client", 0, &test->client },
+	};
+	if (parse_options(test_options, ARRAY_LENGTH(test_options), argc, argv) < 0)
+		exit(EXIT_FAILURE);
+
+
 	loop = wl_display_get_event_loop(ec->wl_display);
 	wl_event_loop_add_idle(loop, idle_launch_client, test);
 
diff --git a/tests/weston-tests-env b/tests/weston-tests-env
index 1bc06be..2c2d2fa 100755
--- a/tests/weston-tests-env
+++ b/tests/weston-tests-env
@@ -28,11 +28,12 @@ case $1 in
 			&> "$OUTLOG"
 		;;
 	*)
-		WESTON_TEST_CLIENT_PATH=$abs_builddir/$1 $WESTON \
+		$WESTON \
 			--socket=test-$(basename $1) \
 			--backend=$BACKEND \
 			--log="$SERVERLOG" \
 			--modules=xwayland.so \
 			--modules=$abs_builddir/.libs/weston-test.so \
+			--test-client=$abs_builddir/$1 \
 			&> "$OUTLOG"
 esac
-- 
1.8.3.3



More information about the wayland-devel mailing list