[PATCH v1] test: Include /sbin to the PATH when creating ext4 disk image

Simon Glass sjg at chromium.org
Fri Feb 5 04:17:23 CET 2021


Hi Andy,

On Wed, 3 Feb 2021 at 08:32, Andy Shevchenko
<andriy.shevchenko at linux.intel.com> wrote:
>
> On some distributions the mkfs.ext4 is under /sbin and /sbin is not set
> for mere users. Include /sbin to the PATH when creating ext4 disk image,
> so that users won't get a scary traceback from Python.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> ---
>  test/py/tests/test_env.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
> index 940279651da0..536467320e06 100644
> --- a/test/py/tests/test_env.py
> +++ b/test/py/tests/test_env.py
> @@ -414,6 +414,9 @@ def mk_env_ext4(state_test_env):
>      if os.path.exists(persistent):
>          c.log.action('Disk image file ' + persistent + ' already exists')
>      else:
> +        root_path = os.path.abspath('.').split(os.path.sep)[0] + os.path.sep

Is it not enough to do os.path.abspath('.') ? I think it would be good
to have a comment as to what we need this gymnastics.

> +        sbin_path = os.path.join(root_path, 'sbin')
> +        os.environ["PATH"] += os.pathsep + sbin_path
>          try:
>              u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent)
>              u_boot_utils.run_and_log(c, 'mkfs.ext4 %s' % persistent)
> --
> 2.30.0
>

Regards,
Simon


More information about the U-Boot mailing list