2016-02-22 19:40:12 +03:00
#!/bin/bash
2015-04-22 11:55:37 +03:00
# Copyright (C) 2012-2015 Red Hat, Inc. All rights reserved.
2012-10-27 00:35:17 +04:00
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2012-10-27 00:35:17 +04:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMETAD = 1
SKIP_WITH_CLVMD = 1
2014-06-11 13:07:32 +04:00
. lib/inittest
2012-10-27 00:35:17 +04:00
2015-10-27 17:10:06 +03:00
aux prepare_dmeventd
2013-12-06 13:07:22 +04:00
#
# TODO:
# lvm2app is not yet capable to respect many lvm.conf options
# since a lot of them is set in /tools/liblvmline
# Until fixed - testing always runs with enabled monitoring
# thus it needs dmeventd
#
2012-10-27 00:35:17 +04:00
2014-10-26 09:27:23 +03:00
# Example of using 'gdb' with python:
# gdb -ex r --args python FULL_PATH/lvm2/test/api/python_lvm_unit.py -v TestLvm.test_lv_active_inactive
2012-10-27 00:35:17 +04:00
#Locate the python binding library to use.
2017-07-12 14:51:16 +03:00
if [ [ -n " ${ abs_top_builddir +varset } " ] ] ; then
2017-06-29 22:51:26 +03:00
python_lib = ( $( find " $abs_top_builddir " -name lvm.so) )
2016-02-22 19:40:12 +03:00
if [ [ ${# python_lib [*] } -ne 1 ] ] ; then
if [ [ ${# python_lib [*] } -gt 1 ] ] ; then
# Unable to test python bindings if multiple libraries found:
echo " Found left over lvm.so: ${ python_lib [*] } "
false
else
# Unable to test python bindings if library not available
skip "lvm2-python-libs not built"
fi
fi
2015-11-02 14:52:30 +03:00
2017-07-12 02:37:29 +03:00
PYTHONPATH = $( dirname " ${ python_lib [*] } " ) :${ PYTHONPATH - }
2017-06-29 22:51:26 +03:00
export PYTHONPATH
2015-11-02 14:52:30 +03:00
elif rpm -q lvm2-python-libs & >/dev/null; then
true
else
skip "lvm2-python-libs neither built nor installed"
fi
2013-07-05 18:10:25 +04:00
2014-02-24 13:51:10 +04:00
#If you change this change the unit test case too.
aux prepare_pvs 6
2013-07-26 18:51:58 +04:00
#Setup which devices the unit test can use.
2017-06-29 22:51:26 +03:00
PY_UNIT_PVS = $( cat DEVICES)
export PY_UNIT_PVS
2013-07-26 18:51:58 +04:00
2013-12-06 13:07:22 +04:00
#python_lvm_unit.py -v -f
# Run individual tests for shorter error trace
2015-04-22 11:55:37 +03:00
for i in \
lv_persistence \
config_find_bool \
config_override \
config_reload \
dupe_lv_create \
get_set_extend_size \
lv_active_inactive \
lv_property \
lv_rename \
lv_resize \
lv_seg \
lv_size \
lv_snapshot \
lv_suspend \
lv_tags \
percent_to_float \
pv_create \
pv_empty_listing \
pv_getters \
pv_life_cycle \
pv_lookup_from_vg \
pv_property \
pv_resize \
pv_segs \
scan \
version \
vg_from_pv_lookups \
vg_getters \
vg_get_name \
vg_get_set_prop \
vg_get_uuid \
vg_lv_name_validate \
vg_names \
vg_reduce \
vg_remove_restore \
vg_tags \
vg_uuids
do
python_lvm_unit.py -v TestLvm.test_$i
rm -f debug.log_DEBUG*
done
2013-12-06 13:07:22 +04:00
# CHECKME: not for testing?
#python_lvm_unit.py -v TestLvm.test_listing
#python_lvm_unit.py -v TestLvm.test_pv_methods