diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-17 21:56:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 21:56:15 +0900 |
commit | 0161378cf76e0df7133b362a25fdde1be31767e9 (patch) | |
tree | 9d7e05255d614556f8558c8155382a21499ab8f5 /test | |
parent | 59edcf2b645c88de4576bfd02f55340a9e131136 (diff) | |
parent | fa9bd369378d1edfa5c44bc54309b0a7cc601902 (diff) | |
download | systemd-0161378cf76e0df7133b362a25fdde1be31767e9.tar.gz |
Merge pull request #24333 from yuwata/sysctl
sysctl: improve performance for applying glob pattern
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/testsuite-76.sh | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/test/units/testsuite-76.sh b/test/units/testsuite-76.sh index 6ebdbc6a54..cb571f8b97 100755 --- a/test/units/testsuite-76.sh +++ b/test/units/testsuite-76.sh @@ -3,14 +3,37 @@ set -eux set -o pipefail +# shellcheck source=test/units/assert.sh +. "$(dirname "$0")"/assert.sh + export SYSTEMD_LOG_LEVEL=debug -echo "foo.bar=42" > /etc/sysctl.d/foo.conf -[[ $(/usr/lib/systemd/systemd-sysctl /etc/sysctl.d/foo.conf)$? -eq 0 ]] -[[ $(/usr/lib/systemd/systemd-sysctl --strict /etc/sysctl.d/foo.conf)$? -ne 0 ]] +echo "foo.bar=42" > /tmp/foo.conf +assert_rc 0 /usr/lib/systemd/systemd-sysctl /tmp/foo.conf +assert_rc 1 /usr/lib/systemd/systemd-sysctl --strict /tmp/foo.conf + +echo "-foo.foo=42" > /tmp/foo.conf +assert_rc 0 /usr/lib/systemd/systemd-sysctl /tmp/foo.conf +assert_rc 0 /usr/lib/systemd/systemd-sysctl --strict /tmp/foo.conf + +if ! systemd-detect-virt --quiet --container; then + ip link add hoge type dummy + udevadm wait /sys/class/net/hoge + + cat >/tmp/foo.conf <<EOF +net.ipv4.conf.*.drop_gratuitous_arp=1 +net.ipv4.*.*.bootp_relay=1 +net.ipv4.aaa.*.disable_policy=1 +EOF + + echo 0 > /proc/sys/net/ipv4/conf/hoge/drop_gratuitous_arp + echo 0 > /proc/sys/net/ipv4/conf/hoge/bootp_relay + echo 0 > /proc/sys/net/ipv4/conf/hoge/disable_policy -echo "-foo.foo=42" > /etc/sysctl.d/foo.conf -[[ $(/usr/lib/systemd/systemd-sysctl /etc/sysctl.d/foo.conf)$? -eq 0 ]] -[[ $(/usr/lib/systemd/systemd-sysctl --strict /etc/sysctl.d/foo.conf)$? -eq 0 ]] + assert_rc 0 /usr/lib/systemd/systemd-sysctl --prefix=/net/ipv4/conf/hoge /tmp/foo.conf + assert_eq "$(cat /proc/sys/net/ipv4/conf/hoge/drop_gratuitous_arp)" "1" + assert_eq "$(cat /proc/sys/net/ipv4/conf/hoge/bootp_relay)" "1" + assert_eq "$(cat /proc/sys/net/ipv4/conf/hoge/disable_policy)" "0" +fi touch /testok |