summaryrefslogtreecommitdiffstats
path: root/test/TEST-55-OOMD/test.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:35:18 +0000
commitb750101eb236130cf056c675997decbac904cc49 (patch)
treea5df1a06754bdd014cb975c051c83b01c9a97532 /test/TEST-55-OOMD/test.sh
parentInitial commit. (diff)
downloadsystemd-b750101eb236130cf056c675997decbac904cc49.tar.xz
systemd-b750101eb236130cf056c675997decbac904cc49.zip
Adding upstream version 252.22.upstream/252.22upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/TEST-55-OOMD/test.sh')
-rwxr-xr-xtest/TEST-55-OOMD/test.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/TEST-55-OOMD/test.sh b/test/TEST-55-OOMD/test.sh
new file mode 100755
index 0000000..b1ab7c4
--- /dev/null
+++ b/test/TEST-55-OOMD/test.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -e
+
+TEST_DESCRIPTION="systemd-oomd Memory Pressure Test"
+IMAGE_NAME="oomd"
+
+# Need to set up swap
+TEST_NO_NSPAWN=1
+
+# shellcheck source=test/test-functions
+. "${TEST_BASE_DIR:?}/test-functions"
+
+test_append_files() {
+ # Create a swap file
+ (
+ image_install mkswap swapon swapoff stress
+
+ dd if=/dev/zero of="${initdir:?}/swapfile" bs=1M count=48
+ chmod 0600 "${initdir:?}/swapfile"
+
+ mkdir -p "${initdir:?}/etc/systemd/system/init.scope.d/"
+ cat >>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <<EOF
+[Scope]
+MemoryHigh=10G
+EOF
+ )
+}
+
+do_test "$@" 55