diff options
author | Joe Thornber <ejt@redhat.com> | 2018-06-01 13:04:12 +0100 |
---|---|---|
committer | Joe Thornber <ejt@redhat.com> | 2018-06-01 13:04:12 +0100 |
commit | dbba1e9b93bac348c0df556b160676234cc8a8c4 (patch) | |
tree | b1db4389e0288231ad36d7a6de607bcc38f38c3a /test/api | |
parent | 89fdc0b5889d24fe785e7fa4c2be13659d1ed0b2 (diff) | |
parent | cb379c86c4b468858b781695934d5ad5957108d2 (diff) | |
download | lvm2-dbba1e9b93bac348c0df556b160676234cc8a8c4.tar.gz |
Merge branch 'master' into 2018-05-11-fork-libdm
Diffstat (limited to 'test/api')
-rw-r--r-- | test/api/Makefile.in | 5 | ||||
-rw-r--r-- | test/api/pytest.sh | 12 | ||||
-rwxr-xr-x | test/api/python_lvm_unit.py.in | 10 | ||||
-rw-r--r-- | test/api/vgtest.c | 2 |
4 files changed, 19 insertions, 10 deletions
diff --git a/test/api/Makefile.in b/test/api/Makefile.in index 6661149d9..d01039447 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 @@ -51,6 +53,9 @@ LIBS += @LVM2APP_LIB@ $(DMEVENT_LIBS) %.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) 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 \ 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) diff --git a/test/api/vgtest.c b/test/api/vgtest.c index ffc4ee13d..6a438d184 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); \ |