3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00
iwd/autotests/util
James Prestwood da3f66ea68 auto-t: add optional scan argument to get_ordered_network(s)
There is a very common block of code inside many autotests
which goes something like:

device.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(device, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
network = device.get_ordered_network('an-ssid')

When you see the same pattern in nearly all the tests this shows
we need a helper. Basic autotests which merely check that a
connection succeeded should not need to write the same code again
and again. This code ends up being copy-pasted which can lead to
bugs.

There is also a code pattern which attempts to get ordered
networks, and if this fails it scans and tries again. This, while
not optimal, does prevent unneeded scanning by first checking if
any networks already exist.

This patch solves both the code reuse issue as well as the recovery
if get_ordered_network(s) fails. A new optional parameter was
added to get_ordered_network(s) which is False by default. If True
get_ordered_network(s) will perform a scan if the initial call
yields no networks. Tests will now be able to simply call
get_ordered_network(s) without performing a scan before hand.
2020-05-02 06:40:23 -05:00
..
hlrauc.py autotest: fix possible hlrauc race condition 2018-01-18 14:43:53 -06:00
hostapd.py auto-t: support hostapd event processing 2019-11-04 14:42:17 -06:00
hwsim.py auto-t: add simple getter for radios 2019-06-11 11:44:00 -05:00
iwd.py auto-t: add optional scan argument to get_ordered_network(s) 2020-05-02 06:40:23 -05:00
ofono.py autotest: Added ofono.py utility 2017-12-14 17:47:29 -06:00
testutil.py treewide: fix typos 2020-01-21 16:03:28 -06:00
wiphy.py autotests: Update the wiphy_map and hostapd_map structs 2019-04-22 16:34:17 -05:00