diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/TEST-32-OOMPOLICY/test.sh | 16 | ||||
-rw-r--r-- | test/units/testsuite-32.service | 7 | ||||
-rwxr-xr-x | test/units/testsuite-32.sh (renamed from test/TEST-32-OOMPOLICY/testsuite.sh) | 12 |
3 files changed, 15 insertions, 20 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/units/testsuite-32.service b/test/units/testsuite-32.service new file mode 100644 index 0000000000..a868b46abf --- /dev/null +++ b/test/units/testsuite-32.service @@ -0,0 +1,7 @@ +[Unit] +Description=TEST-32-OOMPOLICY + +[Service] +ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh +Type=oneshot +MemoryAccounting=yes diff --git a/test/TEST-32-OOMPOLICY/testsuite.sh b/test/units/testsuite-32.sh index aafafc1183..6b899652e2 100755 --- a/test/TEST-32-OOMPOLICY/testsuite.sh +++ b/test/units/testsuite-32.sh @@ -8,17 +8,19 @@ set -o pipefail # 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 +if test -f /sys/fs/cgroup/system.slice/testsuite-32.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 + systemd-run --unit=oomtest.service \ + -p Type=exec -p OOMScoreAdjust=1000 -p OOMPolicy=stop -p MemoryAccounting=yes \ + sleep infinity # Trigger an OOM killer run - echo 1 > /proc/sys/kernel/sysrq - echo f > /proc/sysrq-trigger + echo 1 >/proc/sys/kernel/sysrq + echo f >/proc/sysrq-trigger while : ; do STATE=`systemctl show -p ActiveState --value oomtest.service` @@ -32,6 +34,6 @@ if test -f /sys/fs/cgroup/system.slice/testsuite.service/memory.oom.group ; then systemd-analyze log-level info fi -echo OK > /testok +echo OK >/testok exit 0 |