Commit Graph

68 Commits

Author SHA1 Message Date
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
James Prestwood 263074511d autotests: updated hlrauc.py to support re-sync
If the peer detects a sync error, it sends back AUTS. The
authentication center must then re-synchronize and update
the SQN it has saved for the given ISMI.
2017-12-13 17:13:29 -06: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
James Prestwood 32907c10df autotest: make hlrauc.py able to run standalone
For testing purposes, it is useful to run hlrauc.py by itself
not including it from another python script like autotests do.

Better error checking was also added as testing can result in
badly formatted data.
2017-10-18 11:17:43 -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 d3cf79ed12 autotests: Restore AP beacons after timeout in testFT-PSK-roam
In the beacon loss test try to simulate a periodic communication problem
because we don't support roaming if the AP goes away completely.
2 seconds seems to be enough to consistently trigger the beacon_loss
event without triggering a disconnect by the linux kernel or hiding the AP
from the roam scan.  Also set the RSSI for that AP lower so that it is
not reselected by iwd.
2017-08-23 13:26:58 -05:00
James Prestwood 14dcda4d59 autotest: EAP-AKA autotest
Implemented milenage algorithm in hlrauc.py. Unlike EAP-SIM, the
authentication center must compute several values to give back
to the server (hostapd). This was already done by IWD as the peer
in EAP-AKA, but was also needed on the server side (HLR AuC).
2017-08-21 18:22:28 -05:00
James Prestwood 7c61d0365e autotest: EAP-SIM autotest
Included an HLR AuC python implementation that is required by
hostapd. This is what hostapd uses to retrieve SIM card values
over a UNIX socket.
2017-08-21 18:04:52 -05:00
Andrew Zaborowski 132d3ac11c autotests: Test operstate is IF_OPER_UP when state == connected
Test that iwd correctly sets the interface's operstate before and after
a roam, in the same autotests which run the connectivity check.
2017-05-30 17:08:36 -05:00
Andrew Zaborowski 71c15306fd autotests: Test communication when iwd reports connected
Test that the AP interface and the station interface managed by iwd
can actually send and receive ethernet traffic when iwd is in the
connected state.  Due to linux routing none of the high level utilities
like ping or arping can be easily used to test communication between
two interfaces of the same machine so use a method based on the
mac80211_hwsim/tools/hwsim_test.c utility in the wpa_supplicant tree
that uses a raw socket to inject unicast and broadcast frames.

Add this check in three tests of different security type connections
that simulate a single AP, and the two roaming tests with two APs.
Check that the station can't communicate with the other AP's interface.
2017-05-30 17:08:31 -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