Files
archy/scripts/test-radio-owner-isolated.sh
T

27 lines
1.2 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
repo=$(realpath "$(dirname "$0")/..")
artifact=()
fixture=radio-owner.py
if [[ $# == 1 ]]; then
if [[ $1 == --retirement ]]; then
fixture=radio-owner-retirement.py
elif [[ $1 == --handoff ]]; then
fixture=radio-handoff.py
artifact=(--property=Delegate=yes --property=DelegateSubgroup=supervisor)
else
[[ -f "$1/archy-rnodeconf" ]] || exit 2
artifact=("--property=BindReadOnlyPaths=$(realpath "$1"):/opt/radio-artifact" --setenv=ARCHY_RADIO_FROZEN=1)
fi
fi
sudo -n systemd-run --unit="archy-radio-fixture-$$" --wait --pipe --collect \
--property=CPUQuota=200% --property=MemoryMax=8G --property=MemorySwapMax=0 \
--property=PrivateNetwork=yes --property=PrivateDevices=yes --property=PrivateTmp=no \
--property=ProtectSystem=strict --property=ProtectHome=read-only \
--property='ReadWritePaths=/sys/fs/cgroup' \
--property='TemporaryFileSystem=/run:rw /tmp:rw,size=512M /var/tmp:rw /root:rw /var/lib/archipelago:rw /var/lib/archipelago-radio-work:rw,size=256M,mode=700' \
--setenv=ARCHY_RADIO_FIXTURE=1 \
"${artifact[@]}" \
/usr/bin/unshare --pid --fork --mount-proc --kill-child \
/usr/bin/python3 -B "$repo/tests/regression/$fixture"