]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-execute: simplify the tests for PrivateNetwork=
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 3 Mar 2023 17:47:19 +0000 (02:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 3 Mar 2023 17:49:13 +0000 (02:49 +0900)
If an exotic network driver is loaded, there may exist an unexpected
network interface.

test/test-execute/exec-privatenetwork-yes-privatemounts-no.service
test/test-execute/exec-privatenetwork-yes-privatemounts-yes.service

index 7fbd0ff023db59340b7a87b324afc43f5df94fc3..83708df830db697d79155ac96dbe97af73a6da10 100644 (file)
@@ -3,8 +3,7 @@
 Description=Test for PrivateNetwork= without mount namespacing
 
 [Service]
-ExecStart=/bin/sh -x -c '! ip link | grep -E "^[0-9]+: " | grep -Ev ": (lo|(erspan|gre|gretap|ip_vti|ip6_vti|ip6gre|ip6tnl|sit|tunl)0@.*):"'
-ExecStart=/bin/sh -x -c '! ip link | grep -E "^[0-9]+: " | grep -F ": dummy-test-exec:"'
+ExecStart=/bin/sh -x -c '! ip link show dummy-test-exec'
 ExecStart=/bin/sh -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
 # Without mount namespacing, we can access the dummy-test-exec interface through sysfs
 ExecStart=/bin/sh -x -c 'test -d /sys/class/net/dummy-test-exec'
index eda48499fb5af4a1591fd6abad73fd51897f3442..874f10084ef1b31d0dbb7d774b17349082a44682 100644 (file)
@@ -3,8 +3,7 @@
 Description=Test for PrivateNetwork= with mount namespacing
 
 [Service]
-ExecStart=/bin/sh -x -c '! ip link | grep -E "^[0-9]+: " | grep -Ev ": (lo|(erspan|gre|gretap|ip_vti|ip6_vti|ip6gre|ip6tnl|sit|tunl)0@.*):"'
-ExecStart=/bin/sh -x -c '! ip link | grep -E "^[0-9]+: " | grep -F ": dummy-test-exec:"'
+ExecStart=/bin/sh -x -c '! ip link show dummy-test-exec'
 ExecStart=/bin/sh -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
 # With mount namespacing, we cannot access the dummy-test-exec interface through sysfs.
 ExecStart=/bin/sh -x -c 'test ! -e /sys/class/net/dummy-test-exec'