neil / rpms / libblockdev

Forked from rpms/libblockdev a year ago
Clone

Blame 0006-Misc-test-fixes-backport.patch

Vojtech Trefny 3d6d37
From 77b8d17b0baf96a7a552fb8963afdbe8c3b18da7 Mon Sep 17 00:00:00 2001
Vojtech Trefny 3d6d37
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 3d6d37
Date: Wed, 2 Jun 2021 12:53:24 +0200
Vojtech Trefny 3d6d37
Subject: [PATCH 1/4] tests: Make sure the test temp mount is always unmounted
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
With try-finally the unmount function will always run even if the
Vojtech Trefny 3d6d37
test case fails.
Vojtech Trefny 3d6d37
---
Vojtech Trefny 3d6d37
 tests/fs_test.py | 6 ++++--
Vojtech Trefny 3d6d37
 1 file changed, 4 insertions(+), 2 deletions(-)
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
diff --git a/tests/fs_test.py b/tests/fs_test.py
Vojtech Trefny 3d6d37
index 2233db4f..de685b5f 100644
Vojtech Trefny 3d6d37
--- a/tests/fs_test.py
Vojtech Trefny 3d6d37
+++ b/tests/fs_test.py
Vojtech Trefny 3d6d37
@@ -29,8 +29,10 @@ def check_output(args, ignore_retcode=True):
Vojtech Trefny 3d6d37
 @contextmanager
Vojtech Trefny 3d6d37
 def mounted(device, where, ro=False):
Vojtech Trefny 3d6d37
     mount(device, where, ro)
Vojtech Trefny 3d6d37
-    yield
Vojtech Trefny 3d6d37
-    umount(where)
Vojtech Trefny 3d6d37
+    try:
Vojtech Trefny 3d6d37
+        yield
Vojtech Trefny 3d6d37
+    finally:
Vojtech Trefny 3d6d37
+        utils.umount(where)
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
 def _get_dosfstools_version():
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
From aa802b6a2c9038069cfea7f821333367840a43ca Mon Sep 17 00:00:00 2001
Vojtech Trefny 3d6d37
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 3d6d37
Date: Wed, 2 Jun 2021 13:05:17 +0200
Vojtech Trefny 3d6d37
Subject: [PATCH 2/4] tests: Do not check that XFS shrink fails with xfsprogs
Vojtech Trefny 3d6d37
 >= 5.12
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
xfsprogs 5.12 now has experimental support for shrinking, we need
Vojtech Trefny 3d6d37
more changes to support it properly so just skip this check for
Vojtech Trefny 3d6d37
now.
Vojtech Trefny 3d6d37
---
Vojtech Trefny 3d6d37
 tests/fs_test.py | 24 ++++++++++++++++++------
Vojtech Trefny 3d6d37
 1 file changed, 18 insertions(+), 6 deletions(-)
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
diff --git a/tests/fs_test.py b/tests/fs_test.py
Vojtech Trefny 3d6d37
index de685b5f..551b6a7b 100644
Vojtech Trefny 3d6d37
--- a/tests/fs_test.py
Vojtech Trefny 3d6d37
+++ b/tests/fs_test.py
Vojtech Trefny 3d6d37
@@ -44,6 +44,14 @@ def _get_dosfstools_version():
Vojtech Trefny 3d6d37
     return LooseVersion(m.groups()[0])
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
+def _get_xfs_version():
Vojtech Trefny 3d6d37
+    _ret, out, _err = utils.run_command("mkfs.xfs -V")
Vojtech Trefny 3d6d37
+    m = re.search(r"mkfs\.xfs version ([\d\.]+)", out)
Vojtech Trefny 3d6d37
+    if not m or len(m.groups()) != 1:
Vojtech Trefny 3d6d37
+        raise RuntimeError("Failed to determine xfsprogs version from: %s" % out)
Vojtech Trefny 3d6d37
+    return LooseVersion(m.groups()[0])
Vojtech Trefny 3d6d37
+
Vojtech Trefny 3d6d37
+
Vojtech Trefny 3d6d37
 class FSTestCase(unittest.TestCase):
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
     requested_plugins = BlockDev.plugin_specs_from_names(("fs", "loop"))
Vojtech Trefny 3d6d37
@@ -736,9 +744,11 @@ def test_xfs_resize(self):
Vojtech Trefny 3d6d37
         self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2)
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
         # (still) impossible to shrink an XFS file system
Vojtech Trefny 3d6d37
-        with mounted(lv, self.mount_dir):
Vojtech Trefny 3d6d37
-            with self.assertRaises(GLib.GError):
Vojtech Trefny 3d6d37
-                succ = BlockDev.fs_xfs_resize(self.mount_dir, 40 * 1024**2 / fi.block_size, None)
Vojtech Trefny 3d6d37
+        xfs_version = _get_xfs_version()
Vojtech Trefny 3d6d37
+        if xfs_version < LooseVersion("5.1.12"):
Vojtech Trefny 3d6d37
+            with mounted(lv, self.mount_dir):
Vojtech Trefny 3d6d37
+                with self.assertRaises(GLib.GError):
Vojtech Trefny 3d6d37
+                    succ = BlockDev.fs_resize(lv, 40 * 1024**2)
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
         run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1")
Vojtech Trefny 3d6d37
         # should grow
Vojtech Trefny 3d6d37
@@ -1503,9 +1513,11 @@ def test_xfs_generic_resize(self):
Vojtech Trefny 3d6d37
         self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2)
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
         # (still) impossible to shrink an XFS file system
Vojtech Trefny 3d6d37
-        with mounted(lv, self.mount_dir):
Vojtech Trefny 3d6d37
-            with self.assertRaises(GLib.GError):
Vojtech Trefny 3d6d37
-                succ = BlockDev.fs_resize(lv, 40 * 1024**2)
Vojtech Trefny 3d6d37
+        xfs_version = _get_xfs_version()
Vojtech Trefny 3d6d37
+        if xfs_version < LooseVersion("5.1.12"):
Vojtech Trefny 3d6d37
+            with mounted(lv, self.mount_dir):
Vojtech Trefny 3d6d37
+                with self.assertRaises(GLib.GError):
Vojtech Trefny 3d6d37
+                    succ = BlockDev.fs_resize(lv, 40 * 1024**2)
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
         run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1")
Vojtech Trefny 3d6d37
         # should grow
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
From ca01b6021cce3ea6a2318e74de408757f933d947 Mon Sep 17 00:00:00 2001
Vojtech Trefny 3d6d37
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 3d6d37
Date: Wed, 2 Jun 2021 13:06:41 +0200
Vojtech Trefny 3d6d37
Subject: [PATCH 3/4] tests: Temporarily skip
Vojtech Trefny 3d6d37
 test_snapshotcreate_lvorigin_snapshotmerge
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
With LVM DBus API the lvconvert job is never finished which means
Vojtech Trefny 3d6d37
the test run never finishes in our CI.
Vojtech Trefny 3d6d37
---
Vojtech Trefny 3d6d37
 tests/skip.yml | 6 ++++++
Vojtech Trefny 3d6d37
 1 file changed, 6 insertions(+)
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
diff --git a/tests/skip.yml b/tests/skip.yml
Vojtech Trefny 3d6d37
index 145d321d..e22e712d 100644
Vojtech Trefny 3d6d37
--- a/tests/skip.yml
Vojtech Trefny 3d6d37
+++ b/tests/skip.yml
Vojtech Trefny 3d6d37
@@ -137,3 +137,9 @@
Vojtech Trefny 3d6d37
     - distro: "fedora"
Vojtech Trefny 3d6d37
       version: ["31", "32"]
Vojtech Trefny 3d6d37
       reason: "working with old-style LVM snapshots leads to deadlock in LVM tools"
Vojtech Trefny 3d6d37
+
Vojtech Trefny 3d6d37
+- test: lvm_dbus_tests.LvmTestLVsnapshots.test_snapshotcreate_lvorigin_snapshotmerge
Vojtech Trefny 3d6d37
+  skip_on:
Vojtech Trefny 3d6d37
+    - distro: "centos"
Vojtech Trefny 3d6d37
+      version: "9"
Vojtech Trefny 3d6d37
+      reason: "snapshot merge doesn't work on CentOS 9 Stream with LVM DBus API"
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
From d0c44cd3d182599433f352901796af7c403239eb Mon Sep 17 00:00:00 2001
Vojtech Trefny 3d6d37
From: Vojtech Trefny <vtrefny@redhat.com>
Vojtech Trefny 3d6d37
Date: Wed, 2 Jun 2021 13:08:09 +0200
Vojtech Trefny 3d6d37
Subject: [PATCH 4/4] Fix skipping tests on Debian testing
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
Testing now identifies itself as "Debian GNU/Linux 11 (bullseye)"
Vojtech Trefny 3d6d37
so the tests that should be skipped on testing needs to be skipped
Vojtech Trefny 3d6d37
on "11" too.
Vojtech Trefny 3d6d37
---
Vojtech Trefny 3d6d37
 tests/skip.yml | 2 +-
Vojtech Trefny 3d6d37
 1 file changed, 1 insertion(+), 1 deletion(-)
Vojtech Trefny 3d6d37
Vojtech Trefny 3d6d37
diff --git a/tests/skip.yml b/tests/skip.yml
Vojtech Trefny 3d6d37
index e22e712d..4134ee87 100644
Vojtech Trefny 3d6d37
--- a/tests/skip.yml
Vojtech Trefny 3d6d37
+++ b/tests/skip.yml
Vojtech Trefny 3d6d37
@@ -37,7 +37,7 @@
Vojtech Trefny 3d6d37
 - test: fs_test.MountTest.test_mount_ntfs_ro
Vojtech Trefny 3d6d37
   skip_on:
Vojtech Trefny 3d6d37
     - distro: "debian"
Vojtech Trefny 3d6d37
-      version: ["9", "10", "testing"]
Vojtech Trefny 3d6d37
+      version: ["9", "10", "11", "testing"]
Vojtech Trefny 3d6d37
       reason: "NTFS mounting of read-only devices doesn't work as expected on Debian"
Vojtech Trefny 3d6d37
 
Vojtech Trefny 3d6d37
 - test: kbd_test.KbdZRAM*