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

127 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
d78d0d5937 auto-t: remove old AdHoc APIs 2020-09-14 16:45:15 -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
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
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
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
Tim Kourt
7ef7894218 auto-t: Add async API call for connect_hidden_network 2020-06-09 21:58:52 -05:00
Tim Kourt
ae4b361f79 auto-t: Return None instead of empty known net list
To match the original behavior of get_ordered_networks,
return None for the empty list of known networks after the scan
is complete
2020-05-02 07:03:05 -05:00
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
Denis Kenzior
22cba31c8b auto-t: update to the new AgentManager path 2019-10-28 18:08:54 -05:00
James Prestwood
fc9342f751 auto-t: return None with get_ordered_network(s)
If no networks are found, return None rather than an empty
array. This is easier to check by the caller (and was assumed
in some cases). Also add an exception to get_ordered_network
if no network is found.
2019-10-28 14:59:58 -05:00
Denis Kenzior
2521830d3e auto-t: Update to use InvalidArguments error 2019-10-24 10:54:45 -05:00
Denis Kenzior
584712dc6d auto-t: Update to the new wsc api naming 2019-10-24 10:49:13 -05:00
James Prestwood
50c947b53c auto-t: set CONFIGURATION_DIRECTORY
The --config option was removed, so any tests which start IWD from
python need to set this option if they need a special configuration
directory.
2019-09-09 15:40:09 -05:00
James Prestwood
0846f76703 auto-t: add 'hotspot' network type 2019-08-21 14:16:08 -05:00
James Prestwood
ce9e61d727 auto-t: hotspot dir not hidden 2019-07-15 11:14:01 -05:00
James Prestwood
cdc80cd341 auto-t: add copy_to_hotspot
Initially the solution to copying files to .hotspot was to use the
existing copy_to_storage, but allow full directory copying. Doing it
this way does not allow us to copy single files into .hotspot which
makes it difficult to test single configurations in several consecutive
tests.

This adds a new API, copy_to_hotspot, where a single hotspot config
can be provided. clear_storage was also modified to clear out the
.hotspot directory in addition to the regular storage directory.
2019-07-03 13:02:28 -05:00
James Prestwood
1a2f10dacd auto-t: allow copy_to_storage to copy directories 2019-07-03 11:36:08 -05:00
James Prestwood
f30c4bf578 auto-t: handle exceptions correctly for start_ap
The start_ap method was raising potential dbus errors before converting
them to an IWD error type. This is due to dbus.Set() not taking an error
handler. The only way to address this is to catch the error, convert it
and raise the converted error.
2019-05-13 16:38:23 -05:00
Andrew Zaborowski
576d8ad123 autotests: In testutil obtain interface list dynamically
For the interface connectivity tests obtain the lists of interfaces in
use directly from the IWD class, which has the current list from DBus
properties.
2019-04-22 18:16:11 -05:00
Andrew Zaborowski
e13c749d1e autotests: Update the wiphy_map and hostapd_map structs
In the test utilties updated the wiphy_map struct built from the
TEST_WIPHY_LIST variable to parse the new format and to use a new
structure where each wiphy is a namedtuple and each interface under it
also contains a reference to that wiphy.  The 'use' field is now
assigned to the wiphy instead of to the interface.
2019-04-22 16:34:17 -05:00
Tim Kourt
20ac57783b auto-t: AdHoc - address race condition
The AdHoc methods used to miss the change in properties
on AdHoc interface. To address the race condition, we
subscribe 'PropertiesChanged' signal first and then do
GetAll properties call. This way we are not missing
'PropertiesChanged' signal in between these calls.
2019-03-22 12:40:11 -05:00
James Prestwood
8956451b26 test-runner: decouple --verbose with --valgrind
When using --valgrind, you must also use --verbose iwd, and, depending
on the tests you may also need to include pytests in the verbose flag.
Since anyone using --valgrind definitely wants to see valgrind info
printed they should not need to enable verbose printing. Also, manually
parsing valgrind prints with IWD prints mixed throughout is a nightmare
even for a single test.

This patch uses valgrind's --log-file flag, which is directed to
/tmp/valgrind.log. After the tests runs we can print out this file.
2019-01-18 08:57:21 -06:00
James Prestwood
9d3d65a282 auto-t: add get_ordered_network(ssid)
This is a helper/shortcut to get_ordered_networks (plural). In nearly
all the autotests we had (roughly) the same block of code:

ordered_network = get_ordered_networks()[0]

self.assertNotEqual(ordered_network, None)
self.assertEqual(ordered_network.name, "someSsid")

Rather than having to do this, we can simplify and just have a single
call to get_ordered_network, which takes the SSID. If the SSID is not
found, we raise an exception. This avoids needing both asserts since
we are guarenteed that the return is valid and the SSID matches.

This also avoids possible issues with multiple networks showing up in
the GetOrderedNetworks call. Eventually test-runner will support running
tests on real wireless hardware, so its possible we could pick up
unexpected networks in the scan.
2018-12-14 13:46:32 -06:00
James Prestwood
699b83cb1f auto-t: removed ';' from many autotests
At some point a stray ';' got added into an autotest in a section
of code that is heavily copy pasted. So in turn nearly all the autotests
have this stray ';' after list_devices (and a few in other places).
2018-12-14 13:46:23 -06:00
Andrew Zaborowski
d558724676 autotests: Update expected error in password length test 2018-12-03 14:21:30 -06:00
Denis Kenzior
332d4f8e61 auto-t: Add additional utilities for WPS PIN support 2018-09-24 12:19:27 -05:00
Tim Kourt
3d43d633d1 auto-t: address Dbus API changes
This is a temporary fix to address the recent split of
the Device interface. This patch contains a workaround that
re-enables the auto-tests while the test framework is being
reworked to satisfy the need of the new API and should not
be considered as a permanent solution.
2018-09-19 11:59:28 -05:00
James Prestwood
96330fd75a auto-t: fix OrderedNetwork to work with station API 2018-09-14 21:45:59 -05:00
Denis Kenzior
9ac46e900e auto-t: Use Station interface for methods 2018-09-05 11:09:35 -05:00
Denis Kenzior
0912a6afb8 auto-t: Convert RSSI agent test to the new API 2018-09-04 23:57:14 -05:00
Denis Kenzior
fac55f6891 auto-t: Rename SignalLevelChanged to Changed 2018-08-13 20:40:59 -05:00
James Prestwood
4ddb95e147 auto-t: made waiting for network connection optional
The default behavior of NetworkObject.connect() is to wait for the
Connect dbus method to reply before returning back to the test. This
change makes it possible to connect, but not wait for a reply and
continue on with the test (by specifying wait=False). This is
specifically required to test SAE anti-clogging, where the AP needs
to have several simultaneous connections at once for the anti-clogging
logic to trigger. This change also adds Device.wait_for_connected()
which waits for the device interface State variable to be "connected".
2018-08-09 15:22:18 -05:00
Andrew Zaborowski
127c37ba66 autotests: Test filesystem watch in testKnownNetworks 2018-08-09 10:35:48 -05:00
Andrew Zaborowski
5dd7bd0201 autotests: Update testKnownNetworks with DBus API changes 2018-07-31 11:53:02 -05:00
Andrew Zaborowski
e084b11d39 autotests: Wait for ConnectHiddenNetwork to finish
This lets the testHiddenNetworks tests check if exceptions have been
raised, makes exceptions_test.py pass.
2018-07-23 11:46:03 -05:00
James Prestwood
12b3ac47fd auto-t: Added adhoc util functions to IWD class 2018-07-17 17:02:59 -05:00
James Prestwood
003c1dbc97 auto-t: Changed list_devices() wait_to_appear to int
The list_devices API has a race condition where sometimes it will
return zero or less than the expected number of devices and fail
the test. A fix is in place for when only a single devices is
expected, but some tests expect more than one device. This changes
wait_to_appear to an integer, and the caller can specify the number
of devices they expect to get back. The default stays as it was,
zero or "return cached devices".
2018-07-02 13:05:34 -05:00
James Prestwood
7fedc2bf66 auto-t: Updated start/stop_ap to use new interface 2018-06-29 18:28:41 -05:00
Tim Kourt
5eb043e501 autotests: support new errors 2018-06-29 13:46:36 -05:00
Tim Kourt
e9fef6ba52 auto-t: add connect API for the hidden networks
In addition, add dbus exception for the service set overlap
2018-06-28 15:59:18 -05:00
Tim Kourt
395a70d652 auto-t: fix wait logic for the devices
In addition, it makes InterfacesAdded\Removed handlers
a little more generic.
2018-06-28 15:57:49 -05:00
Tim Kourt
d402b6034a auto-t: enable debug output for iwd
This enables debug output for iwd when started from python
2018-05-31 19:28:16 -05:00
Denis Kenzior
6c2ecc6ca5 autotests: Bump iwd startup timeout
iwd now performs a lot of crypto checks at startup, so the timeout was
sometimes being triggered.
2018-05-30 22:36:41 -05:00
Tim Kourt
6ccb99d98b auto-t: fix python interface handler for devices 2018-05-21 17:44:44 -05:00
Tim Kourt
102a455e00 auto-t: Enable test frwk to wait for the radios
Previously, we had to wait for an arbitrary amount of time after
iwd was started form the python scripts to make sure that the
radio objects are available on the D-bus. This patch allows to
wait inside of list_devices() method and get back a list of the
devices once they are available.
2018-05-15 14:32:51 -05:00
James Prestwood
a83419011e auto-t: Honor valgrind flag if iwd starts from python
Before starting iwd, we check if IWD_TEST_VALGRIND was set
by test-runner, and if so, start iwd with the appropriate
valgrind options.
2018-04-27 11:21:36 -05:00
Andrew Zaborowski
099f2ecc12 autotests: Add new DBus methods to PSKAgent 2018-04-19 14:09:57 -05:00
Andrew Zaborowski
a8c30cd25e autotests: Accept a list of passphrases in PSKAgent
Allow passing a list of passphrases for subsequent agent requests to the
PSKAgent constructor.  This also makes existing tests stricter because
a spurious agent request will not receive the same passphrase.
2018-04-19 14:09:52 -05:00
James Prestwood
e889452dde auto-t: disable timeouts in IWD class when debugging
If --gdb is used with test-runner, all the timeouts in the
IWD class must be turned off otherwise the test will fail.
Inside test-runner, a environment variable (IWD_TEST_TIMEOUTS)
is set to either 'on' or 'off'. Then the IWD class (and any
others) can handle the timeouts accordingly. Note that this
does not turn off dbus timeouts, rather it ignores timeout
failures. This does mean that ultimately the test will most
likely fail due to a dbus timeout, but it at least gives you
unlimited debugging time.
2018-04-02 12:49:52 -05:00
Tim Kourt
774cfba1c4 auto-t: add NotConfigured dbus exception 2017-10-26 16:00:42 -05:00
Andrew Zaborowski
828b8b7708 autotests: Add the AP mode test 2017-10-23 11:17:14 -05:00
Andrew Zaborowski
06b8be902e autotests: Reset _exception after _wait_for_async_op
We need to reset self._exception after _wait_for_async_op raises an
exception, otherwise _wait_for_async_op will report that exception for
every future operation (this wasn't an issue when an exception always
meant that the test was failing and objects were torn down anyway)
2017-10-12 10:55:59 -05:00
Andrew Zaborowski
ca1ef2d82f autotests: Add a utilities for the SignalLevelAgent API 2017-05-30 11:42:11 -05:00
Andrew Zaborowski
920e79b32c autotests: Add IWD.wait utility for sleeping inside tests 2017-05-16 15:29:53 -05:00
Andrew Zaborowski
f5036d7e1f autotests: Always wait for DBus name in IWD.__init__
Sometimes iwd will take a while to register its dbus name.  The python
class already waits for the name to appear on dbus if iwd is being
launched from python, do this also if iwd was already launched by the
test-runner.  My use case was when running iwd under valgrind in which
case it runs slower.
2017-04-26 14:44:47 -05:00
Andrew Zaborowski
bb350a3b8e autotests: Avoid periodic polling in the wait methods
Modify AsyncOpAbstract._wait_for_async_op and
IWD.wait_for_object_condition to call context.iteration() in the
blocking mode instead of calling context.pending() every 0.01s.  This
gets rid of busy-waiting and also ensures that the condition is checked
after every single dbus (or other) event.  This way a condition that
potentially occurs for less than 0.01s can be reliably waited for.
2017-03-28 19:57:16 -05:00
Andrew Zaborowski
1df2e18f61 autotests: Add FT roaming test and utility functions
This tests the FT-PSK initial Mobility Domain authentication, neighbor
reports, scanning on a subset of frequencies and FT transition.
2017-03-28 15:38:38 -05:00
Andrew Zaborowski
ebc2092c42 autotests: Pass wiphy whitelist in iwd command line
Pass the -p parameter to the iwd process started by iwd.py (only used by
testKnownNetworks) same as when iwd is started by test-runner.c
2017-03-28 15:33:25 -05:00
Denis Kenzior
ed69774dbc autotests: Clean up iwd process
If the process is launched by the test, then clean it up when the test
is cleaned up
2016-12-20 12:44:52 -06:00
Tim Kourt
bc2396b4f7 auto-t: Add config file arg. to IWD start script 2016-11-02 17:42:36 -05:00
Tim Kourt
201574bdf1 auto-t: Add WPS API to device 2016-10-05 18:08:43 -05:00
Tim Kourt
135095b6a3 auto-t: Add prefix for output formating 2016-10-05 18:06:52 -05:00
Tim Kourt
21b42a0ff4 auto-t: Convert net type to str for dbus 2016-10-05 18:06:52 -05:00
Tim Kourt
cb114a649f auto-t: switch to 'get' for the optional fields 2016-10-05 18:06:52 -05:00
Tim Kourt
b7c1a068b6 auto-t: Expand "to string" for known network 2016-10-05 18:06:52 -05:00
Tim Kourt
d429d78940 auto-t: Optionally start iwd from python lib 2016-10-05 18:06:52 -05:00
Tim Kourt
29ee5d0946 auto-t: Add python test lib for IWD 2016-10-03 14:16:39 -05:00