Replace the shell 'truncate -s <size>M' invocation with Python's file.truncate(), avoiding a subshell for what is just a sized empty file.
Signed-off-by: Simon Glass <[email protected]> --- test/py/tests/fs_helper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py index f81b9c274dc..7659f9e2650 100644 --- a/test/py/tests/fs_helper.py +++ b/test/py/tests/fs_helper.py @@ -108,7 +108,8 @@ class FsHelper: mkfs_opt, fs_lnxtype = self._get_fs_args() check_call(f'rm -f {fs_img}', shell=True) - check_call(f'truncate -s {self.size_mb}M {fs_img}', shell=True) + with open(fs_img, 'wb') as fsi: + fsi.truncate(self.size_mb << 20) check_call(f'mkfs.{fs_lnxtype} {mkfs_opt} {fs_img}', shell=True, stdout=DEVNULL if self.quiet else None) if self.fs_type == 'ext4': -- 2.43.0

