mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-09 05:29:23 +01:00
1d9f2d69e0
testScan was creating 10 separate hidden networks which sometimes bogged down hostapd to the point that it would not start up in time before test-runner's timeouts fired. This appeared to be due to hostapd needing to create 10 separate interfaces which would sometimes fail with -ENFILE. The test itself only needed two separate networks, so instead the additional 8 can be completely removed.
69 lines
1.5 KiB
Python
69 lines
1.5 KiB
Python
#!/usr/bin/python3
|
|
|
|
import unittest
|
|
import sys
|
|
|
|
sys.path.append('../util')
|
|
import iwd
|
|
from iwd import IWD
|
|
from iwd import NetworkType
|
|
|
|
class Test(unittest.TestCase):
|
|
|
|
dict = {
|
|
'ssid_open': False,
|
|
'ssid_psk': False,
|
|
'ssid_8021x': False,
|
|
'ssid_hidden_0': False,
|
|
}
|
|
|
|
def set_network(self, ssid):
|
|
if ssid not in self.dict:
|
|
return
|
|
|
|
if self.dict[ssid]:
|
|
raise Exception('Duplicated list entry')
|
|
|
|
self.dict[ssid] = True
|
|
|
|
def validate_scan(self, wd):
|
|
devices = wd.list_devices(1)
|
|
self.assertIsNotNone(devices)
|
|
device = devices[0]
|
|
|
|
condition = 'obj.scanning'
|
|
wd.wait_for_object_condition(device, condition)
|
|
condition = 'not obj.scanning'
|
|
wd.wait_for_object_condition(device, condition)
|
|
|
|
device.scan()
|
|
|
|
condition = 'obj.scanning'
|
|
wd.wait_for_object_condition(device, condition)
|
|
condition = 'not obj.scanning'
|
|
wd.wait_for_object_condition(device, condition)
|
|
|
|
ordered_networks = device.get_ordered_networks()
|
|
|
|
for network in ordered_networks:
|
|
self.set_network(network.name)
|
|
|
|
def test_scan(self):
|
|
wd = IWD(True, '/tmp')
|
|
|
|
self.validate_scan(wd)
|
|
|
|
for ssid, seen in self.dict.items():
|
|
self.assertEqual(seen, True)
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
IWD.copy_to_storage('ssid_hidden_0.open')
|
|
|
|
@classmethod
|
|
def tearDownClass(cls):
|
|
IWD.clear_storage()
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main(exit=True)
|