From fbf64fe730ffa27ee94867017742174f270d3fa0 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 18 May 2018 16:16:09 +0200 Subject: tests; make sure python_lvm_unit.py is executable --- test/api/Makefile.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/api') diff --git a/test/api/Makefile.in b/test/api/Makefile.in index e953675a0..1659b872c 100644 --- a/test/api/Makefile.in +++ b/test/api/Makefile.in @@ -38,6 +38,8 @@ SOURCES2 = \ endif +PYTEST = python_lvm_unit.py + include $(top_builddir)/make.tmpl DEFS += -D_REENTRANT @@ -48,6 +50,9 @@ LIBS += @LVM2APP_LIB@ $(DMEVENT_LIBS) -ldevmapper %.t: %.o $(DEPLIBS) $(CC) -o $@ $(<) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) $(LIBS) +all: + test -x $(PYTEST) || chmod 755 $(PYTEST) + test: $(OBJECTS) $(DEPLIBS) $(CC) -o $@ $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) $(LIBS) $(READLINE_LIBS) -- cgit v1.2.1 From 3bbdde808a9dcb55a9ffd092e931dff80814daa7 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 18 May 2018 16:16:40 +0200 Subject: tests: pick either python2 or python3 .so Use matching PYTHON library implementation. --- test/api/pytest.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/api') diff --git a/test/api/pytest.sh b/test/api/pytest.sh index bf31b39ca..ed9df5e70 100644 --- a/test/api/pytest.sh +++ b/test/api/pytest.sh @@ -31,7 +31,11 @@ aux prepare_dmeventd #Locate the python binding library to use. if [[ -n "${abs_top_builddir+varset}" ]]; then - python_lib=($(find "$abs_top_builddir" -name lvm*.so)) + # For python2 look for lvm.so, python3 uses some lengthy names + case "$(head -1 $(which python_lvm_unit.py) )" in + *2) python_lib=($(find "$abs_top_builddir" -name lvm.so)) ;; + *) python_lib=($(find "$abs_top_builddir" -name lvm*gnu.so)) ;; + esac if [[ ${#python_lib[*]} -ne 1 ]]; then if [[ ${#python_lib[*]} -gt 1 ]]; then # Unable to test python bindings if multiple libraries found: @@ -58,9 +62,9 @@ aux prepare_pvs 6 PY_UNIT_PVS=$(cat DEVICES) export PY_UNIT_PVS -python_lvm_unit.py -v -f TestLvm.test_lv_persistence -exit -#python_lvm_unit.py -v -f +#When needed to run 1 single individual python test +#python_lvm_unit.py -v -f TestLvm.test_lv_persistence +#exit # Run individual tests for shorter error trace for i in \ -- cgit v1.2.1 From b2574c2f3a4a35b7ea3f51dc776cc64ebbe88ba8 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 18 May 2018 16:23:10 +0200 Subject: python: use // for integer division --- test/api/python_lvm_unit.py.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/api') diff --git a/test/api/python_lvm_unit.py.in b/test/api/python_lvm_unit.py.in index 2f9cbb515..78ced7e31 100755 --- a/test/api/python_lvm_unit.py.in +++ b/test/api/python_lvm_unit.py.in @@ -112,7 +112,7 @@ class TestLvm(unittest.TestCase): for d in device_list: vg.extend(d) - vg.createLvLinear(name, vg.getSize() / 2) + vg.createLvLinear(name, vg.getSize() // 2) vg.close() vg = None @@ -124,14 +124,14 @@ class TestLvm(unittest.TestCase): vg.extend(d) vg.createLvThinpool( - pool_name, vg.getSize() / 2, 0, 0, lvm.THIN_DISCARDS_PASSDOWN, 1) + pool_name, vg.getSize() // 2, 0, 0, lvm.THIN_DISCARDS_PASSDOWN, 1) return vg @staticmethod def _create_thin_lv(pv_devices, name): thin_pool_name = 'thin_vg_pool_' + rs(4) vg = TestLvm._create_thin_pool(pv_devices, thin_pool_name) - vg.createLvThin(thin_pool_name, name, vg.getSize() / 8) + vg.createLvThin(thin_pool_name, name, vg.getSize() // 8) vg.close() vg = None @@ -231,7 +231,7 @@ class TestLvm(unittest.TestCase): curr_size = pv.getSize() dev_size = pv.getDevSize() self.assertTrue(curr_size == dev_size) - pv.resize(curr_size / 2) + pv.resize(curr_size // 2) with AllowedPVS() as pvs: pv = pvs[0] resized_size = pv.getSize() @@ -718,7 +718,7 @@ class TestLvm(unittest.TestCase): def test_percent_to_float(self): self.assertEqual(lvm.percentToFloat(0), 0.0) self.assertEqual(lvm.percentToFloat(1000000), 1.0) - self.assertEqual(lvm.percentToFloat(1000000 / 2), 0.5) + self.assertEqual(lvm.percentToFloat(1000000 // 2), 0.5) def test_scan(self): self.assertEqual(lvm.scan(), None) -- cgit v1.2.1 From 25a66737e3c9fee218c84a659d5d9b7a34347e47 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 21 May 2018 11:56:45 +0200 Subject: tests: use 4K extent size To work with for 4k backend devices. --- test/api/vgtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/api') diff --git a/test/api/vgtest.c b/test/api/vgtest.c index da04dda8d..97f0d2c02 100644 --- a/test/api/vgtest.c +++ b/test/api/vgtest.c @@ -28,7 +28,7 @@ vg_t vg; const char *vg_name; #define MAX_DEVICES 16 const char *device[MAX_DEVICES]; -uint64_t size = 1024; +uint64_t size = 4096; #define vg_create(vg_name) \ printf("Creating VG %s\n", vg_name); \ -- cgit v1.2.1