commit 8d8ea67da1f4815f4ae29060433ccc15008b5088
parent 8e68e73c43b94e265810592c1ab881de91ce8575
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 21 May 2021 11:44:55 -0500
auto-t: Change FT test cases to use start_iwd=0
These test cases depend on setting up the existing hostapd instance to a
set of known addresses, which might be different from what test-runner
sets. During this time, any scans might result in the old and the new
addresses used by hostapd to be found in the scan results.
Fix that by using start_iwd=0 which tells test_runner that the test
wants to start iwd itself. This delays starting iwd until after the
setUpClass routine has been called and hostapd configured properly.
Also use more sensible rssi values for the 'non-preferred' bss.
Otherwise, ranking BSSes by throughput can confuse the test logic
since both BSSes are ranked the same and either can be picked by
autoconnect.
Diffstat:
10 files changed, 40 insertions(+), 77 deletions(-)
diff --git a/autotests/testFT-8021x-roam/connection_test.py b/autotests/testFT-8021x-roam/connection_test.py
@@ -23,13 +23,13 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
- wd = IWD()
-
- device = wd.list_devices(1)[0]
-
# Check that iwd selects BSS 0 first
rule0.signal = -2000
- rule1.signal = -2500
+ rule1.signal = -6900
+
+ wd = IWD(True)
+
+ device = wd.list_devices(1)[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@@ -97,16 +97,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
- wd = IWD()
- device = wd.list_devices(1)[0]
- try:
- device.disconnect()
- except:
- pass
-
- condition = 'obj.state == DeviceState.disconnected'
- wd.wait_for_object_condition(device, condition)
-
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@@ -128,7 +118,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
+ cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
+ cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd
diff --git a/autotests/testFT-8021x-roam/hw.conf b/autotests/testFT-8021x-roam/hw.conf
@@ -1,5 +1,6 @@
[SETUP]
num_radios=3
+start_iwd=0
[HOSTAPD]
rad0=ft-eap-ccmp-1.conf
diff --git a/autotests/testFT-FILS-SHA256/connection_test.py b/autotests/testFT-FILS-SHA256/connection_test.py
@@ -24,7 +24,11 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
- wd = IWD()
+ # Check that iwd selects BSS 0 first
+ rule0.signal = -2000
+ rule1.signal = -6900
+
+ wd = IWD(True)
psk_agent = PSKAgent('user@example.com', ('user@example.com',
'secret123'))
@@ -32,10 +36,6 @@ class Test(unittest.TestCase):
device = wd.list_devices(1)[0]
- # Check that iwd selects BSS 0 first
- rule0.signal = -2000
- rule1.signal = -2500
-
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@@ -127,16 +127,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
- wd = IWD()
- device = wd.list_devices(1)[0]
- try:
- device.disconnect()
- except:
- pass
-
- condition = 'obj.state == DeviceState.disconnected'
- wd.wait_for_object_condition(device, condition)
-
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@@ -159,7 +149,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
+ cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
+ cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd
diff --git a/autotests/testFT-FILS-SHA256/hw.conf b/autotests/testFT-FILS-SHA256/hw.conf
@@ -1,5 +1,6 @@
[SETUP]
num_radios=3
+start_iwd=0
[HOSTAPD]
rad0=ft-eap-ccmp-1.conf
diff --git a/autotests/testFT-FILS-SHA384/connection_test.py b/autotests/testFT-FILS-SHA384/connection_test.py
@@ -24,7 +24,11 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
- wd = IWD()
+ # Check that iwd selects BSS 0 first
+ rule0.signal = -2000
+ rule1.signal = -6900
+
+ wd = IWD(True)
psk_agent = PSKAgent('user@example.com', ('user@example.com',
'secret123'))
@@ -32,10 +36,6 @@ class Test(unittest.TestCase):
device = wd.list_devices(1)[0]
- # Check that iwd selects BSS 0 first
- rule0.signal = -2000
- rule1.signal = -2500
-
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@@ -127,16 +127,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
- wd = IWD()
- device = wd.list_devices(1)[0]
- try:
- device.disconnect()
- except:
- pass
-
- condition = 'obj.state == DeviceState.disconnected'
- wd.wait_for_object_condition(device, condition)
-
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@@ -159,7 +149,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
+ cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
+ cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd
diff --git a/autotests/testFT-FILS-SHA384/hw.conf b/autotests/testFT-FILS-SHA384/hw.conf
@@ -1,5 +1,6 @@
[SETUP]
num_radios=3
+start_iwd=0
[HOSTAPD]
rad0=ft-eap-ccmp-1.conf
diff --git a/autotests/testFT-PSK-over-DS/connection_test.py b/autotests/testFT-PSK-over-DS/connection_test.py
@@ -24,17 +24,17 @@ class Test(unittest.TestCase):
rule1.source = self.bss_radio[1].addresses[0]
rule1.bidirectional = True
- wd = IWD()
+ # Check that iwd selects BSS 0 first
+ rule0.signal = -2000
+ rule1.signal = -6900
+
+ wd = IWD(True)
psk_agent = PSKAgent("EasilyGuessedPassword")
wd.register_psk_agent(psk_agent)
device = wd.list_devices(1)[0]
- # Check that iwd selects BSS 0 first
- rule0.signal = -2000
- rule1.signal = -2500
-
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@@ -108,16 +108,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
hwsim = Hwsim()
- wd = IWD()
- device = wd.list_devices(1)[0]
- try:
- device.disconnect()
- except:
- pass
-
- condition = 'obj.state == DeviceState.disconnected'
- wd.wait_for_object_condition(device, condition)
-
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@@ -137,7 +127,9 @@ class Test(unittest.TestCase):
'" down hw ether 12:00:00:00:00:02 up')
cls.bss_hostapd[0].reload()
+ cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
cls.bss_hostapd[1].reload()
+ cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
# Fill in the neighbor AP tables in both BSSes. By default each
# instance knows only about current BSS, even inside one hostapd
diff --git a/autotests/testFT-PSK-over-DS/hw.conf b/autotests/testFT-PSK-over-DS/hw.conf
@@ -1,5 +1,6 @@
[SETUP]
num_radios=3
+start_iwd=0
[HOSTAPD]
rad0=ft-psk-ccmp-1.conf
diff --git a/autotests/testFT-SAE-roam/connection_test.py b/autotests/testFT-SAE-roam/connection_test.py
@@ -15,8 +15,6 @@ from config import ctx
class Test(unittest.TestCase):
def test_roam_success(self):
- wd = IWD()
-
hwsim = Hwsim()
rule0 = hwsim.rules.create()
@@ -31,16 +29,18 @@ class Test(unittest.TestCase):
rule2.source = self.bss_radio[2].addresses[0]
rule2.bidirectional = True
+ # Check that iwd selects BSS 0 first
+ rule0.signal = -2000
+ rule1.signal = -6900
+ rule2.signal = -7200
+
+ wd = IWD(True)
+
psk_agent = PSKAgent("EasilyGuessedPassword")
wd.register_psk_agent(psk_agent)
device = wd.list_devices(1)[0]
- # Check that iwd selects BSS 0 first
- rule0.signal = -2000
- rule1.signal = -2500
- rule2.signal = -3000
-
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@@ -135,16 +135,6 @@ class Test(unittest.TestCase):
os.system('ifconfig "' + self.bss_hostapd[2].ifname + '" up')
hwsim = Hwsim()
- wd = IWD()
- device = wd.list_devices(1)[0]
- try:
- device.disconnect()
- except:
- pass
-
- condition = 'obj.state == DeviceState.disconnected'
- wd.wait_for_object_condition(device, condition)
-
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
diff --git a/autotests/testFT-SAE-roam/hw.conf b/autotests/testFT-SAE-roam/hw.conf
@@ -1,5 +1,6 @@
[SETUP]
num_radios=4
+start_iwd=0
[HOSTAPD]
rad0=ft-sae-1.conf