tests: Don't rely on build directory layout
Rather than having a hardcoded dependency on the build-directory layout, use an explicit module-map environment variable, which rewrites requests for modules and helper/libexec binaries to specific paths. Pekka: This will help with migration to Meson where setting up the paths according to autotools would be painful and unnecessary. Emre: This should also help setting up the test suite after a cross-compile. Pekka: A caveat here is that this patch makes it slightly easier to load external backends by abusing the module map. External backends are specifically not supported in libweston. Signed-off-by: Daniel Stone <daniels@collabora.com> v2: Fixed ivi_layout-test-plugin.c:wet_module_init(). Do not change the lookup name of ivi-layout.ivi. Improved documentation of weston_module_path_from_env() and made it cope with map strings that a) do not end with a semicolon, and b) have multiple consecutive semicolons. Let WESTON_MODULE_MAP be printed into the test log so that it is easier to run tests manually. Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Emre Ucan <eucan@de.adit-jv.com> Suggested by Emil: Use a variable for strlen(name). Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
002f0c56e0
commit
e03c111e4e
@@ -32,6 +32,7 @@
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "compositor.h"
|
||||
#include "compositor/weston.h"
|
||||
@@ -223,7 +224,6 @@ wet_module_init(struct weston_compositor *compositor,
|
||||
{
|
||||
struct wl_event_loop *loop;
|
||||
struct test_launcher *launcher;
|
||||
const char *path;
|
||||
const struct ivi_layout_interface *iface;
|
||||
|
||||
iface = ivi_layout_get_api(compositor);
|
||||
@@ -233,20 +233,18 @@ wet_module_init(struct weston_compositor *compositor,
|
||||
return -1;
|
||||
}
|
||||
|
||||
path = getenv("WESTON_BUILD_DIR");
|
||||
if (!path) {
|
||||
weston_log("test setup failure: WESTON_BUILD_DIR not set\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
launcher = zalloc(sizeof *launcher);
|
||||
if (!launcher)
|
||||
return -1;
|
||||
|
||||
if (weston_module_path_from_env("ivi-layout.ivi", launcher->exe,
|
||||
sizeof launcher->exe) == 0) {
|
||||
weston_log("test setup failure: WESTON_MODULE_MAP not set\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
launcher->compositor = compositor;
|
||||
launcher->layout_interface = iface;
|
||||
snprintf(launcher->exe, sizeof launcher->exe,
|
||||
"%s/ivi-layout.ivi", path);
|
||||
|
||||
if (wl_global_create(compositor->wl_display,
|
||||
&weston_test_runner_interface, 1,
|
||||
|
||||
@@ -25,6 +25,19 @@ MODDIR=$abs_builddir/.libs
|
||||
SHELL_PLUGIN=$MODDIR/desktop-shell.so
|
||||
TEST_PLUGIN=$MODDIR/weston-test.so
|
||||
|
||||
WESTON_MODULE_MAP=
|
||||
for mod in cms-colord cms-static desktop-shell drm-backend fbdev-backend \
|
||||
fullscreen-shell gl-renderer headless-backend hmi-controller \
|
||||
ivi-shell rdp-compositor screen-share wayland-backend \
|
||||
weston-test-desktop-shell x11-backend xwayland; do
|
||||
WESTON_MODULE_MAP="${WESTON_MODULE_MAP}${mod}.so=${abs_builddir}/.libs/${mod}.so;"
|
||||
done
|
||||
|
||||
for exe in weston-desktop-shell weston-keyboard weston-screenshooter \
|
||||
weston-simple-im ivi-layout.ivi; do \
|
||||
WESTON_MODULE_MAP="${WESTON_MODULE_MAP}${exe}=${abs_builddir}/${exe};"
|
||||
done
|
||||
|
||||
CONFIG_FILE="${TEST_NAME}.ini"
|
||||
|
||||
if [ -e "${abs_builddir}/${CONFIG_FILE}" ]; then
|
||||
@@ -40,6 +53,7 @@ case $TEST_FILE in
|
||||
SHELL_PLUGIN=$MODDIR/ivi-shell.so
|
||||
|
||||
set -x
|
||||
WESTON_MODULE_MAP="${WESTON_MODULE_MAP}" \
|
||||
WESTON_DATA_DIR=$abs_top_srcdir/data \
|
||||
WESTON_BUILD_DIR=$abs_builddir \
|
||||
WESTON_TEST_REFERENCE_PATH=$abs_top_srcdir/tests/reference \
|
||||
@@ -53,6 +67,7 @@ case $TEST_FILE in
|
||||
;;
|
||||
*.la|*.so)
|
||||
set -x
|
||||
WESTON_MODULE_MAP="${WESTON_MODULE_MAP}" \
|
||||
WESTON_DATA_DIR=$abs_top_srcdir/data \
|
||||
WESTON_BUILD_DIR=$abs_builddir \
|
||||
WESTON_TEST_REFERENCE_PATH=$abs_top_srcdir/tests/reference \
|
||||
@@ -69,6 +84,7 @@ case $TEST_FILE in
|
||||
SHELL_PLUGIN=$MODDIR/ivi-shell.so
|
||||
|
||||
set -x
|
||||
WESTON_MODULE_MAP="${WESTON_MODULE_MAP}" \
|
||||
WESTON_DATA_DIR=$abs_top_srcdir/data \
|
||||
WESTON_BUILD_DIR=$abs_builddir \
|
||||
WESTON_TEST_REFERENCE_PATH=$abs_top_srcdir/tests/reference \
|
||||
@@ -84,6 +100,7 @@ case $TEST_FILE in
|
||||
;;
|
||||
*)
|
||||
set -x
|
||||
WESTON_MODULE_MAP="${WESTON_MODULE_MAP}" \
|
||||
WESTON_DATA_DIR=$abs_top_srcdir/data \
|
||||
WESTON_BUILD_DIR=$abs_builddir \
|
||||
WESTON_TEST_REFERENCE_PATH=$abs_top_srcdir/tests/reference \
|
||||
|
||||
Reference in New Issue
Block a user