mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
auto-t: Test quick scan
This commit is contained in:
parent
1c04707487
commit
6fd68dae64
5
autotests/testScanKnownFreqs/.known_network.freq
Normal file
5
autotests/testScanKnownFreqs/.known_network.freq
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[/var/lib/iwd/ssid_open_1.open]
|
||||||
|
list= 5180
|
||||||
|
|
||||||
|
[/var/lib/iwd/ssid_open_2.open]
|
||||||
|
list= 2412 2437
|
10
autotests/testScanKnownFreqs/hw.conf
Normal file
10
autotests/testScanKnownFreqs/hw.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=4
|
||||||
|
start_iwd=0
|
||||||
|
max_test_exec_interval_sec=60
|
||||||
|
reg_domain=US
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ssid_open_1.conf
|
||||||
|
rad1=ssid_open_2.conf
|
||||||
|
rad2=ssid_open_3.conf
|
64
autotests/testScanKnownFreqs/quick_scan_test.py
Normal file
64
autotests/testScanKnownFreqs/quick_scan_test.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
import iwd
|
||||||
|
from iwd import IWD
|
||||||
|
|
||||||
|
class Test(unittest.TestCase):
|
||||||
|
dict = {
|
||||||
|
'ssid_open_1': False,
|
||||||
|
'ssid_open_2': False,
|
||||||
|
'ssid_open_3': False,
|
||||||
|
}
|
||||||
|
|
||||||
|
def set_network(self, ssid):
|
||||||
|
if ssid not in self.dict:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.dict[ssid] = True
|
||||||
|
|
||||||
|
def validate_quick_scan(self, wd):
|
||||||
|
devices = wd.list_devices(1)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
# Device initiates a passive quick scan and scans only for the known
|
||||||
|
# frequencies (listed in .known_network.freq file).
|
||||||
|
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)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.validate_quick_scan(wd)
|
||||||
|
finally:
|
||||||
|
del wd
|
||||||
|
|
||||||
|
# Only ssid_open_1 and ssid_open_2 should be discovered.
|
||||||
|
self.assertEqual(self.dict['ssid_open_1'], True)
|
||||||
|
self.assertEqual(self.dict['ssid_open_2'], True)
|
||||||
|
self.assertEqual(self.dict['ssid_open_3'], False)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
IWD.copy_to_storage('.known_network.freq')
|
||||||
|
IWD.copy_to_storage('ssid_open_1.open')
|
||||||
|
IWD.copy_to_storage('ssid_open_2.open')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
IWD.clear_storage()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
10
autotests/testScanKnownFreqs/ssid_open_1.conf
Normal file
10
autotests/testScanKnownFreqs/ssid_open_1.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
ssid=ssid_open_1
|
||||||
|
country_code=US
|
||||||
|
hw_mode=a
|
||||||
|
ieee80211d=1
|
||||||
|
ieee80211h=1
|
||||||
|
ieee80211n=1
|
||||||
|
ieee80211ac=1
|
||||||
|
|
||||||
|
channel=36
|
||||||
|
beacon_int=50
|
0
autotests/testScanKnownFreqs/ssid_open_1.open
Normal file
0
autotests/testScanKnownFreqs/ssid_open_1.open
Normal file
5
autotests/testScanKnownFreqs/ssid_open_2.conf
Normal file
5
autotests/testScanKnownFreqs/ssid_open_2.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ssid=ssid_open_2
|
||||||
|
hw_mode=g
|
||||||
|
|
||||||
|
channel=6
|
||||||
|
beacon_int=50
|
0
autotests/testScanKnownFreqs/ssid_open_2.open
Normal file
0
autotests/testScanKnownFreqs/ssid_open_2.open
Normal file
4
autotests/testScanKnownFreqs/ssid_open_3.conf
Normal file
4
autotests/testScanKnownFreqs/ssid_open_3.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ssid=ssid_open_3
|
||||||
|
hw_mode=g
|
||||||
|
channel=11
|
||||||
|
beacon_int=50
|
Loading…
Reference in New Issue
Block a user