* [U-Boot] [PATCH 0/2] test/py: test_fs: follow up v3 of fat write patches
@ 2018-09-27 7:03 Akashi, Takahiro
2018-09-27 7:07 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Akashi, Takahiro
0 siblings, 1 reply; 7+ messages in thread
From: Akashi, Takahiro @ 2018-09-27 7:03 UTC (permalink / raw)
To: u-boot
This patch set is a collection of trivial updates on my v3 of fat write
patches[1]. No functionality changed.
[1] https://lists.denx.de/pipermail/u-boot/2018-September/340652.html
Akashi, Takahiro (2):
test/py: test_fs: remove fs_type argument from umount_fs()
test/py: test_fs: add docstring comments to helper functions
test/py/tests/test_fs/conftest.py | 147 ++++++++++++++++++++++++++++--
1 file changed, 140 insertions(+), 7 deletions(-)
--
2.18.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs()
2018-09-27 7:03 [U-Boot] [PATCH 0/2] test/py: test_fs: follow up v3 of fat write patches Akashi, Takahiro
@ 2018-09-27 7:07 ` Akashi, Takahiro
2018-09-27 7:07 ` [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions Akashi, Takahiro
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Akashi, Takahiro @ 2018-09-27 7:07 UTC (permalink / raw)
To: u-boot
From: "Akashi Takahiro" <takahiro.akashi@linaro.org>
Since there is no use of fs_type in umount_fs(), just remove it.
Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
---
test/py/tests/test_fs/conftest.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 6404b311bc30..826b0f0cb07c 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -129,7 +129,7 @@ def mount_fs(fs_type, device, mount_point):
except CalledProcessError:
raise
-def umount_fs(fs_type, mount_point):
+def umount_fs(mount_point):
if fuse_mounted:
call('sync')
call('guestunmount %s' % mount_point, shell=True)
@@ -223,14 +223,14 @@ def fs_obj_basic(request, u_boot_config):
% big_file, shell=True)
md5val.append(out.split()[0])
- umount_fs(fs_type, mount_dir)
+ umount_fs(mount_dir)
except CalledProcessError:
pytest.skip('Setup failed for filesystem: ' + fs_type)
return
else:
yield [fs_ubtype, fs_img, md5val]
finally:
- umount_fs(fs_type, mount_dir)
+ umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
if fs_img:
call('rm -f %s' % fs_img, shell=True)
@@ -300,14 +300,14 @@ def fs_obj_ext(request, u_boot_config):
md5val.append(out.split()[0])
check_call('rm %s' % tmp_file, shell=True)
- umount_fs(fs_type, mount_dir)
+ umount_fs(mount_dir)
except CalledProcessError:
pytest.skip('Setup failed for filesystem: ' + fs_type)
return
else:
yield [fs_ubtype, fs_img, md5val]
finally:
- umount_fs(fs_type, mount_dir)
+ umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
if fs_img:
call('rm -f %s' % fs_img, shell=True)
@@ -379,14 +379,14 @@ def fs_obj_unlink(request, u_boot_config):
check_call('dd if=/dev/urandom of=%s/dir5/file1 bs=1K count=1'
% mount_dir, shell=True)
- umount_fs(fs_type, mount_dir)
+ umount_fs(mount_dir)
except CalledProcessError:
pytest.skip('Setup failed for filesystem: ' + fs_type)
return
else:
yield [fs_ubtype, fs_img]
finally:
- umount_fs(fs_type, mount_dir)
+ umount_fs(mount_dir)
call('rmdir %s' % mount_dir, shell=True)
if fs_img:
call('rm -f %s' % fs_img, shell=True)
--
2.18.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions
2018-09-27 7:07 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Akashi, Takahiro
@ 2018-09-27 7:07 ` Akashi, Takahiro
2018-10-02 11:21 ` Simon Glass
2018-10-07 0:28 ` [U-Boot] [U-Boot, " Tom Rini
2018-10-02 11:21 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Simon Glass
2018-10-07 0:28 ` [U-Boot] [U-Boot, " Tom Rini
2 siblings, 2 replies; 7+ messages in thread
From: Akashi, Takahiro @ 2018-09-27 7:07 UTC (permalink / raw)
To: u-boot
From: "Akashi Takahiro" <takahiro.akashi@linaro.org>
After Siomon's comment, add a descriptive comment (docstring) to each of
helper functions in conftest.py. No functionality changed.
Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
---
test/py/tests/test_fs/conftest.py | 133 ++++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 826b0f0cb07c..60b4a2d737b9 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -18,10 +18,32 @@ supported_fs_unlink = ['fat16', 'fat32']
# Filesystem test specific setup
#
def pytest_addoption(parser):
+ """Enable --fs-type option.
+
+ See pytest_configure() about how it works.
+
+ Args:
+ parser: Pytest command-line parser.
+
+ Returns:
+ Nothing.
+ """
parser.addoption('--fs-type', action='append', default=None,
help='Targeting Filesystem Types')
def pytest_configure(config):
+ """Restrict a file system(s) to be tested.
+
+ A file system explicitly named with --fs-type option is selected
+ if it belongs to a default supported_fs_xxx list.
+ Multiple options can be specified.
+
+ Args:
+ config: Pytest configuration.
+
+ Returns:
+ Nothing.
+ """
global supported_fs_basic
global supported_fs_ext
global supported_fs_mkdir
@@ -39,6 +61,17 @@ def pytest_configure(config):
supported_fs_unlink = intersect(supported_fs, supported_fs_unlink)
def pytest_generate_tests(metafunc):
+ """Parametrize fixtures, fs_obj_xxx
+
+ Each fixture will be parametrized with a corresponding support_fs_xxx
+ list.
+
+ Args:
+ metafunc: Pytest test function.
+
+ Returns:
+ Nothing.
+ """
if 'fs_obj_basic' in metafunc.fixturenames:
metafunc.parametrize('fs_obj_basic', supported_fs_basic,
indirect=True, scope='module')
@@ -56,12 +89,36 @@ def pytest_generate_tests(metafunc):
# Helper functions
#
def fstype_to_ubname(fs_type):
+ """Convert a file system type to an U-boot specific string
+
+ A generated string can be used as part of file system related commands
+ or a config name in u-boot. Currently fat16 and fat32 are handled
+ specifically.
+
+ Args:
+ fs_type: File system type.
+
+ Return:
+ A corresponding string for file system type.
+ """
if re.match('fat', fs_type):
return 'fat'
else:
return fs_type
def check_ubconfig(config, fs_type):
+ """Check whether a file system is enabled in u-boot configuration.
+
+ This function is assumed to be called in a fixture function so that
+ the whole test cases will be skipped if a given file system is not
+ enabled.
+
+ Args:
+ fs_type: File system type.
+
+ Return:
+ Nothing.
+ """
if not config.buildconfig.get('config_cmd_%s' % fs_type, None):
pytest.skip('.config feature "CMD_%s" not enabled' % fs_type.upper())
if not config.buildconfig.get('config_%s_write' % fs_type, None):
@@ -69,6 +126,16 @@ def check_ubconfig(config, fs_type):
% fs_type.upper())
def mk_fs(config, fs_type, size, id):
+ """Create a file system volume.
+
+ Args:
+ fs_type: File system type.
+ size: Size of file system in MiB.
+ id: Prefix string of volume's file name.
+
+ Return:
+ Nothing.
+ """
fs_img = '%s.%s.img' % (id, fs_type)
fs_img = config.persistent_data_dir + '/' + fs_img
@@ -99,6 +166,14 @@ def mk_fs(config, fs_type, size, id):
# from test/py/conftest.py
def tool_is_in_path(tool):
+ """Check whether a given command is available on host.
+
+ Args:
+ tool: Command name.
+
+ Return:
+ True if available, False if not.
+ """
for path in os.environ["PATH"].split(os.pathsep):
fn = os.path.join(path, tool)
if os.path.isfile(fn) and os.access(fn, os.X_OK):
@@ -108,6 +183,16 @@ def tool_is_in_path(tool):
fuse_mounted = False
def mount_fs(fs_type, device, mount_point):
+ """Mount a volume.
+
+ Args:
+ fs_type: File system type.
+ device: Volume's file name.
+ mount_point: Mount point.
+
+ Return:
+ Nothing.
+ """
global fuse_mounted
fuse_mounted = False
@@ -130,6 +215,14 @@ def mount_fs(fs_type, device, mount_point):
raise
def umount_fs(mount_point):
+ """Unmount a volume.
+
+ Args:
+ mount_point: Mount point.
+
+ Return:
+ Nothing.
+ """
if fuse_mounted:
call('sync')
call('guestunmount %s' % mount_point, shell=True)
@@ -143,6 +236,16 @@ def umount_fs(mount_point):
# NOTE: yield_fixture was deprecated since pytest-3.0
@pytest.yield_fixture()
def fs_obj_basic(request, u_boot_config):
+ """Set up a file system to be used in basic fs test.
+
+ Args:
+ request: Pytest request object.
+ u_boot_config: U-boot configuration.
+
+ Return:
+ A fixture for basic fs test, i.e. a triplet of file system type,
+ volume file name and a list of MD5 hashes.
+ """
fs_type = request.param
fs_img = ''
@@ -241,6 +344,16 @@ def fs_obj_basic(request, u_boot_config):
# NOTE: yield_fixture was deprecated since pytest-3.0
@pytest.yield_fixture()
def fs_obj_ext(request, u_boot_config):
+ """Set up a file system to be used in extended fs test.
+
+ Args:
+ request: Pytest request object.
+ u_boot_config: U-boot configuration.
+
+ Return:
+ A fixture for extended fs test, i.e. a triplet of file system type,
+ volume file name and a list of MD5 hashes.
+ """
fs_type = request.param
fs_img = ''
@@ -318,6 +431,16 @@ def fs_obj_ext(request, u_boot_config):
# NOTE: yield_fixture was deprecated since pytest-3.0
@pytest.yield_fixture()
def fs_obj_mkdir(request, u_boot_config):
+ """Set up a file system to be used in mkdir test.
+
+ Args:
+ request: Pytest request object.
+ u_boot_config: U-boot configuration.
+
+ Return:
+ A fixture for mkdir test, i.e. a duplet of file system type and
+ volume file name.
+ """
fs_type = request.param
fs_img = ''
@@ -341,6 +464,16 @@ def fs_obj_mkdir(request, u_boot_config):
# NOTE: yield_fixture was deprecated since pytest-3.0
@pytest.yield_fixture()
def fs_obj_unlink(request, u_boot_config):
+ """Set up a file system to be used in unlink test.
+
+ Args:
+ request: Pytest request object.
+ u_boot_config: U-boot configuration.
+
+ Return:
+ A fixture for unlink test, i.e. a duplet of file system type and
+ volume file name.
+ """
fs_type = request.param
fs_img = ''
--
2.18.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs()
2018-09-27 7:07 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Akashi, Takahiro
2018-09-27 7:07 ` [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions Akashi, Takahiro
@ 2018-10-02 11:21 ` Simon Glass
2018-10-07 0:28 ` [U-Boot] [U-Boot, " Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2018-10-02 11:21 UTC (permalink / raw)
To: u-boot
On 27 September 2018 at 00:07, Akashi, Takahiro
<takahiro.akashi@linaro.org> wrote:
> From: "Akashi Takahiro" <takahiro.akashi@linaro.org>
>
> Since there is no use of fs_type in umount_fs(), just remove it.
>
> Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
> ---
> test/py/tests/test_fs/conftest.py | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions
2018-09-27 7:07 ` [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions Akashi, Takahiro
@ 2018-10-02 11:21 ` Simon Glass
2018-10-07 0:28 ` [U-Boot] [U-Boot, " Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Simon Glass @ 2018-10-02 11:21 UTC (permalink / raw)
To: u-boot
On 27 September 2018 at 00:07, Akashi, Takahiro
<takahiro.akashi@linaro.org> wrote:
> From: "Akashi Takahiro" <takahiro.akashi@linaro.org>
>
> After Siomon's comment, add a descriptive comment (docstring) to each of
> helper functions in conftest.py. No functionality changed.
>
> Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
> ---
> test/py/tests/test_fs/conftest.py | 133 ++++++++++++++++++++++++++++++
> 1 file changed, 133 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
BTW you don't need to put a 'Returns' section if there is nothing returned.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [U-Boot, 1/2] test/py: test_fs: remove fs_type argument from umount_fs()
2018-09-27 7:07 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Akashi, Takahiro
2018-09-27 7:07 ` [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions Akashi, Takahiro
2018-10-02 11:21 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Simon Glass
@ 2018-10-07 0:28 ` Tom Rini
2 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2018-10-07 0:28 UTC (permalink / raw)
To: u-boot
On Thu, Sep 27, 2018 at 04:07:22PM +0900, Akashi, Takahiro wrote:
> From: "Akashi Takahiro" <takahiro.akashi@linaro.org>
>
> Since there is no use of fs_type in umount_fs(), just remove it.
>
> Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181006/8246ae35/attachment.sig>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [U-Boot, 2/2] test/py: test_fs: add docstring comments to helper functions
2018-09-27 7:07 ` [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions Akashi, Takahiro
2018-10-02 11:21 ` Simon Glass
@ 2018-10-07 0:28 ` Tom Rini
1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2018-10-07 0:28 UTC (permalink / raw)
To: u-boot
On Thu, Sep 27, 2018 at 04:07:23PM +0900, Akashi, Takahiro wrote:
> From: "Akashi Takahiro" <takahiro.akashi@linaro.org>
>
> After Siomon's comment, add a descriptive comment (docstring) to each of
> helper functions in conftest.py. No functionality changed.
>
> Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181006/333a89bd/attachment.sig>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-10-07 0:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27 7:03 [U-Boot] [PATCH 0/2] test/py: test_fs: follow up v3 of fat write patches Akashi, Takahiro
2018-09-27 7:07 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Akashi, Takahiro
2018-09-27 7:07 ` [U-Boot] [PATCH 2/2] test/py: test_fs: add docstring comments to helper functions Akashi, Takahiro
2018-10-02 11:21 ` Simon Glass
2018-10-07 0:28 ` [U-Boot] [U-Boot, " Tom Rini
2018-10-02 11:21 ` [U-Boot] [PATCH 1/2] test/py: test_fs: remove fs_type argument from umount_fs() Simon Glass
2018-10-07 0:28 ` [U-Boot] [U-Boot, " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.