src/test: add unittest for MemoryTHP=

This checks if the prctl is set correctly when the property name
is passed to systemd-run.
This commit is contained in:
Usama Arif
2026-01-06 03:26:15 -08:00
parent 32614b9aab
commit 4d16530b83
3 changed files with 86 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
set -o pipefail
systemd-run --wait \
/usr/lib/systemd/tests/unit-tests/manual/test-thp no-disable
systemd-run --wait \
-p MemoryTHP=disable \
/usr/lib/systemd/tests/unit-tests/manual/test-thp disable
# The following test will always return 77 if at compile time the kernel version
# is less than 6.18. If it happens don't let the whole test fail
set +e
systemd-run --wait \
-p MemoryTHP=madvise \
/usr/lib/systemd/tests/unit-tests/manual/test-thp madvise
if [ $? -eq 77 ]; then
exit 0
fi
set -e