summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-05-17 15:54:50 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-05-19 05:29:25 +0900
commit4b3cf93507ce81fdeee0441e8930b440d139fa22 (patch)
tree26744e14bb3fa1a0340b4e36729b20d412f1ef5a /test
parent3ccf7af08720f4830f2cd41193675fdc35a707e8 (diff)
downloadsystemd-4b3cf93507ce81fdeee0441e8930b440d139fa22.tar.gz
test-network: remove unnecessary links
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py34
1 files changed, 16 insertions, 18 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index b06fbc2b70..09d7397708 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -72,31 +72,29 @@ def expectedFailureIfRoutingPolicyIPProtoIsNotAvailable():
def expectedFailureIf_ip6gre_do_not_support_ipv6ll():
def f(func):
+ success = False
rc = subprocess.call(['ip', 'link', 'add', 'name', 'test1', 'type', 'dummy'])
- if rc != 0:
- return unittest.expectedFailure(func)
+ if rc == 0:
+ time.sleep(1)
+ rc = subprocess.call(['ip', 'tunnel', 'add', 'tun99', 'local', '2a00:ffde:4567:edde::4986', 'remote', '2001:473:fece:cafe::5178', 'mode', 'ip6gre', 'dev', 'test1'])
+ if rc == 0:
+ time.sleep(1)
+ # Not sure why, but '0' or '2' do not work.
+ subprocess.call(['sysctl', '-w', 'net.ipv6.conf.tun99.addr_gen_mode=3'])
- time.sleep(1)
- rc = subprocess.call(['ip', 'tunnel', 'add', 'tun99', 'local', '2a00:ffde:4567:edde::4986', 'remote', '2001:473:fece:cafe::5178', 'mode', 'ip6gre', 'dev', 'test1'])
- if rc != 0:
- return unittest.expectedFailure(func)
+ output = subprocess.check_output(['ip', '-6', 'address', 'show', 'dev', 'tun99', 'scope', 'link'], universal_newlines=True).rstrip()
+ print(output)
+ success = 'inet6' in output
- time.sleep(1)
- # Not sure why, but '0' or '2' do not work.
- rc = subprocess.call(['sysctl', '-w', 'net.ipv6.conf.tun99.addr_gen_mode=3'])
- if rc != 0:
- return unittest.expectedFailure(func)
+ subprocess.run(['ip', 'tunnel', 'del', 'tun99'])
- time.sleep(1)
- rc = subprocess.run(['ip', '-6', 'address', 'show', 'dev', 'tun99', 'scope', 'link'], stdout=subprocess.PIPE)
- if rc.returncode != 0:
- return unittest.expectedFailure(func)
+ subprocess.run(['ip', 'link', 'del', 'test1'])
- if 'inet6' not in rc.stdout.rstrip().decode('utf-8'):
+ if success:
+ return func
+ else:
return unittest.expectedFailure(func)
- return func
-
return f
def setUpModule():