summaryrefslogtreecommitdiff
path: root/test/TEST-32-OOMPOLICY
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-12-10 09:43:14 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-28 11:46:47 +0100
commitc8937bed08701875e4c1540ffb28a0d34243b94c (patch)
treee35b7240d0f941b5daceb34b3c1374859be8fd50 /test/TEST-32-OOMPOLICY
parent048d52d51ee5413b2376cfa21ec153510c7e766b (diff)
downloadsystemd-c8937bed08701875e4c1540ffb28a0d34243b94c.tar.gz
test: move TEST-32-OOMPOLICY setup to static files
Diffstat (limited to 'test/TEST-32-OOMPOLICY')
-rwxr-xr-xtest/TEST-32-OOMPOLICY/test.sh16
-rwxr-xr-xtest/TEST-32-OOMPOLICY/testsuite.sh37
2 files changed, 1 insertions, 52 deletions
diff --git a/test/TEST-32-OOMPOLICY/test.sh b/test/TEST-32-OOMPOLICY/test.sh
index 36aad419ea..32fac7a289 100755
--- a/test/TEST-32-OOMPOLICY/test.sh
+++ b/test/TEST-32-OOMPOLICY/test.sh
@@ -16,21 +16,7 @@ test_setup() {
setup_basic_environment
mask_supporting_services
-
- # setup the testsuite service
- cat >$initdir/etc/systemd/system/testsuite.service <<EOF
-[Unit]
-Description=Testsuite service
-
-[Service]
-ExecStart=/testsuite.sh
-Type=oneshot
-MemoryAccounting=yes
-EOF
- cp testsuite.sh $initdir/
-
- setup_testsuite
)
}
-do_test "$@"
+do_test "$@" 32
diff --git a/test/TEST-32-OOMPOLICY/testsuite.sh b/test/TEST-32-OOMPOLICY/testsuite.sh
deleted file mode 100755
index aafafc1183..0000000000
--- a/test/TEST-32-OOMPOLICY/testsuite.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-set -ex
-set -o pipefail
-
-# Let's run this test only if the "memory.oom.group" cgroupfs attribute
-# exists. This test is a bit too strict, since the "memory.events"/"oom_kill"
-# logic has been around since a longer time than "memory.oom.group", but it's
-# an easier thing to test for, and also: let's not get confused by older
-# kernels where the concept was still new.
-
-if test -f /sys/fs/cgroup/system.slice/testsuite.service/memory.oom.group ; then
-
- systemd-analyze log-level debug
- systemd-analyze log-target console
-
- # Run a service that is guaranteed to be the first candidate for OOM killing
- systemd-run --unit=oomtest.service -p Type=exec -p OOMScoreAdjust=1000 -p OOMPolicy=stop -p MemoryAccounting=yes /bin/sleep infinity
-
- # Trigger an OOM killer run
- echo 1 > /proc/sys/kernel/sysrq
- echo f > /proc/sysrq-trigger
-
- while : ; do
- STATE=`systemctl show -p ActiveState --value oomtest.service`
- [ "$STATE" = "failed" ] && break
- sleep .5
- done
-
- RESULT=`systemctl show -p Result --value oomtest.service`
- test "$RESULT" = "oom-kill"
-
- systemd-analyze log-level info
-fi
-
-echo OK > /testok
-
-exit 0