[v5,1/4] tests: Extend test_connectivity to check disconnection

Message ID 1489358178-7729-1-git-send-email-masashi.honma@gmail.com
State Superseded
Headers show

Commit Message

Masashi Honma March 12, 2017, 10:36 p.m.
Add success_expected argument to test_connectivity because the function
is expected to fail on some test cases.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 tests/hwsim/hwsim_utils.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Masashi Honma March 16, 2017, 2:41 a.m. | #1
On 2017/03/13 07:36, Masashi Honma wrote:
> Add success_expected argument to test_connectivity because the function
> is expected to fail on some test cases.
>
> Signed-off-by: Masashi Honma <masashi.honma@gmail.com>

Now we have wmediumd 0.3.1. Thanks Bob!

I could pass the almost tests.
Only wmediumd_simple failed one time, this is because the test
is based on probability.

wmediumd_simple		99/100
wmediumd_path_simple	100/100
wmediumd_path_ttl	100/100

So this patch set is ready to merge.

Masashi Honma.

Patch

diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index c74af2f..535220d 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -141,7 +141,7 @@  def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
 def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
                       dev1group=False, dev2group=False,
                       ifname1=None, ifname2=None, config=True, timeout=5,
-                      multicast_to_unicast=False):
+                      multicast_to_unicast=False, success_expected=True):
     if dscp:
         tos = dscp << 2
     if not tos:
@@ -161,7 +161,9 @@  def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
             last_err = e
             if i + 1 < max_tries:
                 time.sleep(1)
-    if not success:
+    if success_expected and not success:
+        raise Exception(last_err)
+    if not success_expected and success:
         raise Exception(last_err)
 
 def test_connectivity_iface(dev1, dev2, ifname, dscp=None, tos=None,