1#!/usr/bin/env bash
2# SPDX-License-Identifier: LGPL-2.1-or-later
3set -eux
4set -o pipefail
5
6P=/run/systemd/system.conf.d
7mkdir $P
8
9cat >$P/rlimits.conf <<EOF
10[Manager]
11DefaultLimitNOFILE=10000:16384
12EOF
13
14systemctl daemon-reload
15
16[[ "$(systemctl show -P DefaultLimitNOFILESoft)" = "10000" ]]
17[[ "$(systemctl show -P DefaultLimitNOFILE)" = "16384" ]]
18
19[[ "$(systemctl show -P LimitNOFILESoft testsuite-05.service)" = "10000" ]]
20[[ "$(systemctl show -P LimitNOFILE testsuite-05.service)" = "16384" ]]
21
22# shellcheck disable=SC2016
23systemd-run --wait -t bash -c '[[ "$(ulimit -n -S)" = "10000" ]]'
24# shellcheck disable=SC2016
25systemd-run --wait -t bash -c '[[ "$(ulimit -n -H)" = "16384" ]]'
26
27touch /testok
28