From: Lennart Poettering Date: Tue, 25 Jun 2024 08:24:47 +0000 (+0200) Subject: ci: add small test case for /dev/urandom as source for CopyBlocks= X-Git-Tag: v257-rc1~1055^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F33003%2Fhead;p=thirdparty%2Fsystemd.git ci: add small test case for /dev/urandom as source for CopyBlocks= --- diff --git a/test/units/TEST-58-REPART.sh b/test/units/TEST-58-REPART.sh index 8a014ac9fb4..fc06fde0ee7 100755 --- a/test/units/TEST-58-REPART.sh +++ b/test/units/TEST-58-REPART.sh @@ -1287,6 +1287,26 @@ testcase_dropped_partitions() { [[ "$(sfdisk -q -l "$image" | grep -c "$image")" -eq 2 ]] } +testcase_urandom() { + local workdir image defs + + workdir="$(mktemp --directory "/tmp/test-repart.urandom.XXXXXXXXXX")" + # shellcheck disable=SC2064 + trap "rm -rf '${workdir:?}'" RETURN + + image="$workdir/image.img" + truncate -s 32M "$image" + + defs="$workdir/defs" + mkdir "$defs" + echo -ne "[Partition]\nType=swap\nCopyBlocks=/dev/urandom\n" >"$defs/10-urandom.conf" + + systemd-repart --empty=force --pretty=yes --dry-run=no --definitions="$defs" "$image" + + sfdisk -q -l "$image" + [[ "$(sfdisk -q -l "$image" | grep -c "$image")" -eq 1 ]] +} + OFFLINE="yes" run_testcases