summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <[email protected]>2025-03-06 18:46:59 +0100
committerTom Rini <[email protected]>2025-03-30 09:13:34 -0600
commitf94a05d1c4191c587f3abd259dceb4bb99b1b639 (patch)
treedacf38e65ca459722f25b3dc26d9c3be503ec79b
parentf1895bc1e71c18fb872e2fec40ff2310d6b4a0bb (diff)
test: use truncate in mk_fs()
While the dd command actually writes to the block device the truncate command only updates the metadata (at least on ext4). This is faster and reduces wear on the block device. Signed-off-by: Heinrich Schuchardt <[email protected]>
-rw-r--r--test/py/tests/fs_helper.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py
index ccfc0201a49..d85e2b98a24 100644
--- a/test/py/tests/fs_helper.py
+++ b/test/py/tests/fs_helper.py
@@ -54,7 +54,7 @@ def mk_fs(config, fs_type, size, prefix, src_dir=None, size_gran = 0x100000):
try:
check_call(f'rm -f {fs_img}', shell=True)
- check_call(f'dd if=/dev/zero of={fs_img} bs={size_gran} count={count}',
+ check_call(f'truncate -s $(( {size_gran} * {count} )) {fs_img}',
shell=True)
check_call(f'mkfs.{fs_lnxtype} {mkfs_opt} {fs_img}', shell=True)
if fs_type == 'ext4':