Commit Graph

80 Commits

Author SHA1 Message Date
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 0c554500e1 auto-t: add simple getter for radios 2019-06-11 11:44:00 -05:00
James Prestwood 35f06ef87a auto-t: hostapd: allow CLI to lookup by config file
There is a common interface lookup in many tests in order to initialize
the HostapdCLI object e.g.:

for intf in hostapd_map.values():
    if intf.config == 'ssidOWE.conf':
        hapd = HostapdCLI(intf)
        break

Instead of having to do this in every test, HostapdCLI will now
optionally take a config file (config=<file>). The interface object
will still be prefered (i.e. supplying an interface will not even
check the config file) as to not break existing tests. But if only
a config file is supplied the lookup is done internally.

There are some tests that do still need the interface, as they do
an interface lookup to initialize both hostapd and hwsim at the
same time.
2019-06-05 16:18:26 -05:00
James Prestwood 55a077d399 auto-t: testutil: allow skipping of group traffic test
If the network does not support group traffic we can now skip the
broadcast test by specifying group=False in test_ifaces_connected.
2019-06-05 16:18:26 -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 0a196025f2 autotests: Remove unneded loops
The hostapd_map dictionary is indexed by the interface name so there's
no point iterating over it to find that entry whose name matches, we can
look up by the name directly.  Simplify code.
2019-04-22 16:34:36 -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 06ee531749 testutil: retry up to 3 times for connectivity 2019-03-19 09:42:53 -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
Marcel Holtmann ea20559599 tools: Change net.connman.iwd.hwsim to net.connman.hwsim 2018-09-14 15:27:57 +02: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 7f437c30e3 auto-t: add eapol reauth cmd into hostapd mngr 2018-05-30 18:59:02 -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
James Prestwood 62bdf6c482 auto-t: hwsim fixup
Changed disassociate reason to 0x07 when spoofing a disassociate
frame. This along with 0x06 are the only two reason codes that
should be accepted in an unprotected disassociate frame.
2018-02-01 10:12:09 -06:00
James Prestwood 13429f8f2d auto-t: add spoofing frame support to hwsim util
Using the hwsim dbus interface ".Interface" under the radios
object you can now send an arbitrary frame out from that radio.
Two methods have been added, spoof_frame and spoof_disassociate.
2018-01-30 23:03:55 -06:00
James Prestwood fe616fbfa5 auto-t: hostapd util get_config_value and get_freq
The hwsim SendFrame method requires the radio frequency which
is obtained from the hostapd config file. This adds a generic
API to get any config value from the hostapd config, as well
as a get_freq API that converts the channel number to a
frequency.
2018-01-30 23:03:51 -06:00
James Prestwood 0db0ce43b8 auto-t: add ungraceful restart to hostapd util
For testing SA Query, the autotest needs the ablility to force
kill (and restart) hostapd without giving it time to deauth its
stations gracefully. A method was added to the HostapdCLI class
which does a killall -9 hostapd, resets the wlnX interface,
and restarts hostapd with the same arguments as it had before.
2018-01-29 14:05:57 -06:00
James Prestwood 27a35da0ba autotests: add AP roam support to hostapd.py 2018-01-18 15:35:38 -06:00
James Prestwood 6a9de526a8 autotest: fix possible hlrauc race condition
The AuthCenter will now wait for the RX thread to start before
continuing with the test.

Also removed the non blocking option and fixed the loop to
handle a blocking recvfrom call.
2018-01-18 14:43:53 -06:00
James Prestwood 6942e9c7b1 autotest: Added ofono.py utility
A new class which can be used to power on a modem and wait
for the Interfaces/Properties EAP-SIM/AKA need for
authentication.
2017-12-14 17:47:29 -06:00
James Prestwood e9e96604c5 autotests: fix issue with hlrauc reading sim database
hlrauc.py was not stripping out newlines when reading the sim
database files.

Also added a print if an exception occurred.
2017-12-13 17:13:29 -06:00