3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-12 23:19:22 +01:00
Commit Graph

519 Commits

Author SHA1 Message Date
James Prestwood
cb7e9b5885 auto-t: hostapd.py: properly implement singleton (per-config)
This shouldn't change any functionality but it is much more convenient
in the cleanup path i.e. nothing special needs to be done.
2021-08-27 20:07:26 -05:00
James Prestwood
1a01486170 auto-t: hwsim.py: turn Hwsim into singleton (per-namespace)
This prevents reallocation of new Hwsim classes on each call if one
already exists. This is a bit more efficient on memory.
2021-08-27 20:07:26 -05:00
James Prestwood
4657bd55f5 auto-t: Update Process changes in a few autotests 2021-08-26 08:52:48 -05:00
James Prestwood
d2a3809ca8 auto-t: testutil.py: update Process changes 2021-08-26 08:52:48 -05:00
James Prestwood
665f63ff97 auto-t: hostapd.py: update Process changes 2021-08-26 08:52:48 -05:00
James Prestwood
a3db60b7b1 auto-t: add force SAE group 19 autotest
The vendor element was taken directly from observed logs of an AP
behaving this way. This causes IWD to force group 19.
2021-08-25 13:05:39 -05:00
James Prestwood
70b6451dc2 auto-t: hostapd.py: remove ungraceful_restart
This is no longer needed and greatly simplifies the class
2021-08-25 08:51:45 -05:00
James Prestwood
5776ce87d7 auto-t: testSAQuery remove ungraceful restart
Instead the same effect can be seen by just ifdown/ifup the interface.
2021-08-25 08:51:45 -05:00
James Prestwood
f6683bab75 auto-t: hwsim.py: convert addresses to 42:* format
mac80211_hwsim has a funny quirk with multiple addresses in
radios. Some operations require address index zero, some index
one. And these addresses (possibly a result of how test-runner
initializes radios) sometimes get mixed up. For example scan
results may show a BSS address as 02:00:00:00:00:00, while the
next test run shows 42:00:00:00:00:00.

Ultimately, sending out frames requires the first nibble of the
address to be 0x4 so to handle both variants of addresses described
above hwsim.py was updated to always bitwise OR the first byte
with 0x40.
2021-08-25 08:51:45 -05:00
Andrew Zaborowski
3eff81864c autotests: Test GO-side IP Allocation in testP2P
Check if our wpa_supplicant P2P Client has received the allocated
Clieant IP/netmask/GO IP values we sent in the 4-Way Handshake.
2021-08-25 08:02:17 -05:00
James Prestwood
47ebd81393 auto-t: remove ANQP delay test
The idea of this test is valid but it is extremely timing dependent
which simply isn't testable on all machines. Removing this test
at least until this can be tested reliably.
2021-08-18 19:53:22 -05:00
James Prestwood
07da17ec5f auto-t: update tests to enable hwsim rules 2021-08-18 19:53:19 -05:00
James Prestwood
db9f001865 auto-t: combine testBSSBlacklist tests
All 4 tests were combined to reuse hwsim rule code, and improve
cleanup between running tests.
2021-08-18 19:53:16 -05:00
James Prestwood
b252b65ee0 auto-t: hwsim.py: handle Prefix/Enabled in __str__ 2021-08-18 19:53:12 -05:00
James Prestwood
f328d62f55 auto-t: hwsim.py: add Enabled property 2021-08-18 19:53:07 -05:00
James Prestwood
07fc7905ca auto-t: fix error handling in testHotspot
testHotspot suffered from improper cleanup and if a single test failed
all subsequent tests would fail due to IWD still running since IWD()
was never cleaned up.

In addition the PSK agent and hwsim rules are now set onto the cls
object and removed in tearDownClass()
2021-08-18 16:57:34 -05:00
James Prestwood
8e5a68f407 hwsim: add Rule.remove_all()
There are really no cases where a test wants to remove a single
rule. Most loop through and remove rules individually so this
is being added as a convenience.
2021-08-18 16:57:29 -05:00
James Prestwood
1e0553250b auto-t: scan as many times as needed to find networks
Certain autotests coupled with slower test machines can result in lost
beacons and "Network not found" errors. In attempt to help with this
the test can just rescan (30 seconds max) until the network is found.
2021-08-18 16:55:47 -05:00
James Prestwood
3616b37789 auto-t: separate PEAP + SIM test
Remove EAP-SIM from the generic PEAP test case since skipping
(if ofono is not on system) would skip the entire test rather
than just the EAP-SIM portion.
2021-08-17 17:02:32 -05:00
James Prestwood
f0a890da8a auto-t: remove duplicate EAP tests
This removes any EAP test which was combined into testEAP as well
as modifies any special EAP test to use the now global eap-users
file.
2021-08-17 11:44:36 -05:00
James Prestwood
c21dc9ed6f auto-t: Add universal testEAP test
This tests all EAP methods in their standard configuration. Any
corner cases requiring changes to main.conf or other hostapd
options are not included and will be left as stand alone tests.

This was done because nearly all EAP tests are identical except
the IWD provisioning file and hostapd EAP users fine. The IWD
provisioning file can be swapped out as needed for each individual
test without actually restarting IWD. And the EAP users file can
simply be written to include every possible EAP method that
is supported.
2021-08-17 11:44:36 -05:00
James Prestwood
42fe6c5a15 auto-t: hostapd.py: remove _hostapd_restarted concept
The destructor was trying to do more than the scope of a destructor
by trying to handle this single case of hostapd being restarted.

Instead we can simply pass a keyword argument 'reinit' to the
constructor to tell it to reinitialize everything. And as for killing
hostapd this can be done in ungraceful_restart itself rather than
trying to handle it in the destructor.
2021-08-16 11:33:26 -05:00
James Prestwood
cb4f1d2a99 auto-t: turn off scan address randomization in testHotspot
This (hopefully) will make this test pass better on slower machines.
In addition the mechanism of copying over separate main.conf files
was changed (rather than echo'ing the option into /tmp/main.conf)
2021-08-13 20:39:13 -05:00
James Prestwood
a2c777ba84 auto-t: iwd.py: clean up StationDebug
Initialize this once and reference that for each method/property
2021-08-13 20:39:13 -05:00
James Prestwood
973ee269d3 auto-t: return existing instance from HostapdCLI
This addresses the TODO where HostapdCLI was creating separate
objects each time HostapdCLI was called. This was worked around
by manually setting the important members but instead the class
can be re-worked to act as somewhat of a singleton, per-config
at least.

If there is no HostapdCLI instance for a given config one is
created and initialized. Subsequent HostapdCLI calls (for the
same config) will be returned the same object rather than a
new one.
2021-08-13 20:39:13 -05:00
James Prestwood
f721f1de1e auto-t: skip testEAP-PEAP-SIM if ofonod is not running 2021-08-13 16:44:14 -05:00
James Prestwood
365f955318 auto-t: ead.py: remove wait_for_object_condition
Instead the class method IWD._wait_for_object_condition can
be used.
2021-08-13 15:18:40 -05:00
James Prestwood
382b73c11a auto-t: cleanup dhcpd.leases[~] in testNetconfig 2021-08-13 15:18:40 -05:00
James Prestwood
5c14742a87 auto-t: use prefix on hotspot anqp test
The hotspot ANQP delay test was setting a global delay on all
packets which had some unintended consequences. At the time this
was the only way of simulating the test scenario but now hwsim
supports prefix matching so only the ANQP request/response will
be delayed.
2021-08-13 15:18:40 -05:00
James Prestwood
c2caa325ba auto-t: fix testAgent use of Process
This test was accessing the subprocess object and calling terminate
which ends up causing issues with test-runners own process cleanup.
Instead kill() should be used.
2021-08-13 15:18:40 -05:00
James Prestwood
82d7c81bd3 auto-t: remove unneeded BSSs in testEAP-MSCHAPv2
Hostapd sometimes has trouble with specifying additional BSSs in
a single config file, at least in the test-runner environment.
Since all the BSS's specified were identical instead the test was
reworked to only have a single BSS and each subtest can connect
in its own unique way.
2021-08-13 14:54:53 -05:00
James Prestwood
3adb91fc9e auto-t: iwd.py: allow renaming in copy_to_storage
By providing a 'name' keyword argument the file copied will be
renamed to that.
2021-08-13 14:54:53 -05:00
James Prestwood
78f5a5dde4 auto-t: speed up testRoamRetry
This test took quite a while to execute (~2 minutes on my machine)
because there was simply no other way to test this scenario but
waiting. Now the no-roam-candidates condition can be waited for
rather than just sleeping for 20 seconds. Additionally the default
RoamRetryInterval was being used which is 60 seconds. Instead
main.conf can set this to 5 seconds and really cut down on the time
to wait.

Part of a comment was also removed due to being incorrect. Even
with neighbor reports IWD still must scan, its just that the
scan is more limited and, in theory, faster.
2021-08-13 14:45:14 -05:00
James Prestwood
36777d1e68 auto-t: iwd.py: add StationDebug.Event support
Adds a new wait_for_event API which waits for a StationDebug.Event.
2021-08-13 14:45:12 -05:00
James Prestwood
b705a579ad auto-t: ead.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
5ebbe07fa6 auto-t: hostapd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
732871b601 auto-t: iwd.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
80ee406e3e auto-t: ofono.py: use non_block_wait 2021-08-13 11:16:19 -05:00
James Prestwood
541dca499a auto-t: hostapd.py: remove get_freq()/get_config_value() 2021-08-13 10:46:21 -05:00
James Prestwood
876ac5f569 auto-t: use .frequency property in SAQuery-spoofing test 2021-08-13 10:46:18 -05:00
James Prestwood
7a74a825a4 auto-t: iwd.py: scan only on needed frequencies
get_ordered_network() now scans automatically and has been updated
to use the StationDebug.Scan() API rather than doing a full
dbus scan (unless full_scan = True). The frequencies to be scanned
are picked automatically based on the current hostapd status
(hidden behind ctx.hostapd.get_frequency()).
2021-08-13 10:46:16 -05:00
James Prestwood
57933425ca test-runner: start HostapdCLI from test-runner
This gives the benefit of test-runner itself having access to
the CLI, e.g. for getting status information.
2021-08-13 10:46:13 -05:00
James Prestwood
c7466cd56a auto-t: add python API for StationDebug.Scan 2021-08-13 10:46:10 -05:00
James Prestwood
836f0d9a08 auto-t: set autoconnect=True for tests that need it
After the default behavior was changed to disable autoconnect there
were several tests which still needed it to be turned on.
2021-08-12 16:59:05 -05:00
James Prestwood
a15b781feb auto-t: update all tests to remove bad scanning logic
This changes all tests to use the default get_ordered_network behavior
rather than some custom or incorrect logic. Any use of
scan_if_needed=True has been removed since this is now the default.
Also any explicit scanning has been removed for tests which do not
require it (where the default behavior is good enough).
2021-08-12 16:59:03 -05:00
James Prestwood
89c1ec3d79 auto-t: make hwsim registration off by default
With the addition of connect_bssid/roam very few tests actually
require hwsim. Since hwsim can lead to problems with scan results
its best to have it off by default and have each test that needs
it explicitly turn it on.

Tests which previously turned it off have had that option removed.

Tests that do require hwsim still are vulnerable to scan result
problems, so for these tests beacon_int was added to the hostapd
config which seems to help with reliability somewhat.
2021-08-12 16:59:01 -05:00
James Prestwood
5519faecba auto-t: iwd.py: make scan_if_needed True by default
There is a common block of code in nearly every test which is incorrect,
most likely a copy-paste from long ago. It goes something like:

wd.wait_for_object_condition(device, 'not obj.scanning')
device.scan()
wd.wait_for_object_condition(device, 'not obj.scanning')

network = device.get_ordered_network("ssid")

The problem here is that sometimes the scanning property does not get
updated fast enough before device.scan() returns, meaning get_ordered_network
comes up with nothing. Some tests pass scan_if_needed=True which 'fixes'
this but ends up re-scanning after the original scan finishes.

To put this to rest scan_if_needed is now defaulted to True, and no
explicit scan should be needed.
2021-08-12 16:58:39 -05:00
James Prestwood
4f5010f69d auto-t: iwd.py: add autoconnect property/StationDebug 2021-08-12 16:58:30 -05:00
James Prestwood
7af6aac440 auto-t: use connect_bssid in APRoam
In addition the send_bss_transition call was updated to only send a
single BSS. By sending two BSS's IWD is left to pick whichever one
it wants which makes the test behavior undefined.
2021-08-12 15:14:07 -05:00
James Prestwood
6e331efbda auto-t: update testPreauth-roam to use connect_bssid/roam() 2021-08-12 15:14:07 -05:00