]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-65-ANALYZE: add detailed test case for cat-config 35886/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Jan 2025 18:35:02 +0000 (03:35 +0900)
committerLuca Boccassi <bluca@debian.org>
Wed, 22 Jan 2025 20:43:16 +0000 (20:43 +0000)
test/units/TEST-65-ANALYZE.sh

index ac39c42da4847fc02a9ea00120cb2db99f5c78d4..ac4b220ed99fc454d27fa379a504e99540dd8ef4 100755 (executable)
@@ -202,6 +202,105 @@ systemd-analyze cat-config --tldr /etc/systemd/system.conf >/dev/null
 systemd-analyze cat-config --tldr systemd/system.conf systemd/journald.conf >/dev/null
 systemd-analyze cat-config --tldr systemd/system.conf foo/bar systemd/journald.conf >/dev/null
 systemd-analyze cat-config --tldr foo/bar
+mkdir -p /run/test-analyze-cat-config/main.conf.d
+cat >/run/test-analyze-cat-config/main.conf <<EOF
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU Lesser General Public License as published by the Free
+#  Software Foundation; either version 2.1 of the License, or (at your option)
+#  any later version.
+#
+# Entries in this file show the compile time defaults. Local configuration
+# should be created by either modifying this file (or a copy of it placed in
+# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
+# the /etc/systemd/networkd.conf.d/ directory. The latter is generally
+# recommended. Defaults can be restored by simply deleting the main
+# configuration file and all drop-ins located in /etc/.
+#
+# Use 'systemd-analyze cat-config systemd/networkd.conf' to display the full config.
+#
+# See networkd.conf(5) for details.
+
+[Network]
+#SpeedMeter=no
+#SpeedMeterIntervalSec=10sec
+#ManageForeignRoutingPolicyRules=yes
+#ManageForeignRoutes=yes
+#ManageForeignNextHops=yes
+#RouteTable=
+#IPv4Forwarding=
+#IPv6Forwarding=
+#IPv6PrivacyExtensions=no
+#UseDomains=no
+
+#[IPv6AddressLabel]
+#Prefix=
+#Label=
+
+[IPv6AcceptRA]
+#UseDomains=
+
+[DHCPv4]
+ClientIdentifier=duid
+#DUIDType=vendor
+#DUIDRawData=
+#UseDomains=
+
+[DHCPv6]
+#DUIDType=vendor
+#DUIDRawData=
+#UseDomains=
+
+[DHCPServer]
+PersistLeases=yes
+EOF
+cat >/run/test-analyze-cat-config/main.conf.d/override.conf <<EOF
+[DHCPServer]
+PersistLeases=no
+
+[Network]
+[Network]
+[Network]
+SpeedMeter=yes
+
+Continuation=foo \\
+             bar \\
+# comment
+             hogehoge \\
+             \\
+             aaa \\
+
+
+             bbb
+AAAA=bbbb
+EOF
+diff -u <(echo '# /run/test-analyze-cat-config/main.conf'
+          cat /run/test-analyze-cat-config/main.conf
+          echo
+          echo '# /run/test-analyze-cat-config/main.conf.d/override.conf'
+          cat /run/test-analyze-cat-config/main.conf.d/override.conf) \
+         <(systemd-analyze cat-config test-analyze-cat-config/main.conf)
+diff -u - <<EOF <(systemd-analyze --tldr cat-config test-analyze-cat-config/main.conf)
+# /run/test-analyze-cat-config/main.conf
+[DHCPv4]
+ClientIdentifier=duid
+[DHCPServer]
+PersistLeases=yes
+
+# /run/test-analyze-cat-config/main.conf.d/override.conf
+[DHCPServer]
+PersistLeases=no
+[Network]
+SpeedMeter=yes
+Continuation=foo \\
+             bar \\
+             hogehoge \\
+             aaa \\
+             bbb
+AAAA=bbbb
+EOF
+rm -rf /run/test-analyze-cat-config
 (! systemd-analyze cat-config --global systemd/system.conf)
 # security
 systemd-analyze security