Message ID | 20200421104110.7498-1-xypron.glpk@gmx.de |
---|---|
State | New |
Headers | show |
Series | test: use correct path in file system tests | expand |
On 4/21/20 4:41 AM, Heinrich Schuchardt wrote: > For non-root users mkfs.ext4 and fsck.ext4 are not in the search path at > least on Debian. Use /sbin/mkfs.ext4 and /sbin/fsck.ext4 instead. Why not just set $PATH correctly before running the tests? This change prevents the code from finding mkfs via $PATH, which feels wrong; it assumes all distros install the tool in the same hard-coded location, and prevents anyone from temporarily using a customized version for testing purposes via $PATH. Perhaps the code can find mkfs in $PATH, and only fall back to a hard-coded location if it's not present in $PATH?
Hi Heinrich, On Tue, 21 Apr 2020 at 04:46, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote: > > For non-root users mkfs.ext4 and fsck.ext4 are not in the search path at > least on Debian. Use /sbin/mkfs.ext4 and /sbin/fsck.ext4 instead. > > Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de> > --- > test/py/tests/test_fs/conftest.py | 2 +- > test/py/tests/test_fs/fstest_helpers.py | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > Reviewed-by: Simon Glass <sjg at chromium.org> BTW for me the tests work most of the time, but sometimes fail. Have you ever seen failures? - Simon
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py index 1949f91619..b03fe75f5c 100644 --- a/test/py/tests/test_fs/conftest.py +++ b/test/py/tests/test_fs/conftest.py @@ -165,7 +165,7 @@ def mk_fs(config, fs_type, size, id): check_call('rm -f %s' % fs_img, shell=True) check_call('dd if=/dev/zero of=%s bs=1M count=%d' % (fs_img, count), shell=True) - check_call('mkfs.%s %s %s' + check_call('/sbin/mkfs.%s %s %s' % (fs_lnxtype, mkfs_opt, fs_img), shell=True) return fs_img except CalledProcessError: diff --git a/test/py/tests/test_fs/fstest_helpers.py b/test/py/tests/test_fs/fstest_helpers.py index faec298248..f1326434a6 100644 --- a/test/py/tests/test_fs/fstest_helpers.py +++ b/test/py/tests/test_fs/fstest_helpers.py @@ -8,6 +8,6 @@ from subprocess import check_call, CalledProcessError def assert_fs_integrity(fs_type, fs_img): try: if fs_type == 'ext4': - check_call('fsck.ext4 -n -f %s' % fs_img, shell=True) + check_call('/sbin/fsck.ext4 -n -f %s' % fs_img, shell=True) except CalledProcessError: raise
For non-root users mkfs.ext4 and fsck.ext4 are not in the search path at least on Debian. Use /sbin/mkfs.ext4 and /sbin/fsck.ext4 instead. Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de> --- test/py/tests/test_fs/conftest.py | 2 +- test/py/tests/test_fs/fstest_helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.26.1