test: make TEST-58-REPART support nspawn

This commit is contained in:
Yu Watanabe 2022-08-20 04:59:03 +09:00 committed by Daan De Meyer
parent 2b21522e82
commit 760971125d
2 changed files with 27 additions and 9 deletions

View File

@ -3,14 +3,15 @@
set -e
TEST_DESCRIPTION="test systemd-repart"
TEST_NO_NSPAWN=1
# shellcheck source=test/test-functions
. "$TEST_BASE_DIR/test-functions"
test_append_files() {
install_dmevent
generate_module_dependencies
if ! get_bool "${TEST_NO_QEMU:=}"; then
install_dmevent
generate_module_dependencies
fi
}
do_test "$@"

View File

@ -16,16 +16,18 @@ export PAGER=cat
seed=750b6cd5c4ae4012a15e7be3c29e6a47
mkdir -p /run/systemd/system/systemd-udevd.service.d
cat >/run/systemd/system/systemd-udevd.service.d/debug.conf <<EOF
if ! systemd-detect-virt --quiet --container; then
mkdir -p /run/systemd/system/systemd-udevd.service.d
cat >/run/systemd/system/systemd-udevd.service.d/debug.conf <<EOF
[Service]
Environment=SYSTEMD_LOG_LEVEL=debug
EOF
systemctl daemon-reload
udevadm settle
systemctl restart systemd-udevd.service
udevadm control --ping
systemctl daemon-reload
udevadm settle
systemctl restart systemd-udevd.service
udevadm control --ping
fi
machine="$(uname -m)"
if [ "${machine}" = "x86_64" ]; then
@ -249,6 +251,11 @@ $imgs/zzz6 : start= 4194264, size= 2097152, type=0FC63DAF-8483-4772-8E79
cmp --bytes=$((4096*10240)) --ignore-initial=0:$((512*4194264)) "$imgs/block-copy" "$imgs/zzz"
if systemd-detect-virt --quiet --container; then
echo "Skipping encrypt tests in container."
return
fi
# 6. Testing Format=/Encrypt=/CopyFiles=
cat >"$defs/extra3.conf" <<EOF
@ -423,6 +430,11 @@ EOF
test_copy_blocks() {
local defs imgs output
if systemd-detect-virt --quiet --container; then
echo "Skipping copy blocks tests in container."
return
fi
defs="$(mktemp --directory "/tmp/test-repart.XXXXXXXXXX")"
imgs="$(mktemp --directory "/var/tmp/test-repart.XXXXXXXXXX")"
# shellcheck disable=SC2064
@ -572,6 +584,11 @@ test_sector() {
local start size ratio
local sector="${1?}"
if systemd-detect-virt --quiet --container; then
echo "Skipping sector size tests in container."
return
fi
defs="$(mktemp --directory "/tmp/test-repart.XXXXXXXXXX")"
imgs="$(mktemp --directory "/var/tmp/test-repart.XXXXXXXXXX")"
# shellcheck disable=SC2064