mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
support/testing: test_iproute2.py: use assertRunNotOk()
Use the helper to simplify the test. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
@@ -46,8 +46,7 @@ class TestIpRoute2(infra.basetest.BRTest):
|
|||||||
for addr in addrs:
|
for addr in addrs:
|
||||||
self.assertRunOk(f"{ping_cmd} {addr}")
|
self.assertRunOk(f"{ping_cmd} {addr}")
|
||||||
# ...but the IP outside is supposed to fail.
|
# ...but the IP outside is supposed to fail.
|
||||||
_, ret = self.emulator.run(f"{ping_cmd} 127.1.2.3")
|
self.assertRunNotOk(f"{ping_cmd} 127.1.2.3")
|
||||||
self.assertNotEqual(ret, 0)
|
|
||||||
|
|
||||||
# We add a prohibited route.
|
# We add a prohibited route.
|
||||||
self.assertRunOk("ip route add prohibit 127.0.1.0/24")
|
self.assertRunOk("ip route add prohibit 127.0.1.0/24")
|
||||||
@@ -57,8 +56,7 @@ class TestIpRoute2(infra.basetest.BRTest):
|
|||||||
# ...while the other IPs expected to fail.
|
# ...while the other IPs expected to fail.
|
||||||
addrs = ["127.0.1.2", "127.1.2.3"]
|
addrs = ["127.0.1.2", "127.1.2.3"]
|
||||||
for addr in addrs:
|
for addr in addrs:
|
||||||
_, ret = self.emulator.run(f"{ping_cmd} {addr}")
|
self.assertRunNotOk(f"{ping_cmd} {addr}")
|
||||||
self.assertNotEqual(ret, 0)
|
|
||||||
|
|
||||||
# We should be able to see our prohibited route.
|
# We should be able to see our prohibited route.
|
||||||
out, ret = self.emulator.run("ip route list")
|
out, ret = self.emulator.run("ip route list")
|
||||||
|
|||||||
Reference in New Issue
Block a user