From d4af288f0ef6699a11364a165ef1f5745bade4af Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Sat, 8 Nov 2025 14:54:43 +0100 Subject: [PATCH] test: determine rootfs size dynamically Do not hard-code the size of the rootfs, but determine the needed size dynamically. This will speed up the creation time for smaller content and prevent failures in case of bigger content. --- test/test-functions | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index dc93361e4..466466530 100644 --- a/test/test-functions +++ b/test/test-functions @@ -177,7 +177,12 @@ build_ext4_image() { local image="$2" local label="$3" - dd if=/dev/zero of="$image" bs=200MiB count=1 status=none + local size + size="$(du --summarize --block-size 1 "${source_dir}" | cut -f 1)" + # Add 8 MB for ext4 journal + size="$((size + 8000000))" + + dd if=/dev/zero of="$image" bs="$size" count=1 status=none sync "$image" mkfs.ext4 -q -L "$label" -d "$source_dir" "$image" sync "$image" -- 2.47.3