]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Convert rlimit test to subtest of generic limit testing
authorMichal Koutný <mkoutny@suse.com>
Wed, 9 Aug 2023 20:42:36 +0000 (22:42 +0200)
committerMichal Koutný <mkoutny@suse.com>
Wed, 3 Jan 2024 12:37:58 +0000 (13:37 +0100)
No functional change intended. Preparation for new tests.

test/units/testsuite-05.rlimit.sh [new file with mode: 0755]
test/units/testsuite-05.service
test/units/testsuite-05.sh

diff --git a/test/units/testsuite-05.rlimit.sh b/test/units/testsuite-05.rlimit.sh
new file mode 100755 (executable)
index 0000000..bbf3adb
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: LGPL-2.1-or-later
+set -eux
+set -o pipefail
+
+P=/run/systemd/system.conf.d
+mkdir $P
+
+cat >$P/rlimits.conf <<EOF
+[Manager]
+DefaultLimitNOFILE=10000:16384
+EOF
+
+systemctl daemon-reload
+
+[[ "$(systemctl show -P DefaultLimitNOFILESoft)" = "10000" ]]
+[[ "$(systemctl show -P DefaultLimitNOFILE)" = "16384" ]]
+
+[[ "$(systemctl show -P LimitNOFILESoft testsuite-05.service)" = "10000" ]]
+[[ "$(systemctl show -P LimitNOFILE testsuite-05.service)" = "16384" ]]
+
+# shellcheck disable=SC2016
+systemd-run --wait -t bash -c '[[ "$(ulimit -n -S)" = "10000" ]]'
+# shellcheck disable=SC2016
+systemd-run --wait -t bash -c '[[ "$(ulimit -n -H)" = "16384" ]]'
index ab72d8fe27ad35f43c2ae9e35b9ddfc69dd300dc..cf32accb8c555b460d6d0c6f3fa9984d21006c8d 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 [Unit]
-Description=TEST-05-RLIMITS
+Description=TEST-05-LIMITS
 
 [Service]
 ExecStartPre=rm -f /failed /testok
index 870845d14bf42cd3105f16451826010161dee803..9c2a033aa98d17ce1517bf42cf30c31c187ab0ea 100755 (executable)
@@ -3,25 +3,9 @@
 set -eux
 set -o pipefail
 
-P=/run/systemd/system.conf.d
-mkdir $P
+# shellcheck source=test/units/test-control.sh
+. "$(dirname "$0")"/test-control.sh
 
-cat >$P/rlimits.conf <<EOF
-[Manager]
-DefaultLimitNOFILE=10000:16384
-EOF
-
-systemctl daemon-reload
-
-[[ "$(systemctl show -P DefaultLimitNOFILESoft)" = "10000" ]]
-[[ "$(systemctl show -P DefaultLimitNOFILE)" = "16384" ]]
-
-[[ "$(systemctl show -P LimitNOFILESoft testsuite-05.service)" = "10000" ]]
-[[ "$(systemctl show -P LimitNOFILE testsuite-05.service)" = "16384" ]]
-
-# shellcheck disable=SC2016
-systemd-run --wait -t bash -c '[[ "$(ulimit -n -S)" = "10000" ]]'
-# shellcheck disable=SC2016
-systemd-run --wait -t bash -c '[[ "$(ulimit -n -H)" = "16384" ]]'
+run_subtests
 
 touch /testok