3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-05 11:39:24 +01:00
Commit Graph

691 Commits

Author SHA1 Message Date
James Prestwood
2e882946f8 auto-t: iwd.py: make wait() a static method
This allows it to be used without initializing an IWD class:

IWD.wait(1)
2021-10-08 08:48:56 -05:00
James Prestwood
83a30fe5ae auto-t: rekey in FT/FILS tests 2021-09-28 17:40:29 -05:00
James Prestwood
7c1e3ab76a auto-t: hostapd.py: add rekey() utility
Forces GTK/PTK rekeys
2021-09-28 17:40:22 -05:00
James Prestwood
908dff807e auto-t: fix testSAE to continue if a test fails 2021-09-28 17:40:11 -05:00
James Prestwood
a71f24109f auto-t: block auth frames for FT-over-DS test
The FT-over-DS test was allowed to fail as it stood. If FT-over-DS
failed it would just do a normal over-Air transition which satisfied
all the checks. To prevent this Authenticate frames are blocked after
the initial connection so if FT-over-DS fails there is no other way
to roam.
2021-09-28 17:39:57 -05:00
James Prestwood
26befb5850 auto-t: add OCV to FILS test 2021-09-28 17:39:51 -05:00
James Prestwood
8ce7dc3dbe auto-t: set ocv on PSK FT test 2021-09-28 11:01:03 -05:00
James Prestwood
10f026748e auto-t: add oper class/band tests for OWE transition 2021-09-22 14:41:36 -05:00
James Prestwood
8a43473504 auto-t: add testOWE-transition
This adds several tests for OWE transition networks. Hostapd
does have special options for these networks but currently their
implementation is incorrect as the IE is not ever added to the
OWE BSS. Besides that using vendor_elements provides a much easier
way to create invalid IEs to test.
2021-09-17 18:05:10 -05:00
James Prestwood
e11ad83222 auto-t: hostapd.py: add disable() 2021-09-15 16:42:21 -05:00
James Prestwood
7fda423e12 auto-t: remove ';' in testSAE autoconnect_test.py 2021-09-09 16:57:38 -05:00
James Prestwood
4c6f0ff75a auto-t: add SAE test for no supported groups 2021-09-09 16:57:38 -05:00
James Prestwood
a0a05a88b9 auto-t: add SAE test for a non-ACKed confirm 2021-09-09 16:57:38 -05:00
James Prestwood
1574909535 auto-t: change testSAE timeout_test to use match/offset
This makes things more clear on what frames are being blocked
since it passes over header information to get to the actual
SAE payload.
2021-09-09 16:57:38 -05:00
James Prestwood
9049ed2f25 auto-t: hwsim.py: add match/match_offset properties 2021-09-09 16:57:38 -05:00
James Prestwood
a50af3b751 auto-t: remove OWE renegotiate test
Since IWD tries group 20 first all other OWE tests are actually
triggering group negotiation where this test is not. Since this
code is exercised this test can be removed completely, as well
as the additional radio/network.
2021-09-08 20:05:07 -05:00
James Prestwood
eeb42c56f0 auto-t: add sae test for non-acked commit
This test simulates the scenario where IWDs commit is not acked which
exposes a hostapd bug that ultimately fails the connection. This behavior
can be seen by reverting the commit which works around this issue:

"sae: don't send commit in confirmed state"

With the above patch applied this test should pass.

Note: The existing timeout test was reused as it was not of much use
anyways. All it did was block auth/assoc frames and expect a failure
which didn't exercise any SAE logic anyways.
2021-09-08 16:48:07 -05:00
James Prestwood
5b226a8151 auto-t: hwsim.py: add drop_ack property 2021-09-07 20:02:38 -05:00
James Prestwood
06ee649a91 auto-t: hwsim.py: add match_times property 2021-09-07 19:02:47 -05:00
James Prestwood
7123f47f84 test-runner: remove special case for "root" namespace
This was a placeholder at one point but modules grew to depend on it
being a string. Fix these dependencies and set the root namespace
name to None so there is no more special case needed to handle both
a named namespace and the original 'root' namespace.
2021-09-07 12:45:26 -05:00
Andrew Zaborowski
59d4e86bc5 autotests: Don't use the netifaces module
Get rid of a dependency on a package that needed to be manually
installed.
2021-09-03 14:45:18 -05:00
Andrew Zaborowski
ba152c567c autotests: Extend a testP2P timeout
With various versions of wpa_supplicant tested, after an IWD GO tears
the group down, the wpa_supplicant P2P client will not immediately
signal that the group has disappeared but will at least wait for the
lost beacon signal, wait some more and try reconnecting and all that
takes it 10s or a little longer.  Possibly sending Deauthenticate frames
to clients first would improve this.
2021-09-03 14:45:18 -05:00
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
James Prestwood
1addaf3355 auto-t: remove FT-over-DS test, and rename testFT-PSK-roam 2021-08-12 15:14:07 -05:00
James Prestwood
20f7907436 auto-t: use connect_bssid/roam APIs in testFT-PSK-roam
This also adds FT-over-DS into this test, as well as a reassociation
test for good measure.
2021-08-12 15:14:07 -05:00
James Prestwood
49eb17973e auto-t: remove testFT-FILS-SHA384 2021-08-12 15:14:07 -05:00
James Prestwood
85759a6f3c auto-t: rename testFT-FILS-SHA256 to testFT-FILS 2021-08-12 15:14:07 -05:00
James Prestwood
3800f991b2 auto-t: combine testFT-FILS* tests
This combines the SHA256 and SHA384 tests into one, as well as
utilizes the new connect_bssid() and roam() APIs for much faster
test execution.
2021-08-12 15:14:07 -05:00
James Prestwood
7d0cbf15bc auto-t: update testFT-8021x-roam to use roam() API 2021-08-12 15:14:07 -05:00
James Prestwood
5bf614a7af auto-t: add reassociation test for OWE
The timeout test was also modified to handle the additional
radio.
2021-08-12 15:14:07 -05:00
James Prestwood
e819ee6df6 auto-t: rename testFT-SAE-roam to testSAE-roam
Since reassociation is now tested this name fits better
2021-08-12 15:14:07 -05:00
James Prestwood
15236f30db auto-t: add reassociate test to FT-SAE-roam
This refactors to test both FT and reassociation.
2021-08-12 15:14:07 -05:00
James Prestwood
77d5b57e9e auto-t: iwd.py: add roam() method
This will use the Roam() developer method to force a roam to
a certain BSS. This is particularly useful for any test requiring
roams that are not testing IWD's BSS selection logic. Rather than
creating hwsim rules, setting low RSSI values, and waiting for the
roam logic/scan to happen Roam() can be used to force the roam
logic immediately.
2021-08-12 15:14:07 -05:00
James Prestwood
3402f5994b auto-t: iwd.py: add connect_bssid() method
Python API for ConnectBssid() developer method
2021-08-12 15:14:07 -05:00
James Prestwood
518808c709 auto-t: testutil.py: add expect_fail flag
Several tests tests for connectivity with the expectation that it
will fail. This ends up taking 30+ seconds because testutil retries
3 times, each with a 10 second timeout. By passing expect_fail=True
this lowers the timeout to zero, and skips any retries.
2021-08-12 15:14:07 -05:00
James Prestwood
80123efabd auto-t: hostapd.py: add 'bssid' property
This gets the APs BSSID, bypassing the need to use hwsim
for obtaining this address.
2021-08-12 15:14:07 -05:00
James Prestwood
f1d6e6094e auto-t: update deprecated option
testBSSBlacklist was using the old addressr randomization option
2021-07-30 15:45:57 -05:00
James Prestwood
04d00c5c20 auto-t: add regular 8021x AKM to FT-FILS tests
After some code changes the FT-FILS AKM was no longer selectable
inside network_can_connect_bss. This normally shouldn't matter
since station ends up selecting the AKM explicitly, including
passing the fils_hint, but since the autotests only included
FT-FILS AKMs this caused the transition to fail with no available
BSS's.

To fix this the standard 8021x AKM was added to the hostapd
configs. This allows these BSS's to be selected when attempting
to roam, but since FT-FILS is the only other AKM it will be used
for the actual transition.
2021-07-29 17:51:25 -05:00
James Prestwood
1d9f2d69e0 auto-t: remove unneeded hidden networks
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.
2021-07-29 17:51:25 -05:00
James Prestwood
36bc4e15c3 auto-t: hostapd: catch local socket remove exception
This happens if hostapd is killed ungracefully which is done in
some tests.
2021-07-29 17:51:25 -05:00
James Prestwood
f902c7019d auto-t: fix blacklist test ranking
The scan ranking logic was previously changed to be based off a
theoretical calculated data rate rather than signal strength.
For HT/VHT networks there are many data points that can be used
for this calculation, but non HT/VHT networks are estimated based
on a simple table mapping signal strengths to data rates.

This table starts at a signal strength of -65 dBm and decreases from
there, meaning any signal strengths greater than -65 dBm will end up
getting the same ranking. This poses a problem for 3/4 blacklisting
tests as they set signal strengths ranging from -20 to -40 dBm.
IWD will then autoconnect to whatever network popped up first, which
may not be the expected network.

To fix this the signal strengths were changed to much lower values
which ensures IWD picks the expected network.
2021-07-28 09:32:42 -05:00
Denis Kenzior
6d76b3e21d auto-t: SAE: Rework SAE tests
Break up the SAE tests into two parts: testSAE and testSAE-AntiClogging

testSAE is simplified to only use two radios and a single phy managed
by hostapd.  hostapd configurations are changed via the new 'set_value'
method added to hostapd utils.  This allows forcing hostapd to use a
particular sae group set, or force hostapd to use SAE H2E/Hunting and
Pecking Loop for key derivation.  A separate test for IKE Group 20 is no
longer required and is folded into connection_test.py

testSAE-AntiClogging is added with an environment for 5 radios instead
of 7, again with hostapd running on a single phy.  'sae_pwe' is used to
force hostapd to use SAE H2E or Hunting and Pecking for key derivation.
Both Anti-Clogging protocol variants are thus tested.

main.conf is added to both directories to force scan randomization off.
This seems to be required for hostapd to work properly on hwsim.
2021-07-14 19:02:06 -05:00
Andrew Zaborowski
2a37dba4bf autotest: Improve cleanup in testP2P
Make sure some of the processes and files created are also cleaned up on
failure so that the next chance has a chance to succeed anyway.
2021-06-14 09:02:34 -05:00
Denis Kenzior
de83176b04 auto-t: Drop RSSI even lower
The VHT AP reports NSS:8, so it is still highly preferred even in very
low signal situations.
2021-06-04 15:33:55 -05:00
Andrew Zaborowski
e583bc470f autotests: Add P2P GO role test scenarios
autotests/testP2P/client_test.py is renamed to connection_test.py to
reflect that it now tests both roles.
2021-06-04 11:56:48 -05:00
Andrew Zaborowski
0be475af3c autotests: Add missing space in wpas P2P_CONNECT commands 2021-06-04 11:56:40 -05:00
Andrew Zaborowski
c54ba7158c autotests: Initialise P2PPeer objects with correct namespace 2021-06-04 11:56:32 -05:00
Andrew Zaborowski
fc81e07c13 autotests: Update APRanges usage in testAP
[General].APRange is now [IPv4].APAddressPool and the netmask is changed
from 23 to 27 bits to make the test correctly assert that only two
default-sized subnets are allowed by IWD simultaneously (default has
changed from 24 to 28 bits)
2021-06-01 10:20:36 -05:00
Denis Kenzior
6ff152669a auto-t: Use more realistic RSSIs for HT-VHT test 2021-05-24 18:39:31 -05:00
Denis Kenzior
5d9b9de462 auto-t: Update APRoam test with more realistic RSSIs 2021-05-24 14:31:04 -05:00
Denis Kenzior
788bbb3650 auto-t: Use stard_iwd=0 for testPreauth
This test is quite similar to FT tests, so use start_iwd=0 here as well
2021-05-24 14:31:04 -05:00
Denis Kenzior
ab8e091946 auto-t: Restructure FT-PSK-roam to be like other FT roam tests 2021-05-24 14:31:04 -05:00
Denis Kenzior
8d8ea67da1 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.
2021-05-24 14:31:04 -05:00
James Prestwood
8e09c4a6fb auto-t: update FT-over-DS test for new behavior
The FT-over-DS procedure now authenticates with multiple BSS's
upon connecting. This causes list_sta() to return our address for
any authenticated APs. It has now been changed to work with this
new behavior, as well as a check that the station fully connected
to the expected AP initially.
2021-05-12 18:04:30 -05:00
James Prestwood
d3d6090c32 auto-t: add FT-back to original AP on FT-PSK-roam 2021-04-30 15:33:48 -05:00
James Prestwood
cb6faed69a auto-t: properly print wait_for_object_change exception 2021-04-22 13:25:23 -05:00
James Prestwood
1f4d73ab73 auto-t: add more cleanup to ofono based tests (again)
The AuthCenter was still not being fully cleaned up in these
tests. It was being stopped but there was still a reference being
held which prevented __del__ from being called.
2021-04-22 13:25:23 -05:00
James Prestwood
d4e27b8ee2 auto-t: move AuthCenter to Setup/Tear down
By moving the AuthCenter initializer to SetUpClass we can now
call stop() in TearDownClass which handles any exception the
test might throw.
2021-04-21 13:55:35 -05:00
James Prestwood
1b0f24a283 auto-t: include ssidTKIP.psk in Netconfig test
This file was not included when testNetconfig was introduced
and is required. My system was working fine as it was in my
local tree but has been missing and not passing for others.
2021-04-21 10:44:12 -05:00
James Prestwood
01acadbeb9 auto-t: add auth/assoc timeouts to testOWE 2021-04-05 17:47:42 -05:00
James Prestwood
b8da948caf auto-t: add timeout test to SAE
This tests the timeout handling in SAE for both authenticate
and associate frames.
2021-04-05 17:47:42 -05:00
James Prestwood
3c3c1a3304 auto-t: add python wrapper for hwsim rule prefix 2021-04-05 17:47:42 -05:00
James Prestwood
80ff2fe140 auto-t: iwd.py: release namespace on IWD close 2021-02-26 10:09:36 -06:00
James Prestwood
bb27cea54c auto-t: release radio/hostapd instances from cls
The cls object is part of the unittest framework and its lifespan
is out of test-runner's control. Setting objects into the cls
object sometimes keeps those objects around longer than desired.
Its best to unset anything set in cls when the test is tore down.
2021-02-26 10:08:10 -06:00
James Prestwood
e5a66bf51f auto-t: testNetconfig stop dhcpd correctly
Use stop_process instead of kill as this removes the process
from the test context.
2021-02-26 10:08:03 -06:00
James Prestwood
e8389190a9 auto-t: testutil.py: pass wait into ping
This will wait for the process and cleanup ping-out file
2021-02-26 10:07:32 -06:00
James Prestwood
0e13c8d32b auto-t: hlrauc.py: remove unix socket on cleanup 2021-02-26 10:07:17 -06:00
James Prestwood
904238b6ec auto-t: testEAD: stop ead when test finishes 2021-02-26 10:07:07 -06:00
James Prestwood
3a9c401f63 auto-t: fix blacklist test timing issues
This test fails randomly, and it appears to be due to excessive
scanning. Historically most autotests start a dbus scan right
away. The problem is that most likely a periodic scan is already
ongoing, meaning the dbus scan gets queued. If a Connect() call
comes in (which it always does), the dbus scan gets delayed and will
trigger once connected, at a time the test is not expecting. This
can cause problems with any assumed timing as well as offchannel
frames.

This patch removes the explicit DBus scanning and instead uses
scan_if_needed with get_ordered_networks. The 'all_blacklisted_test'
was also modified to wait for scanning to complete after failing
to connect to all BSS's. This lets all the networks fully come
up (after being blocked by hwsim) and appear in scan results.
2021-02-11 20:32:26 -06:00
James Prestwood
1dc4d6e9ba auto-t: update roaming tests with wait_for_object_change
Every single roaming test had one of two problems with watching the
state change between roaming --> connected. Either the test used
wait_for_object_condition to wait for 'connected' which could allow
other states in between. Or it simply used an assert. The assert
wouldn't allow other state changes, but at the cost of potentially
failing due to IWD not having made it to the 'connected' state yet.

Now we have wait_for_object_change which takes two conditions:
initial (from_str) and expected (to_str). This API will not allow
any other conditions except these, and will wait for the expected
condition before continuing. This allows roaming test to reliably
wait for the roaming --> connected state change.
2021-02-05 14:44:00 -06:00
James Prestwood
c5538f6450 auto-t: add API wait_for_object_change
This is similar to wait_for_object_condition, but will not allow
any intermediate state changes between the initial and expected
conditions. This is useful for roaming tests when the expected
state change is 'connected' --> 'roaming' with no changes in
between.
2021-02-05 14:44:00 -06:00
James Prestwood
5c96e1e81e auto-t: fix SAQuery-spoofing test
This test occationally failed due to a badly timed DBus scan
triggering right when hwsim tried sending out the spoofed frame.
This caused mac80211_hwsim to reject CMD_FRAME when the timing
was just right.

Rather than always starting a DBus scan we can rely on periodic
scans and only DBus scan if there are no networks in IWD's list.
A scanning check was also added prior to sending out the frame
and if true we wait for not scanning. This is more paranoia than
anything.
2021-02-05 14:43:17 -06:00
James Prestwood
e7d941dc3c auto-t: make spoof_frame more robust
Sometimes scan results can come in with a MAC address which
should be in the first index of addrs[] (42:xx:xx:xx:xx:xx).
This causes a failure to lookup the radio path.

There was also a failure path added if the radio cannot be
found rather than rely on DBus to fail with a None path.

The arguments to SendFrame were also changed to use the
ByteArray DBus type rather than python's internal bytearray.
This shouldn't have any effect, but its more consistent with
how DBus arguments should be used.
2021-02-05 14:43:17 -06:00
James Prestwood
4b07280319 auto-t: fix wait_for_object_condition to work with any object
After recent changes fixing wait_for_object_condition it was accidentally
made to only work with classes, not other types of objects. Instead
create a minimal class to hold _wait_timed_out so it doesnt rely on
'obj' holding the boolean.
2021-02-04 20:56:34 -06:00
James Prestwood
ce5e1e1933 auto-t: testFT-PSK-roam wait for connected
Rather than assert its better to wait for a connected
state.
2021-02-03 20:06:12 -06:00
Alvin Šipraga
af93217701 auto-t: add test for stopping periodic roam retries 2021-01-29 17:55:50 -06:00
Alvin Šipraga
fda4734a1b auto-t: throw exception if hostapd can't send BSS transition req
The testAPRoam autotest was silently failing on my machine until I
realized that my distribution hostapd (Arch Linux) is not built with
CONFIG_WNM_AP=y. Indeed, it is also disabled by default in upstream
hostapd. This resulted in the send_bss_transition() function of
hostapd.py silently failing. With this change, throw an exception in
case the BSS_TM_REQ command does not succeed to hopefully save others
the time of debugging this problem.
2021-01-28 13:30:57 -06:00
James Prestwood
d1b3f2d14f auto-t: remove stale hw.conf options
After the test-runner re-write many tests were left with
stale options that are no longer used at all. These were
periodically getting removed as changes were made to
individual tests, but its apparent now that a tree wide
removal was needed.
2021-01-27 13:42:58 -06:00
Alvin Šipraga
d544fb9fa8 auto-t: add test for roaming retry timing
Recent changes make iwd more eager to retry roaming if it has detected a
high RSSI since the last attempt. Add an autotest to verify this
behaviour.
2021-01-27 13:13:43 -06:00
James Prestwood
b0e970ae38 test-runner: fix logging, verbose, and process output
There were some major problems related to logging and process
output. Tests which required output from start_process would
break if used with '--log/--verbose'. This is because we relied
on 'communicate' to retrieve the process output, but Popen does
not store process output when stdout/stderr are anything other
than PIPE.

Intead, in the case of logging or outfiles, we can simply read
from the file we just wrote to.

For an explicit --verbose application we must handle things
slightly different. A keyword argument was added to Process,
'need_out' which will ensure the process output is kept
regardless of --log or --verbose.

Now a user should be able to use --log/--verbose without any
tests failing.
2021-01-26 13:41:23 -06:00
Andrew Zaborowski
6fdae0c4eb autotests: Test loading binary key formats in testEAP-TLS 2021-01-25 14:01:58 -06:00
James Prestwood
5e631b4e38 auto-t: fix wait_for_object_condition
After the re-write this was broken and not noticed until
recently. The issue appeared to be that the GLib timeout
callback retained no context of local variables. Previously
_wait_timed_out was set as a class variable, but this was
removed so multiple IWD instances could work. Without
_wait_timed_out being a class variable the GLib timeout
setting it had no effect on the wait loop.

To fix this we can set _wait_timed_out on the object being
passed in. This is preserved in the GLib timeout callback
and setting it gets honored in the wait loop.
2021-01-25 13:10:52 -06:00
James Prestwood
55e7caa8e0 auto-t: add iftype/cipher disable to hwsim.py 2020-12-17 20:13:41 -06:00
James Prestwood
5525f32cdd auto-t: update hwsim radio create to use dictionary 2020-12-17 20:10:45 -06:00
James Prestwood
eaf176220c auto-t: fix hwsim.py to use Destroy rather than Remove
There is no Remove() method, but since this code never was used it
remained incorrect for quite some time.
2020-12-17 20:10:30 -06:00
James Prestwood
fde1012f5d auto-t: add static netconfig test
Tests netconfig with a static configuration, as well as tests ACD
functionality.

The test has two IWD radios which will eventually use the same IP.
One is configured statically, one will receive the IP via DHCP.
The static client sets its IP first and begins using it. Then the
DHCP client is started. Since ACD in a DHCP client is configured
to use its address indefinitely, the static client *should* give
up its address.
2020-12-08 16:29:09 -06:00
James Prestwood
d40cac403f auto-t: support IP match with no IP set
This allows an interface with no IP set to be checked for
by passing None in as the address. This will generate an
exception by ioctl which we catch.
2020-12-08 15:15:42 -06:00
James Prestwood
d2cc033d09 auto-t: pass namespace on to other IWD classes
Certain classes were still using the default namespace. This
didn't matter yet since testAP was the only test using namespaces,
and the AP interface was the only one being used.

For an IWD station on a separate namespace all objects need to
be accessable, so the namespace is passed along to those as needed.
2020-12-08 15:15:39 -06:00
James Prestwood
b18f843532 auto-t: add storage dir to IWD() constructor
Add support for setting a custom storage directory.
2020-12-08 15:15:36 -06:00
James Prestwood
e402a11f06 auto-t: fix FT over DS test to wait for connected
Due to timing this test sometimes does not pass because it was
just asserting on the device state rather than waiting for a
change. This generally worked but not always.
2020-11-24 11:42:00 -06:00
James Prestwood
9e541fe7e8 auto-t: add namespaces to testAP 2020-11-18 11:01:11 -06:00
James Prestwood
4168e20243 auto-t: add test_ip_connected to testutil
Used to check IP connectivity between namespaces. The input
should be two tuples containing the IP and namespace to ping
from/to.
2020-11-18 11:01:11 -06:00
James Prestwood
5a7eb91378 auto-t: update utilities to use namespaces 2020-11-18 11:01:11 -06:00
James Prestwood
b24e201248 auto-t: use hwsim_medium=no (testSAE/HiddenNetworks)
Both these tests create many radios which sometimes causes timing
problems when hwsim is running. Since hwsim is not required for
these tests we can disable it and increase test reliability.
2020-11-17 13:30:29 -06:00
James Prestwood
3c708b0e14 auto-t: update hostapd.list_sta to use Process.out
Instead of list_sta() waiting for the PID itself it can
just use wait=True and grab the output out of the Process
class itself.
2020-11-16 17:05:45 -06:00
James Prestwood
eb92c0a6e5 auto-t: refactor get_instance from iwd.py
When network namespaces are introduced there may be multiple
IWD class instances. This makes IWD.get_instance ambiguous
when namespaces are involved. iwd.py has been refactored to
not use IWD.get_instance, but testutil still needs it since
its purely based off interface names. Rather than remove it
and modify every test to pass the IWD object we can just
maintain the existing behavior for only the root namespace.
2020-11-16 17:05:45 -06:00
James Prestwood
d3a57d47f3 auto-t: remove beacon loss tests 2020-11-04 13:41:01 -06:00
James Prestwood
da6b818a53 auto-t: add profile based DHCP test 2020-11-04 13:36:06 -06:00
James Prestwood
2d45461dfd auto-t: simplify copy_to_hotspot
Since copy_to_storage can take an arbitrary destination path now
we can reuse that instead of duplicating code.
2020-11-04 13:36:03 -06:00
James Prestwood
efe53e28c8 auto-t: add copy_to_ap utility 2020-11-04 13:35:44 -06:00
James Prestwood
a472874890 auto-t: remove more /var/lib/iwd references
The address randomization test was using a /var/lib/iwd which
is no longer specially mounted or used for IWD storage. Instead
use /tmp/iwd.
2020-11-04 13:35:04 -06:00
James Prestwood
2a6690e50d auto-t: fix agent path timing issue
The agent path was generated based on the current time which
sometimes yielded duplicate paths if agents were created quickly
after one another. Instead a simple iterator removes any chance
of a duplicate path.
2020-11-03 13:58:23 -06:00
James Prestwood
957a8aac25 auto-t: remove /var/lib/iwd references in testKnownNetworks 2020-11-03 13:58:23 -06:00
James Prestwood
16698d0c9a auto-t: fix testNetconfig hardcoded interface
If running multiple tests testNetconfig would fail due to the
hardcoded wln0 in the dhcpd.conf file. dhcpd can actually start
by passing in the interface to the run command rather than
inside the config file.
2020-11-03 13:58:23 -06:00
James Prestwood
d03ea531de auto-t: add support for AP StartWithConfig API
If a psk is not provided to start_ap, it is assumed that the
AP is being started with a config file.
2020-11-02 13:58:02 -06:00
James Prestwood
87a29c9ca3 auto-t: fix hotspot autoconnect test
The test was removing files in /var/lib/iwd which is no longer
mounted read/write (nor are config files put there anymore).
2020-10-30 13:16:57 -05:00
James Prestwood
4e9b455a2e auto-t: add AP test with DHCP server
The existing AP tests needed to be modified to start IWD from
python since the DHCP test uses a different main.conf.

Also removed some stale hw.conf options that are no longer used.
2020-10-27 16:19:47 -05:00
James Prestwood
201763ff7f auto-t: testutil: add test_ip_address_match
Checks that the the IP address for a given interface matches
2020-10-27 16:19:47 -05:00
James Prestwood
3e69c33f74 auto-t: only return expected number from list_devices
If the caller specifies the number of devices only return that many.
Some sub-tests may only need a subset of the total number of devices
for the test. If the number of devices expected is less than the total
being returned, python would throw an exception.
2020-10-26 14:27:09 -05:00
James Prestwood
ebd712af4e auto-t: no hostapd instance graceful failure
If a test does not need any hostapd instances but still loads
hostapd.py for some reason we want to gracefully throw an
exception rather than fail in some other manor.
2020-10-20 13:30:43 -05:00
Andrew Zaborowski
e28c211c36 autotests: Add testP2P
Add two P2P client connection scenarios.
2020-10-19 17:20:21 -05:00
Andrew Zaborowski
939a67255a autotests: Move some variables from IWD class to instance
These variables were probably meant as instance members and not class
members.
2020-10-19 17:20:21 -05:00
Andrew Zaborowski
719646df4d autotests: Add basic wpa_supplicant P2P python wrapper
Add the new wpas.Wpas class roughly based on hostapd.HostapdCLI but only
adding methods for the P2P-related stuff.

Adding "wpa_supplicant" to -v will enable output from the wpa_supplicant
process to be printed and "wpa_supplicant-dbg" will make it more verbose
("wpa_supplicant" is not needed because it seems to be automatically
enabled because of the glob matching in ctx.is_verbose)
2020-10-19 17:20:21 -05:00
Andrew Zaborowski
550f8f454c autotests: Basic P2P python API
Add a basic wrapper for the P2P-related DBus interfaces similar to the
existing classes in iwd.py.  WFD is not included.
2020-10-19 17:20:21 -05:00
James Prestwood
313d8dbbed auto-t: remove requirement for /var/lib/{ead,iwd}
The host systems configuration directories for IWD/EAD were
being mounted in the virtual machine. This required that the
host create these directories before hand. Instead we can
just set up the system and IWD/EAD to use directories in /tmp
that we create when we start the VM. This avoids the need for
any host configuration.
2020-10-14 13:03:17 -05:00
James Prestwood
df0b64f8d0 auto-t: add EAD autotest 2020-09-17 16:20:04 -05:00
James Prestwood
c707bee6ac auto-t: add ead.py module
This module is essentially a heavily stripped down version of iwd.py
to work with EAD. Class names were changed to match EAD but basically
the EAD, Adapter, and AdapterList classes map 1:1 to IWD, Device, and
DeviceList.
2020-09-17 16:19:37 -05:00
James Prestwood
ab51228b38 auto-t: allow IWDDBusAbstract to work with any service
This is somewhat of a hack, but the IWDDBusAbstract is a very
convenient abstraction to DBus objects. The only piece that restricts
it to IWD is the hardcoded IWD_SERVICE. Instead we can pass in a
keyword argument which defaults to IWD_SERVICE. That way other modules
(like EAD) can utilize this abstraction with their own service simply
by changing that service argument.
2020-09-17 16:18:31 -05:00
James Prestwood
5cf748e98b auto-t: modify copy_to_storage to take optional dir
This is to prepare for testing EAD, and in this case we need
to copy the 8021x config to /var/lib/ead instead of IWD's
config dir.
2020-09-17 16:18:03 -05:00
James Prestwood
1e8fedce6c auto-t: fix testNetconfig
The interface was hard coded to wln0 which works when running single
tests but not when running multiple. Instead use the actual ifname
that hostapd is using.
2020-09-17 16:17:57 -05:00
James Prestwood
d745fbe24e auto-t: update EAP-PEAP-SIM test to use ofono 2020-09-16 14:31:43 -05:00
James Prestwood
cc44f50d67 auto-t: remove sim_hardcoded tests 2020-09-16 14:31:30 -05:00
James Prestwood
2f51b51152 auto-t: add netconfig autotest
Tests that DHCP using IWD's internal netconfig functions properly.
The actual IP address assignment is not verified, but since IWD does
not signal the connection as successful unless DHCP succeeds we
can assume it was successful by checking that the device is connected.

The process of actually starting dhcpd and configuring the interfaces
is quite simple so it was left in the autotest itself. If (or when)
more tests require IP capabilities (p2p, FILS, etc) this could be
moved into test-runner itself and be made common. The reason I did not
put it in there now is a) because this is the only test and b) more
complex DHCP cases are likely to develop and may require more than this
simplistic setup (like multiple APs/interfaces)
2020-09-15 20:20:40 -05:00
James Prestwood
d78d0d5937 auto-t: remove old AdHoc APIs 2020-09-14 16:45:15 -05:00
James Prestwood
eeca2b3f38 auto-t: update AdHoc tests to use AdHocDevice 2020-09-14 16:45:12 -05:00
James Prestwood
29eb08ead2 auto-t: make AdHoc APIs behave like others
The AdHoc functionality in iwd.py was not consistent at all with
how all the other classes worked (my bad). Instead we can create
a very simple AdHocDevice class which inherits all the DBus magic
in the IWDDBusAbstract class.
2020-09-14 16:45:08 -05:00
James Prestwood
d232edde72 auto-t: replace waiting for network with device
Many tests waited on the network object 'connected' property after
issuing a Connect command. This is not correct as 'connected' is
set quite early in the connection process. The correct way of doing
this is waiting for the device state to change to connected.

This common code was replaced, hopefully putting to rest any random
failures that happen occasionally.
2020-09-14 16:03:04 -05:00
James Prestwood
4676dd7efd auto-t: fix testFT-PSK-roam
Some cleanup code got removed by mistake which cleared out any
hwsim rules before the next subtest. Without this the second test
would end up getting erroneous signal strength numbers in the scan
results causing a failure.
2020-09-14 16:03:04 -05:00
James Prestwood
1b03675002 auto-t: don't clear out rules from hwsim object
This got added in the re-write but a __del__ method was also
added to the Rule class as well. This caused problems if hwsim
cleaned up since it removed the rules, which caused each rule
to call __del__. Since the rule had already been removed there
was no longer a DBus interface which raised an exception.
2020-09-14 16:03:04 -05:00
James Prestwood
5b94c9d243 auto-t: remove hwsim rules on __del__
This prevents previous tests rules from carrying over into
future tests.
2020-09-11 13:42:13 -05:00
James Prestwood
5df28473cb auto-t: fix set_neighbor SSID escaping
Before the re-write there was interesting escapes being used for
set_neighbor. Curiously now hostapd fails to set the neighbor due
to these escapes so they have been removed.
2020-09-11 13:42:13 -05:00
James Prestwood
d43a640d71 auto-t: fix testFT-PSK-roam
Switched around hwsim rules with the IWD initializer to avoid
IWD periodically scanning before hwsim rules are in place. Removed
some unneeded code during teardown.
2020-09-10 17:59:49 -05:00
James Prestwood
20b7540201 auto-t: fix testPreauth-roam
Changed to wait for DeviceState instead of network object as well
as moved hwsim rules ahead of the IWD initializer to avoid IWD
scanning before the rules are fully in place.
2020-09-10 17:59:49 -05:00
James Prestwood
cf3ea5d4df auto-t: fix testWPA2 to wait for device object 2020-09-10 17:59:49 -05:00
James Prestwood
8b41413170 auto-t: harden testHotspot
This test occationally failed, and it uses the old style of waiting
for connected on the network object instead of the device object.

The hwsim rule was also moved ahead of the IWD() initializer which
ensures that IWD doesn't scan before the rule can be set/processed.
2020-09-10 17:59:49 -05:00
James Prestwood
e81b1b77c8 auto-t: fix testAPRoam
This test occationally fails due to no hwsim rules. Basically we
were just expecting iwd to connect to one of 3 access points but
the ranking was equal, so it chose the first in the scan list.

Now a signal strength is assigned to each AP to steer IWD into
connecting to the expected AP.
2020-09-10 17:59:49 -05:00
James Prestwood
b437bfaced auto-t: fix testAP
As with other tests, wait on device state instead of the network
object. The connectivity test was also changed to not check for
group traffic since AP does not negotiate the IGTK at this time.
2020-09-10 17:59:49 -05:00
James Prestwood
7b933db78a auto-t: fix testBSSBlacklist
There were a number of fixes here. The waits were changed to wait
on the device state instead of the network state and hwsim rules
were removed after the test as to not interfere with future tests.
One of the rules was setting the signal to -10000 wich was causing
the ranking to be zero.
2020-09-10 17:59:49 -05:00
James Prestwood
b9cb6134d6 auto-t: update testAgent to use TestContext
This hides iwctl output unless verbose is specified
2020-09-10 17:59:49 -05:00
James Prestwood
03ff410dff auto-t: update testClientNonInteractive to use TestContext
This makes any iwctl output hidden unless enabled via the verbose
option.
2020-09-10 17:59:49 -05:00
James Prestwood
4c6173ee89 auto-t: fix SAE FT test and update
Updated testFT-SAE-roam to use the TestContext APIs as well as
fixed the failure which was introduced after requiring stricter
AKM logic for SAE networks. The new failure was due to the hostapd
config not including the standard SAE AKM which is actually
required by the spec.
2020-09-10 17:59:49 -05:00
James Prestwood
6e2aba3907 auto-t: Increase all test timeouts
Slower systems may not be able to make some timeouts that tests
mandated. All timeouts were increased significantly to allow tests
to pass on slow systems.
2020-09-10 17:59:49 -05:00
James Prestwood
0036cb976f auto-t: hwsim: wait for method return
It is not safe to assume that the python dbus implementation will
wait for a method to return. The documentation says this with
respect to reply_handler/error_handler:

"If both are None, the implementation may request that no reply is sent"

To stay on the safe side we should always include the error/reply
handlers and wait for the operation to complete.
2020-09-10 17:59:49 -05:00
James Prestwood
9bb5ecf27a auto-t: remove device.wait_for_connected
I had added this without realizing wait_for_object_condition
can do this already using the device object.
2020-09-10 17:59:49 -05:00
James Prestwood
2e3ad0f6b3 auto-t: replace hard-coded interfaces
test-runner now supports interface name replacement inside hostapd
config files. Since a given test configuration doesn't know what
interface names there will be $ifaceN can be specified instead e.g.

rsn_preauth_interfaces=$iface0 $iface1

The $ifaceN values will be replace with actual interface names when
the test is started.

This patch also removes ctrl_interface inside the hostapd config
files as this is no longer required.
2020-09-10 17:59:49 -05:00
James Prestwood
0d5409eb04 auto-t: skip ofono tests if ofonod isn't running 2020-09-10 17:59:49 -05:00
James Prestwood
1f404e32a6 auto-t: fix testSAE autoconnect_test.py
This test was unreliable since it was assuming a periodic scan would
happen at just the right time. Instead since we are expecting autoconnect
we can just wait for DeviceState.connected then after we are connected
verify the network was correct.
2020-09-10 17:59:49 -05:00
James Prestwood
2bd2462968 auto-t: fix hidden network test
This test was never 100% reliable, and after the test-runner re-write
it became extremely unreliable. The issue came down to the very common
block of code thats present in many tests where we wait for obj.scanning
then not obj.scanning. This is fine when a dbus scan() is explicitly
done before, otherwise it could lead to problems. Without a dbus scan
explicitly called we are assuming a periodic scan will happen. If it
already happen the initial wait for obj.scanning will never return and
time out.

This probably needs to be changed in several tests, but for this specific
case we can remove the waits completely. Since
check_autoconnect_hidden_network has a 30 second wait on
DeviceState.connected this will ultimately time out if anything goes
wrong. There isn't any great reason to wait for scanning (for this test
specifically).

A minor style change was also made when initializing IWD. The values
passed in this test are now the default, so no arguments need to be
passed.
2020-09-10 17:59:49 -05:00
James Prestwood
3ec3855de9 auto-t: remove wiphy.py
This is no longer needed
2020-09-10 17:59:49 -05:00
James Prestwood
91adbcb7f4 auto-t: iwd.py: update to work with test-runner rewrite
iwd.py was updated to use the TestContext APIs to start/stop
IWD. This makes the process managment consistent between starting
IWD from test-runner or from the IWD() constructor.

The psk agent is now tracked, and destroyed upon __del__. This is
to fix issues where a test throws an exception and never
unregisters the agent, causing future tests to fail.

The configuration directory was also chaged to /tmp by
default. This was done since all tests which used this used /tmp
anyways.

The GLib mainloop was removed, and instead put into test-runner
itself. Now any mainloop operations can use ctx.mainloop instead
2020-09-10 17:59:49 -05:00
James Prestwood
ad97dbee08 auto-t: ofono.py: fix timeout cleanup and wait for service
Ofono.py was not cleaning up the timeout, nor waiting for the ofono.org
service to come up before continuing.
2020-09-10 17:59:49 -05:00