[PATCH 2/9] tests: Support --config to enable tests to override config defaults
Bryce Harrington
bryce at osg.samsung.com
Thu Apr 2 19:16:51 PDT 2015
Implements a simple mechanism to allow tests to customize the
configuration. Just place a <test>.ini file at the same location as the
test itself. If no configuration file is found, then no configuration
will be used (i.e. --no-config is specified.)
Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
Makefile.am | 8 +++++++-
tests/weston-tests-env | 13 +++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 119085b..9ed87b1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -931,6 +931,7 @@ module_tests = \
surface-global-test.la
weston_tests = \
+ config-malformed.weston \
bad_buffer.weston \
keyboard.weston \
event.weston \
@@ -943,7 +944,8 @@ weston_tests = \
AM_TESTS_ENVIRONMENT = \
- abs_builddir='$(abs_builddir)'; export abs_builddir;
+ abs_builddir='$(abs_builddir)'; export abs_builddir; \
+ abs_top_srcdir='$(abs_top_srcdir)'; export abs_top_srcdir;
TEST_EXTENSIONS = .la .weston
LA_LOG_COMPILER = $(srcdir)/tests/weston-tests-env
@@ -1014,6 +1016,10 @@ nodist_libtest_client_la_SOURCES = \
libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la libtest-runner.la
+config_malformed_weston_SOURCES = tests/config-malformed-test.c
+config_malformed_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+config_malformed_weston_LDADD = libtest-client.la
+
bad_buffer_weston_SOURCES = tests/bad-buffer-test.c
bad_buffer_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
bad_buffer_weston_LDADD = libtest-client.la
diff --git a/tests/weston-tests-env b/tests/weston-tests-env
index 4d9ba88..0687916 100755
--- a/tests/weston-tests-env
+++ b/tests/weston-tests-env
@@ -27,11 +27,20 @@ SHELL_PLUGIN=$MODDIR/desktop-shell.so
TEST_PLUGIN=$MODDIR/weston-test.so
XWAYLAND_PLUGIN=$MODDIR/xwayland.so
+CONFIG_FILE="$(basename $TESTNAME).ini"
+if [ -e "${abs_builddir}/${CONFIG_FILE}" ]; then
+ CONFIG="--config=${abs_builddir}/${CONFIG_FILE}"
+elif [ -e "${abs_top_srcdir}/tests/${CONFIG_FILE}" ]; then
+ CONFIG="--config=${abs_top_srcdir}/tests/${CONFIG_FILE}"
+else
+ CONFIG="--no-config"
+fi
+
case $TESTNAME in
*.la|*.so)
WESTON_BUILD_DIR=$abs_builddir \
$WESTON --backend=$MODDIR/$BACKEND \
- --no-config \
+ $CONFIG \
--shell=$SHELL_PLUGIN \
--socket=test-$(basename $TESTNAME) \
--modules=$MODDIR/${TESTNAME/.la/.so},$XWAYLAND_PLUGIN \
@@ -43,7 +52,7 @@ case $TESTNAME in
WESTON_TEST_CLIENT_PATH=$abs_builddir/$TESTNAME $WESTON \
--socket=test-$(basename $TESTNAME) \
--backend=$MODDIR/$BACKEND \
- --no-config \
+ $CONFIG \
--shell=$SHELL_PLUGIN \
--log="$SERVERLOG" \
--modules=$TEST_PLUGIN,$XWAYLAND_PLUGIN \
--
1.9.1
More information about the wayland-devel
mailing list