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 <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2014-06-04 00:17:58 +02:00
parent 0a8e0e8b2f
commit 15b2606c4f
9 changed files with 18 additions and 8 deletions

View File

@ -46,6 +46,7 @@ dist_usrbin_exec_SCRIPTS =
systemdsystemunit_DATA =
dist_bashcompletion_DATA =
check_PROGRAMS =
dist_check_SCRIPTS =
TESTS =
PATHFILES =

View File

@ -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

View File

@ -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"}

View File

@ -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/\..*//')

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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