1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-21 22:04:01 +03:00

ci: add small test case for /dev/urandom as source for CopyBlocks=

This commit is contained in:
Lennart Poettering 2024-06-25 10:24:47 +02:00
parent add090ea82
commit 9a9cc27761

View File

@ -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