From: Ruediger Meier Date: Tue, 3 Jun 2014 22:17:58 +0000 (+0200) Subject: tests: fix python tests for dist and out-of-tree builds X-Git-Tag: v2.25-rc1~50^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b2606c4f86dbb73abf41cdecfba7f65fd5bb22;p=thirdparty%2Futil-linux.git tests: fix python tests for dist and out-of-tree builds - add python helper scripts to the dist - helper scripts are always in srcdir - python libs are in builddir - abort tests if helpers are missing Signed-off-by: Ruediger Meier --- diff --git a/Makefile.am b/Makefile.am index 73ec1e2cba..5f99c8c3cd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,7 @@ dist_usrbin_exec_SCRIPTS = systemdsystemunit_DATA = dist_bashcompletion_DATA = check_PROGRAMS = +dist_check_SCRIPTS = TESTS = PATHFILES = diff --git a/libmount/python/Makemodule.am b/libmount/python/Makemodule.am index aeb76d75f3..367d324729 100644 --- a/libmount/python/Makemodule.am +++ b/libmount/python/Makemodule.am @@ -26,6 +26,10 @@ pylibmount_la_CFLAGS = \ pylibmount_la_LDFLAGS = \ -avoid-version -module -shared -export-dynamic +dist_check_SCRIPTS += libmount/python/test_mount_context.py +dist_check_SCRIPTS += libmount/python/test_mount_tab.py +dist_check_SCRIPTS += libmount/python/test_mount_tab_update.py + CLEANFILES += *.img endif # BUILD_PYLIBMOUNT diff --git a/tests/commands.sh b/tests/commands.sh index b541af0ae8..06450a3670 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -13,9 +13,9 @@ TS_HELPER_LIBMOUNT_TABDIFF="$top_builddir/test_mount_tab_diff" TS_HELPER_LIBMOUNT_TAB="$top_builddir/test_mount_tab" TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/test_mount_tab_update" TS_HELPER_LIBMOUNT_UTILS="$top_builddir/test_mount_utils" -TS_HELPER_PYLIBMOUNT_CONTEXT="$top_builddir/libmount/python/test_mount_context.py" -TS_HELPER_PYLIBMOUNT_TAB="$top_builddir/libmount/python/test_mount_tab.py" -TS_HELPER_PYLIBMOUNT_UPDATE="$top_builddir/libmount/python/test_mount_tab_update.py" +TS_HELPER_PYLIBMOUNT_CONTEXT="$top_srcdir/libmount/python/test_mount_context.py" +TS_HELPER_PYLIBMOUNT_TAB="$top_srcdir/libmount/python/test_mount_tab.py" +TS_HELPER_PYLIBMOUNT_UPDATE="$top_srcdir/libmount/python/test_mount_tab_update.py" TS_HELPER_LOGINDEFS="$top_builddir/test_logindefs" TS_HELPER_MD5="$top_builddir/test_md5" TS_HELPER_MORE=${TS_HELPER_MORE-"$top_builddir/test_more"} diff --git a/tests/functions.sh b/tests/functions.sh index 85f0e0fac8..31ad481f49 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -316,10 +316,10 @@ function ts_init_suid { function ts_init_py { LIBNAME="$1" - [ -f "$TS_TOPDIR/../py${LIBNAME}.la" ] || ts_skip "py${LIBNAME} not compiled" + [ -f "$top_builddir/py${LIBNAME}.la" ] || ts_skip "py${LIBNAME} not compiled" - export LD_LIBRARY_PATH="$TS_TOPDIR/../.libs" - export PYTHONPATH="$TS_TOPDIR/../$LIBNAME/python:$TS_TOPDIR/../.libs" + export LD_LIBRARY_PATH="$top_builddir/.libs" + export PYTHONPATH="$top_builddir/$LIBNAME/python:$top_builddir/.libs" export PYTHON_VERSION=$(awk '/^PYTHON_VERSION/ { print $3 }' $top_builddir/Makefile) export PYTHON_MAJOR_VERSION=$(echo $PYTHON_VERSION | sed 's/\..*//') diff --git a/tests/ts/libmount/context-py b/tests/ts/libmount/context-py index e8faa7242d..b2355a7955 100755 --- a/tests/ts/libmount/context-py +++ b/tests/ts/libmount/context-py @@ -20,6 +20,7 @@ ts_init_py libmount ts_skip_nonroot TESTPROG="$TS_HELPER_PYLIBMOUNT_CONTEXT" +[ -x $TESTPROG ] || ts_die "test script missing" PYDBG="$PYTHON -m pdb" LABEL=libmount-test diff --git a/tests/ts/libmount/context-utab-py b/tests/ts/libmount/context-utab-py index 8f8c379924..00af69554e 100755 --- a/tests/ts/libmount/context-utab-py +++ b/tests/ts/libmount/context-utab-py @@ -18,6 +18,8 @@ ts_skip_nonroot TESTPROG="$TS_HELPER_PYLIBMOUNT_CONTEXT" +[ -x $TESTPROG ] || ts_die "test script missing" + LABEL=libmount-test UUID=$($TS_CMD_UUIDGEN) MOUNTPOINT="$TS_MOUNTPOINT" diff --git a/tests/ts/libmount/tabfiles-py b/tests/ts/libmount/tabfiles-py index c5ca1c5633..f0c4836d0e 100755 --- a/tests/ts/libmount/tabfiles-py +++ b/tests/ts/libmount/tabfiles-py @@ -11,6 +11,7 @@ ts_init_py libmount PYDBG="$PYTHON -m pdb" TESTPROG="$TS_HELPER_PYLIBMOUNT_TAB" +[ -x $TESTPROG ] || ts_die "test script missing" ts_init_subtest "parse-fstab" $PYTHON $TESTPROG --parse "$TS_SELF/files/fstab" &> $TS_OUTPUT diff --git a/tests/ts/libmount/tabfiles-tags-py b/tests/ts/libmount/tabfiles-tags-py index 982cc0001a..2f462a0aff 100755 --- a/tests/ts/libmount/tabfiles-tags-py +++ b/tests/ts/libmount/tabfiles-tags-py @@ -9,6 +9,8 @@ ts_init_py libmount ts_skip_nonroot TESTPROG="$TS_HELPER_PYLIBMOUNT_TAB" +[ -x $TESTPROG ] || ts_die "test script missing" + ts_check_prog "mkfs.ext3" PYDBG="$PYTHON -m pdb" diff --git a/tests/ts/libmount/update-py b/tests/ts/libmount/update-py index da14b9bae9..6493224fb4 100755 --- a/tests/ts/libmount/update-py +++ b/tests/ts/libmount/update-py @@ -11,8 +11,7 @@ ts_init_py libmount ts_skip_nonroot TESTPROG="$TS_HELPER_PYLIBMOUNT_UPDATE" - -[ -x $TESTPROG ] || ts_skip "test not compiled" +[ -x $TESTPROG ] || ts_die "test script missing" # # fstab - replace