]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-75-RESOLVED: use SYSTEMD_INVOKED_AS=resolvconf 42286/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Mon, 25 May 2026 09:23:37 +0000 (11:23 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Mon, 25 May 2026 10:37:36 +0000 (12:37 +0200)
test/units/TEST-75-RESOLVED.sh

index 03e50db7b32ec92c927a36c13936f8089d6033eb..abc6b0d8ac601727d838068f67863d00f591052f 100755 (executable)
@@ -248,19 +248,14 @@ manual_testcase_01_resolvectl() {
     resolvectl dns hoge.foo 10.0.1.3 10.0.1.4
     assert_in '10.0.1.1 10.0.1.2' "$(resolvectl dns hoge)"
     assert_in '10.0.1.3 10.0.1.4' "$(resolvectl dns hoge.foo)"
-    if ! RESOLVCONF=$(command -v resolvconf 2>/dev/null); then
-        TMPDIR=$(mktemp -d -p /tmp resolvconf-tests.XXXXXX)
-        RESOLVCONF="$TMPDIR"/resolvconf
-        ln -s "$(command -v resolvectl 2>/dev/null)" "$RESOLVCONF"
-    fi
 
     # DNS servers
-    echo nameserver 10.0.2.1 10.0.2.2 | "$RESOLVCONF" -a hoge
-    echo nameserver 10.0.2.3 10.0.2.4 | "$RESOLVCONF" -a hoge.foo
+    echo nameserver 10.0.2.1 10.0.2.2 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge
+    echo nameserver 10.0.2.3 10.0.2.4 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge.foo
     assert_in '10.0.2.1 10.0.2.2' "$(resolvectl dns hoge)"
     assert_in '10.0.2.3 10.0.2.4' "$(resolvectl dns hoge.foo)"
-    echo nameserver 10.0.3.1 10.0.3.2 | "$RESOLVCONF" -a hoge.inet.ipsec.192.168.35
-    echo nameserver 10.0.3.3 10.0.3.4 | "$RESOLVCONF" -a hoge.foo.dhcp
+    echo nameserver 10.0.3.1 10.0.3.2 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge.inet.ipsec.192.168.35
+    echo nameserver 10.0.3.3 10.0.3.4 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge.foo.dhcp
     assert_in '10.0.3.1 10.0.3.2' "$(resolvectl dns hoge)"
     assert_in '10.0.3.3 10.0.3.4' "$(resolvectl dns hoge.foo)"
 
@@ -268,36 +263,37 @@ manual_testcase_01_resolvectl() {
     # without domain/search clears existing domain
     resolvectl domain hoge test-domain.example.com
     assert_in 'test-domain.example.com' "$(resolvectl domain hoge)"
-    echo nameserver 10.0.2.1 10.0.2.2 | "$RESOLVCONF" -a hoge
+    echo nameserver 10.0.2.1 10.0.2.2 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge
     assert_not_in 'test-domain.example.com' "$(resolvectl domain hoge)"
     # cannot set domain without DNS servers
-    (! echo domain test-domain.example.com | "$RESOLVCONF" -a hoge)
+    (! echo domain test-domain.example.com | SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge)
     # can set domain with DNS server(s)
-    echo -e "nameserver 10.0.2.1 10.0.2.2\ndomain test-domain1.example.com test-domain2.example.com\nsearch test-search-domain.example.com" | "$RESOLVCONF" -a hoge
+    echo -e "nameserver 10.0.2.1 10.0.2.2\ndomain test-domain1.example.com test-domain2.example.com\nsearch test-search-domain.example.com" | \
+        SYSTEMD_INVOKED_AS=resolvconf resolvectl -a hoge
     assert_in 'test-domain1.example.com' "$(resolvectl domain hoge)"
     assert_in 'test-domain2.example.com' "$(resolvectl domain hoge)"
     assert_in 'test-search-domain.example.com' "$(resolvectl domain hoge)"
 
     # Tests for 'resolvconf -x'
-    echo nameserver 10.0.2.1 | "$RESOLVCONF" -x -a hoge
+    echo nameserver 10.0.2.1 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -x -a hoge
     assert_in '~.' "$(resolvectl domain hoge)"
     resolvectl domain hoge "hoge.example.com"
     assert_in 'hoge.example.com' "$(resolvectl domain hoge)"
     assert_not_in '~.' "$(resolvectl domain hoge)"
-    echo -e "nameserver 10.0.2.1\ndomain test-domain.example.com" | "$RESOLVCONF" -x -a hoge
+    echo -e "nameserver 10.0.2.1\ndomain test-domain.example.com" | SYSTEMD_INVOKED_AS=resolvconf resolvectl -x -a hoge
     assert_in 'test-domain.example.com' "$(resolvectl domain hoge)"
     assert_in '~.' "$(resolvectl domain hoge)"
 
     # Tests for 'resolvconf -p'
     resolvectl default-route hoge yes
     assert_in 'yes' "$(resolvectl default-route hoge)"
-    echo nameserver 10.0.3.3 10.0.3.4 | "$RESOLVCONF" -p -a hoge
+    echo nameserver 10.0.3.3 10.0.3.4 | SYSTEMD_INVOKED_AS=resolvconf resolvectl -p -a hoge
     assert_in 'no' "$(resolvectl default-route hoge)"
 
     # Tests for 'resolvconf -d'
     resolvectl dns hoge 10.0.3.1 10.0.3.2
     resolvectl domain hoge test-domain.example.com
-    "$RESOLVCONF" -d hoge
+    SYSTEMD_INVOKED_AS=resolvconf resolvectl -d hoge
     assert_not_in '10.0.3.1' "$(resolvectl dns hoge)"
     assert_not_in '10.0.3.2' "$(resolvectl dns hoge)"
     assert_not_in 'test-domain.example.com' "$(resolvectl domain hoge)"