|
Vojtech Trefny |
793a51 |
From cc522ec3717d909370af6181c7859c62fa0167df Mon Sep 17 00:00:00 2001
|
|
Vojtech Trefny |
793a51 |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Vojtech Trefny |
793a51 |
Date: Mon, 22 Feb 2021 15:40:56 +0100
|
|
Vojtech Trefny |
793a51 |
Subject: [PATCH 1/2] fs: Allow using empty label for vfat with newest
|
|
Vojtech Trefny |
793a51 |
dosfstools
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
---
|
|
Vojtech Trefny |
793a51 |
src/plugins/fs/vfat.c | 11 +++++++++++
|
|
Vojtech Trefny |
793a51 |
1 file changed, 11 insertions(+)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
diff --git a/src/plugins/fs/vfat.c b/src/plugins/fs/vfat.c
|
|
Vojtech Trefny |
793a51 |
index ff0c35a3..ce13f147 100644
|
|
Vojtech Trefny |
793a51 |
--- a/src/plugins/fs/vfat.c
|
|
Vojtech Trefny |
793a51 |
+++ b/src/plugins/fs/vfat.c
|
|
Vojtech Trefny |
793a51 |
@@ -232,10 +232,21 @@ gboolean bd_fs_vfat_repair (const gchar *device, const BDExtraArg **extra, GErro
|
|
Vojtech Trefny |
793a51 |
*/
|
|
Vojtech Trefny |
793a51 |
gboolean bd_fs_vfat_set_label (const gchar *device, const gchar *label, GError **error) {
|
|
Vojtech Trefny |
793a51 |
const gchar *args[4] = {"fatlabel", device, label, NULL};
|
|
Vojtech Trefny |
793a51 |
+ UtilDep dep = {"fatlabel", "4.2", "--version", "fatlabel\\s+([\\d\\.]+).+"};
|
|
Vojtech Trefny |
793a51 |
+ gboolean new_vfat = FALSE;
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
if (!check_deps (&avail_deps, DEPS_FATLABEL_MASK, deps, DEPS_LAST, &deps_check_lock, error))
|
|
Vojtech Trefny |
793a51 |
return FALSE;
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
+ if (!label || g_strcmp0 (label, "") == 0) {
|
|
Vojtech Trefny |
793a51 |
+ /* fatlabel >= 4.2 refuses to set empty label */
|
|
Vojtech Trefny |
793a51 |
+ new_vfat = bd_utils_check_util_version (dep.name, dep.version,
|
|
Vojtech Trefny |
793a51 |
+ dep.ver_arg, dep.ver_regexp,
|
|
Vojtech Trefny |
793a51 |
+ NULL);
|
|
Vojtech Trefny |
793a51 |
+ if (new_vfat)
|
|
Vojtech Trefny |
793a51 |
+ args[2] = "--reset";
|
|
Vojtech Trefny |
793a51 |
+ }
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
return bd_utils_exec_and_report_error (args, NULL, error);
|
|
Vojtech Trefny |
793a51 |
}
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
From c3c3583409c8ed8f99a840e0c70cc92ca1dd3c93 Mon Sep 17 00:00:00 2001
|
|
Vojtech Trefny |
793a51 |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Vojtech Trefny |
793a51 |
Date: Tue, 27 Apr 2021 14:06:59 +0200
|
|
Vojtech Trefny |
793a51 |
Subject: [PATCH 2/2] tests: Call fs_vfat_mkfs with "--mbr=n" extra option in
|
|
Vojtech Trefny |
793a51 |
tests
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
Without the option the newest dosfstools 4.2 will create a valid
|
|
Vojtech Trefny |
793a51 |
MBR partition table with a simgle partition on the disk, see
|
|
Vojtech Trefny |
793a51 |
dosfstools/dosfstools#95 for details.
|
|
Vojtech Trefny |
793a51 |
---
|
|
Vojtech Trefny |
793a51 |
src/plugins/fs/vfat.c | 5 ++-
|
|
Vojtech Trefny |
793a51 |
tests/fs_test.py | 76 +++++++++++++++++++++++++++++++++----------
|
|
Vojtech Trefny |
793a51 |
2 files changed, 62 insertions(+), 19 deletions(-)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
diff --git a/src/plugins/fs/vfat.c b/src/plugins/fs/vfat.c
|
|
Vojtech Trefny |
793a51 |
index ce13f147..6cb82537 100644
|
|
Vojtech Trefny |
793a51 |
--- a/src/plugins/fs/vfat.c
|
|
Vojtech Trefny |
793a51 |
+++ b/src/plugins/fs/vfat.c
|
|
Vojtech Trefny |
793a51 |
@@ -234,6 +234,7 @@ gboolean bd_fs_vfat_set_label (const gchar *device, const gchar *label, GError *
|
|
Vojtech Trefny |
793a51 |
const gchar *args[4] = {"fatlabel", device, label, NULL};
|
|
Vojtech Trefny |
793a51 |
UtilDep dep = {"fatlabel", "4.2", "--version", "fatlabel\\s+([\\d\\.]+).+"};
|
|
Vojtech Trefny |
793a51 |
gboolean new_vfat = FALSE;
|
|
Vojtech Trefny |
793a51 |
+ GError *loc_error = NULL;
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
if (!check_deps (&avail_deps, DEPS_FATLABEL_MASK, deps, DEPS_LAST, &deps_check_lock, error))
|
|
Vojtech Trefny |
793a51 |
return FALSE;
|
|
Vojtech Trefny |
793a51 |
@@ -242,9 +243,11 @@ gboolean bd_fs_vfat_set_label (const gchar *device, const gchar *label, GError *
|
|
Vojtech Trefny |
793a51 |
/* fatlabel >= 4.2 refuses to set empty label */
|
|
Vojtech Trefny |
793a51 |
new_vfat = bd_utils_check_util_version (dep.name, dep.version,
|
|
Vojtech Trefny |
793a51 |
dep.ver_arg, dep.ver_regexp,
|
|
Vojtech Trefny |
793a51 |
- NULL);
|
|
Vojtech Trefny |
793a51 |
+ &loc_error);
|
|
Vojtech Trefny |
793a51 |
if (new_vfat)
|
|
Vojtech Trefny |
793a51 |
args[2] = "--reset";
|
|
Vojtech Trefny |
793a51 |
+ else
|
|
Vojtech Trefny |
793a51 |
+ g_clear_error (&loc_error);
|
|
Vojtech Trefny |
793a51 |
}
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
return bd_utils_exec_and_report_error (args, NULL, error);
|
|
Vojtech Trefny |
793a51 |
diff --git a/tests/fs_test.py b/tests/fs_test.py
|
|
Vojtech Trefny |
793a51 |
index 239cb47c..2233db4f 100644
|
|
Vojtech Trefny |
793a51 |
--- a/tests/fs_test.py
|
|
Vojtech Trefny |
793a51 |
+++ b/tests/fs_test.py
|
|
Vojtech Trefny |
793a51 |
@@ -5,10 +5,13 @@
|
|
Vojtech Trefny |
793a51 |
import tempfile
|
|
Vojtech Trefny |
793a51 |
from contextlib import contextmanager
|
|
Vojtech Trefny |
793a51 |
import utils
|
|
Vojtech Trefny |
793a51 |
-from utils import run, create_sparse_tempfile, mount, umount, TestTags, tag_test
|
|
Vojtech Trefny |
793a51 |
+from utils import run, create_sparse_tempfile, mount, umount, TestTags, tag_test, run_command
|
|
Vojtech Trefny |
793a51 |
+import re
|
|
Vojtech Trefny |
793a51 |
import six
|
|
Vojtech Trefny |
793a51 |
import overrides_hack
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
+from distutils.version import LooseVersion
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
from gi.repository import BlockDev, GLib
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
@@ -29,9 +32,20 @@ def mounted(device, where, ro=False):
|
|
Vojtech Trefny |
793a51 |
yield
|
|
Vojtech Trefny |
793a51 |
umount(where)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
+def _get_dosfstools_version():
|
|
Vojtech Trefny |
793a51 |
+ _ret, out, _err = run_command("mkfs.vfat --help")
|
|
Vojtech Trefny |
793a51 |
+ # mkfs.fat 4.1 (2017-01-24)
|
|
Vojtech Trefny |
793a51 |
+ m = re.search(r"mkfs\.fat ([\d\.]+)", out)
|
|
Vojtech Trefny |
793a51 |
+ if not m or len(m.groups()) != 1:
|
|
Vojtech Trefny |
793a51 |
+ raise RuntimeError("Failed to determine dosfstools version from: %s" % out)
|
|
Vojtech Trefny |
793a51 |
+ return LooseVersion(m.groups()[0])
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
class FSTestCase(unittest.TestCase):
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
requested_plugins = BlockDev.plugin_specs_from_names(("fs", "loop"))
|
|
Vojtech Trefny |
793a51 |
+ _vfat_version = _get_dosfstools_version()
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
@classmethod
|
|
Vojtech Trefny |
793a51 |
def setUpClass(cls):
|
|
Vojtech Trefny |
793a51 |
@@ -66,6 +80,11 @@ def setUp(self):
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
self.mount_dir = tempfile.mkdtemp(prefix="libblockdev.", suffix="ext4_test")
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
+ if self._vfat_version <= LooseVersion("4.1"):
|
|
Vojtech Trefny |
793a51 |
+ self._mkfs_options = None
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ self._mkfs_options = [BlockDev.ExtraArg.new("--mbr=n", "")]
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
def _clean_up(self):
|
|
Vojtech Trefny |
793a51 |
try:
|
|
Vojtech Trefny |
793a51 |
utils.delete_lio_device(self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
@@ -120,7 +139,10 @@ def test_generic_wipe(self):
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
# vfat has multiple signatures on the device so it allows us to test the
|
|
Vojtech Trefny |
793a51 |
# 'all' argument of fs_wipe()
|
|
Vojtech Trefny |
793a51 |
- ret = run("mkfs.vfat -I %s >/dev/null 2>&1" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
+ if self._vfat_version >= LooseVersion("4.2"):
|
|
Vojtech Trefny |
793a51 |
+ ret = utils.run("mkfs.vfat -I %s >/dev/null 2>&1 --mbr=n" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ ret = utils.run("mkfs.vfat -I %s >/dev/null 2>&1" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
self.assertEqual(ret, 0)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
time.sleep(0.5)
|
|
Vojtech Trefny |
793a51 |
@@ -142,7 +164,10 @@ def test_generic_wipe(self):
|
|
Vojtech Trefny |
793a51 |
self.assertEqual(fs_type, b"")
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
# now do the wipe all in a one step
|
|
Vojtech Trefny |
793a51 |
- ret = run("mkfs.vfat -I %s >/dev/null 2>&1" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
+ if self._vfat_version >= LooseVersion("4.2"):
|
|
Vojtech Trefny |
793a51 |
+ ret = utils.run("mkfs.vfat -I %s >/dev/null 2>&1 --mbr=n" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ ret = utils.run("mkfs.vfat -I %s >/dev/null 2>&1" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
self.assertEqual(ret, 0)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
succ = BlockDev.fs_wipe(self.loop_dev, True)
|
|
Vojtech Trefny |
793a51 |
@@ -197,7 +222,10 @@ def test_clean(self):
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
# vfat has multiple signatures on the device so it allows us to test
|
|
Vojtech Trefny |
793a51 |
# that clean removes all signatures
|
|
Vojtech Trefny |
793a51 |
- ret = run("mkfs.vfat -I %s >/dev/null 2>&1" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
+ if self._vfat_version >= LooseVersion("4.2"):
|
|
Vojtech Trefny |
793a51 |
+ ret = utils.run("mkfs.vfat -I %s >/dev/null 2>&1 --mbr=n" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ ret = utils.run("mkfs.vfat -I %s >/dev/null 2>&1" % self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
self.assertEqual(ret, 0)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
time.sleep(0.5)
|
|
Vojtech Trefny |
793a51 |
@@ -744,9 +772,9 @@ def test_vfat_mkfs(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to create a new vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
with self.assertRaises(GLib.GError):
|
|
Vojtech Trefny |
793a51 |
- BlockDev.fs_vfat_mkfs("/non/existing/device", None)
|
|
Vojtech Trefny |
793a51 |
+ BlockDev.fs_vfat_mkfs("/non/existing/device", self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
# just try if we can mount the file system
|
|
Vojtech Trefny |
793a51 |
@@ -764,7 +792,10 @@ def test_vfat_mkfs_with_label(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to create an vfat file system with label"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
ea = BlockDev.ExtraArg.new("-n", "TEST_LABEL")
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, [ea])
|
|
Vojtech Trefny |
793a51 |
+ if self._mkfs_options:
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, [ea] + self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, [ea])
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
fi = BlockDev.fs_vfat_get_info(self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
@@ -775,7 +806,7 @@ class VfatTestWipe(FSTestCase):
|
|
Vojtech Trefny |
793a51 |
def test_vfat_wipe(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to wipe an vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
succ = BlockDev.fs_vfat_wipe(self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
@@ -805,7 +836,7 @@ class VfatTestCheck(FSTestCase):
|
|
Vojtech Trefny |
793a51 |
def test_vfat_check(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to check an vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
succ = BlockDev.fs_vfat_check(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
@@ -818,7 +849,7 @@ class VfatTestRepair(FSTestCase):
|
|
Vojtech Trefny |
793a51 |
def test_vfat_repair(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to repair an vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
succ = BlockDev.fs_vfat_repair(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
@@ -828,7 +859,7 @@ class VfatGetInfo(FSTestCase):
|
|
Vojtech Trefny |
793a51 |
def test_vfat_get_info(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to get info about an vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
fi = BlockDev.fs_vfat_get_info(self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
@@ -841,7 +872,7 @@ class VfatSetLabel(FSTestCase):
|
|
Vojtech Trefny |
793a51 |
def test_vfat_set_label(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to set label of an vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
fi = BlockDev.fs_vfat_get_info(self.loop_dev)
|
|
Vojtech Trefny |
793a51 |
@@ -870,7 +901,7 @@ class VfatResize(FSTestCase):
|
|
Vojtech Trefny |
793a51 |
def test_vfat_resize(self):
|
|
Vojtech Trefny |
793a51 |
"""Verify that it is possible to resize an vfat file system"""
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
# shrink
|
|
Vojtech Trefny |
793a51 |
@@ -999,7 +1030,7 @@ def _remove_user(self):
|
|
Vojtech Trefny |
793a51 |
def test_mount(self):
|
|
Vojtech Trefny |
793a51 |
""" Test basic mounting and unmounting """
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
tmp = tempfile.mkdtemp(prefix="libblockdev.", suffix="mount_test")
|
|
Vojtech Trefny |
793a51 |
@@ -1104,7 +1135,7 @@ def test_mount_fstab(self):
|
|
Vojtech Trefny |
793a51 |
fstab = utils.read_file("/etc/fstab")
|
|
Vojtech Trefny |
793a51 |
self.addCleanup(utils.write_file, "/etc/fstab", fstab)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
tmp = tempfile.mkdtemp(prefix="libblockdev.", suffix="mount_fstab_test")
|
|
Vojtech Trefny |
793a51 |
@@ -1139,7 +1170,7 @@ def test_mount_fstab_user(self):
|
|
Vojtech Trefny |
793a51 |
fstab = utils.read_file("/etc/fstab")
|
|
Vojtech Trefny |
793a51 |
self.addCleanup(utils.write_file, "/etc/fstab", fstab)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
tmp = tempfile.mkdtemp(prefix="libblockdev.", suffix="mount_fstab_user_test")
|
|
Vojtech Trefny |
793a51 |
@@ -1423,7 +1454,16 @@ def expected_size(fi):
|
|
Vojtech Trefny |
793a51 |
@tag_test(TestTags.UNSTABLE)
|
|
Vojtech Trefny |
793a51 |
def test_vfat_generic_resize(self):
|
|
Vojtech Trefny |
793a51 |
"""Test generic resize function with a vfat file system"""
|
|
Vojtech Trefny |
793a51 |
- self._test_generic_resize(mkfs_function=BlockDev.fs_vfat_mkfs)
|
|
Vojtech Trefny |
793a51 |
+ def mkfs_vfat(device, options=None):
|
|
Vojtech Trefny |
793a51 |
+ if self._vfat_version >= LooseVersion("4.2"):
|
|
Vojtech Trefny |
793a51 |
+ if options:
|
|
Vojtech Trefny |
793a51 |
+ return BlockDev.fs_vfat_mkfs(device, options + [BlockDev.ExtraArg.new("--mbr=n", "")])
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ return BlockDev.fs_vfat_mkfs(device, [BlockDev.ExtraArg.new("--mbr=n", "")])
|
|
Vojtech Trefny |
793a51 |
+ else:
|
|
Vojtech Trefny |
793a51 |
+ return BlockDev.fs_vfat_mkfs(device, options)
|
|
Vojtech Trefny |
793a51 |
+
|
|
Vojtech Trefny |
793a51 |
+ self._test_generic_resize(mkfs_function=mkfs_vfat)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
def _destroy_lvm(self):
|
|
Vojtech Trefny |
793a51 |
run("vgremove --yes libbd_fs_tests >/dev/null 2>&1")
|
|
Vojtech Trefny |
793a51 |
@@ -1539,7 +1579,7 @@ def test_freeze_xfs(self):
|
|
Vojtech Trefny |
793a51 |
def test_freeze_vfat(self):
|
|
Vojtech Trefny |
793a51 |
""" Test basic freezing and un-freezing with FAT """
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
- succ = BlockDev.fs_vfat_mkfs(self.loop_dev, None)
|
|
Vojtech Trefny |
793a51 |
+ succ = BlockDev.fs_vfat_mkfs(self.loop_dev, self._mkfs_options)
|
|
Vojtech Trefny |
793a51 |
self.assertTrue(succ)
|
|
Vojtech Trefny |
793a51 |
|
|
Vojtech Trefny |
793a51 |
tmp = tempfile.mkdtemp(prefix="libblockdev.", suffix="freeze_test")
|