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 3b7101183c
This commit is contained in:
Luca Boccassi
2023-03-10 11:01:22 +00:00
committed by Luca Boccassi
parent f69edd6faf
commit 5c67a8a188
+2 -6
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