diff mbox series

[v1,1/1] test: Include /sbin to the PATH when creating file system

Message ID 20210610150842.66816-1-andriy.shevchenko@linux.intel.com
State Accepted
Commit b2710faf82998d7be9e4eef554063a5e27e88ec9
Delegated to: Tom Rini
Headers show
Series [v1,1/1] test: Include /sbin to the PATH when creating file system | expand

Commit Message

Andy Shevchenko June 10, 2021, 3:08 p.m. UTC
On some distributions the mkfs is under /sbin and /sbin is not set
for mere users. Include /sbin to the PATH when creating file system,
so that users won't get a scary traceback from Python.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 test/py/tests/test_fs/conftest.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tom Rini June 24, 2021, 1:15 p.m. UTC | #1
On Thu, Jun 10, 2021 at 06:08:42PM +0300, Andy Shevchenko wrote:

> On some distributions the mkfs is under /sbin and /sbin is not set
> for mere users. Include /sbin to the PATH when creating file system,
> so that users won't get a scary traceback from Python.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 410a675b9714..7325486cdb1a 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -159,6 +159,10 @@  def mk_fs(config, fs_type, size, id):
 
     count = (size + 1048576 - 1) / 1048576
 
+    # Some distributions do not add /sbin to the default PATH, where mkfs lives
+    if '/sbin' not in os.environ["PATH"].split(os.pathsep):
+        os.environ["PATH"] += os.pathsep + '/sbin'
+
     try:
         check_call('rm -f %s' % fs_img, shell=True)
         check_call('dd if=/dev/zero of=%s bs=1M count=%d'