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

test: run script from /tmp, not /run

On Debian the test fails because /run is noexec. Simply create the
script in /tmp (and use a BindPath=), as other tests are doing.

Follow-up for 3b7101183cac4b35a8bd6ea2c1de9260c33f977f
This commit is contained in:
Luca Boccassi 2023-03-09 17:08:01 +00:00 committed by Luca Boccassi
parent f69edd6faf
commit 5c67a8a188

View File

@ -25,9 +25,7 @@ if ! test -f "$CGROUP"/memory.pressure ; then
fi
UNIT="test-mempress-$RANDOM.service"
SCRIPT="/run/bin/mempress-$RANDOM.sh"
mkdir -p "/run/bin"
SCRIPT="/tmp/mempress-$RANDOM.sh"
cat >"$SCRIPT" <<'EOF'
#!/bin/bash
@ -51,12 +49,10 @@ EOF
chmod +x "$SCRIPT"
systemd-run -u "$UNIT" -p Type=exec -p DynamicUser=1 -p MemoryPressureWatch=on -p MemoryPressureThresholdSec=123ms --wait "$SCRIPT"
systemd-run -u "$UNIT" -p Type=exec -p DynamicUser=1 -p MemoryPressureWatch=on -p MemoryPressureThresholdSec=123ms -p BindPaths=$SCRIPT --wait "$SCRIPT"
rm "$SCRIPT"
rmdir /run/bin ||:
systemd-analyze log-level info
echo OK >/testok