[PATCH weston 05/10] tests: Support --config to enable tests to override config defaults

Bryce Harrington bryce at osg.samsung.com
Wed May 6 17:44:24 PDT 2015


Implements a simple mechanism to allow tests to customize the
configuration.  For a given <name>-test.c just place a <name>.ini file
at the same location as the test itself.  Alternately, you can generate
a <name>.ini in the same directory that the compiled test is placed
(i.e. the top builddir).  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            |  3 ++-
 tests/weston-tests-env | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1ba273b..fb3152e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -967,7 +967,8 @@ ivi_tests =
 $(ivi_tests) : $(builddir)/tests/weston-ivi.ini
 
 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
diff --git a/tests/weston-tests-env b/tests/weston-tests-env
index f945ac6..4da908a 100755
--- a/tests/weston-tests-env
+++ b/tests/weston-tests-env
@@ -26,6 +26,16 @@ SHELL_PLUGIN=$MODDIR/desktop-shell.so
 TEST_PLUGIN=$MODDIR/weston-test.so
 XWAYLAND_PLUGIN=$MODDIR/xwayland.so
 
+CONFIG_FILE="${TEST_NAME}.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 $TEST_FILE in
 	ivi-*.la|ivi-*.so)
 		SHELL_PLUGIN=$MODDIR/ivi-shell.so
@@ -43,11 +53,11 @@ case $TEST_FILE in
 	*.la|*.so)
 		WESTON_BUILD_DIR=$abs_builddir \
 		$WESTON --backend=$MODDIR/$BACKEND \
-			--no-config \
 			--shell=$SHELL_PLUGIN \
 			--socket=test-${TEST_NAME} \
 			--modules=$MODDIR/${TEST_FILE/.la/.so},$XWAYLAND_PLUGIN \
 			--log="$SERVERLOG" \
+			${CONFIG} \
 			&> "$OUTLOG"
 		;;
 	ivi-*.weston)
@@ -69,10 +79,10 @@ case $TEST_FILE in
 		WESTON_TEST_CLIENT_PATH=$abs_builddir/$TEST_FILE $WESTON \
 			--socket=test-${TEST_NAME} \
 			--backend=$MODDIR/$BACKEND \
-			--no-config \
 			--shell=$SHELL_PLUGIN \
 			--log="$SERVERLOG" \
 			--modules=$TEST_PLUGIN,$XWAYLAND_PLUGIN \
+			${CONFIG} \
 			$($abs_builddir/$TEST_FILE --params) \
 			&> "$OUTLOG"
 esac
-- 
1.9.1



More information about the wayland-devel mailing list