All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v5 20/26] auto-t: fix testBSSBlacklist
Date: Thu, 10 Sep 2020 16:12:41 -0700	[thread overview]
Message-ID: <20200910231248.4995-20-prestwoj@gmail.com> (raw)
In-Reply-To: <20200910231248.4995-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5893 bytes --]

There were a number of fixes here. The waits were changed to wait
on the device state instead of the network state and hwsim rules
were removed after the test as to not interfere with future tests.
One of the rules was setting the signal to -10000 wich was causing
the ranking to be zero.
---
 .../testBSSBlacklist/all_blacklisted_test.py      | 11 ++++++++---
 autotests/testBSSBlacklist/bad_pass_test.py       |  8 +++++++-
 autotests/testBSSBlacklist/connection_test.py     |  9 +++++++--
 autotests/testBSSBlacklist/temp_blacklist_test.py | 15 ++++++++++++++-
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/autotests/testBSSBlacklist/all_blacklisted_test.py b/autotests/testBSSBlacklist/all_blacklisted_test.py
index 099804a8..d3ed7acc 100644
--- a/autotests/testBSSBlacklist/all_blacklisted_test.py
+++ b/autotests/testBSSBlacklist/all_blacklisted_test.py
@@ -37,7 +37,7 @@ class Test(unittest.TestCase):
         rule2 = hwsim.rules.create()
         rule2.source = bss_radio[2].addresses[0]
         rule2.bidirectional = True
-        rule2.signal = -10000
+        rule2.signal = -9000
 
         wd = IWD(True)
 
@@ -72,17 +72,22 @@ class Test(unittest.TestCase):
 
         rule0.drop = False
         rule1.drop = False
+        rule2.drop = False
 
         # This connect should work
         ordered_network.network_object.connect()
 
-        condition = 'obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(device, condition)
 
         self.assertIn(device.address, bss_hostapd[0].list_sta())
 
         wd.unregister_psk_agent(psk_agent)
 
+        rule0.remove()
+        rule1.remove()
+        rule2.remove()
+
     @classmethod
     def setUpClass(cls):
         pass
diff --git a/autotests/testBSSBlacklist/bad_pass_test.py b/autotests/testBSSBlacklist/bad_pass_test.py
index 220ffcc8..b2ceb998 100644
--- a/autotests/testBSSBlacklist/bad_pass_test.py
+++ b/autotests/testBSSBlacklist/bad_pass_test.py
@@ -39,7 +39,7 @@ class Test(unittest.TestCase):
         rule2.bidirectional = True
         rule2.signal = -4000
 
-        wd = IWD(True, '/tmp')
+        wd = IWD(True)
 
         psk_agent = PSKAgent("wrong_password")
         wd.register_psk_agent(psk_agent)
@@ -80,6 +80,12 @@ class Test(unittest.TestCase):
         condition = 'obj.connected'
         wd.wait_for_object_condition(ordered_network.network_object, condition)
 
+        wd.unregister_psk_agent(psk_agent)
+
+        rule0.remove()
+        rule1.remove()
+        rule2.remove()
+
     @classmethod
     def setUpClass(cls):
         pass
diff --git a/autotests/testBSSBlacklist/connection_test.py b/autotests/testBSSBlacklist/connection_test.py
index 0a51b8cb..8083fc92 100644
--- a/autotests/testBSSBlacklist/connection_test.py
+++ b/autotests/testBSSBlacklist/connection_test.py
@@ -10,7 +10,6 @@ from iwd import PSKAgent
 from iwd import NetworkType
 
 from hostapd import HostapdCLI
-
 from hwsim import Hwsim
 
 import time
@@ -42,7 +41,7 @@ class Test(unittest.TestCase):
         rule2.bidirectional = True
         rule2.signal = -4000
 
-        wd = IWD(True, '/tmp')
+        wd = IWD(True)
 
         psk_agent = PSKAgent("secret123")
         wd.register_psk_agent(psk_agent)
@@ -67,6 +66,8 @@ class Test(unittest.TestCase):
         condition = 'not obj.connected'
         wd.wait_for_object_condition(ordered_network.network_object, condition)
 
+        rule0.drop = True
+
         ordered_network.network_object.connect(wait=False)
 
         # Have AP1 drop all packets, should result in a connection timeout
@@ -140,6 +141,10 @@ class Test(unittest.TestCase):
 
         wd.unregister_psk_agent(psk_agent)
 
+        rule0.remove()
+        rule1.remove()
+        rule2.remove()
+
     @classmethod
     def setUpClass(cls):
         IWD.copy_to_storage('main.conf')
diff --git a/autotests/testBSSBlacklist/temp_blacklist_test.py b/autotests/testBSSBlacklist/temp_blacklist_test.py
index b2b57035..2a9590b8 100644
--- a/autotests/testBSSBlacklist/temp_blacklist_test.py
+++ b/autotests/testBSSBlacklist/temp_blacklist_test.py
@@ -39,7 +39,7 @@ class Test(unittest.TestCase):
         rule2.bidirectional = True
         rule2.signal = -2000
 
-        wd = IWD(True, '/tmp')
+        wd = IWD(True)
 
         psk_agent = PSKAgent("secret123")
         wd.register_psk_agent(psk_agent)
@@ -63,6 +63,9 @@ class Test(unittest.TestCase):
 
         ordered_network.network_object.connect()
 
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(dev1, condition)
+
         self.assertIn(dev1.address, bss_hostapd[2].list_sta())
 
         # dev1 now connected, this should max out the first AP, causing the next
@@ -85,6 +88,9 @@ class Test(unittest.TestCase):
 
         ordered_network.network_object.connect()
 
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(dev2, condition)
+
         # We should have temporarily blacklisted the first BSS, and connected
         # to this one.
         self.assertIn(dev2.address, bss_hostapd[1].list_sta())
@@ -111,10 +117,17 @@ class Test(unittest.TestCase):
 
         ordered_network.network_object.connect()
 
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(dev2, condition)
+
         self.assertIn(dev2.address, bss_hostapd[2].list_sta())
 
         wd.unregister_psk_agent(psk_agent)
 
+        rule0.remove()
+        rule1.remove()
+        rule2.remove()
+
     @classmethod
     def setUpClass(cls):
         IWD.copy_to_storage('main.conf')
-- 
2.26.2

  parent reply	other threads:[~2020-09-10 23:12 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 23:12 [PATCH v5 01/26] auto-t: prepare autotests for test-runner re-write James Prestwood
2020-09-10 23:12 ` [PATCH v5 02/26] auto-t: introduce pure python " James Prestwood
2020-09-10 23:12 ` [PATCH v5 03/26] auto-t: hostapd.py: update to work with test-runner rewrite James Prestwood
2020-09-10 23:12 ` [PATCH v5 04/26] auto-t: testutil.py: " James Prestwood
2020-09-10 23:12 ` [PATCH v5 05/26] auto-t: ofono.py: fix timeout cleanup and wait for service James Prestwood
2020-09-10 23:12 ` [PATCH v5 06/26] auto-t: iwd.py: update to work with test-runner rewrite James Prestwood
2020-09-10 23:12 ` [PATCH v5 07/26] auto-t: remove wiphy.py James Prestwood
2020-09-10 23:12 ` [PATCH v5 08/26] auto-t: fix hidden network test James Prestwood
2020-09-10 23:12 ` [PATCH v5 09/26] auto-t: fix testSAE autoconnect_test.py James Prestwood
2020-09-10 23:12 ` [PATCH v5 10/26] auto-t: skip ofono tests if ofonod isn't running James Prestwood
2020-09-10 23:12 ` [PATCH v5 11/26] auto-t: replace hard-coded interfaces James Prestwood
2020-09-10 23:12 ` [PATCH v5 12/26] auto-t: remove device.wait_for_connected James Prestwood
2020-09-10 23:12 ` [PATCH v5 13/26] tools: post test-runner rewrite cleanup James Prestwood
2020-09-10 23:12 ` [PATCH v5 14/26] doc: update test runner docs James Prestwood
2020-09-10 23:12 ` [PATCH v5 15/26] auto-t: hwsim: wait for method return James Prestwood
2020-09-10 23:12 ` [PATCH v5 16/26] auto-t: Increase all test timeouts James Prestwood
2020-09-10 23:12 ` [PATCH v5 17/26] auto-t: fix SAE FT test and update James Prestwood
2020-09-10 23:12 ` [PATCH v5 18/26] auto-t: update testClientNonInteractive to use TestContext James Prestwood
2020-09-10 23:12 ` [PATCH v5 19/26] auto-t: update testAgent " James Prestwood
2020-09-10 23:12 ` James Prestwood [this message]
2020-09-10 23:12 ` [PATCH v5 21/26] auto-t: fix testAP James Prestwood
2020-09-10 23:12 ` [PATCH v5 22/26] auto-t: fix testAPRoam James Prestwood
2020-09-10 23:12 ` [PATCH v5 23/26] auto-t: harden testHotspot James Prestwood
2020-09-10 23:12 ` [PATCH v5 24/26] auto-t: fix testWPA2 to wait for device object James Prestwood
2020-09-10 23:12 ` [PATCH v5 25/26] auto-t: fix testPreauth-roam James Prestwood
2020-09-10 23:12 ` [PATCH v5 26/26] auto-t: fix testFT-PSK-roam James Prestwood
2020-09-10 23:21 ` [PATCH v5 01/26] auto-t: prepare autotests for test-runner re-write Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200910231248.4995-20-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.