Commit Graph

222 Commits

Author SHA1 Message Date
Denis Kenzior ed8a4ab931 treewide: Make global variables static 2019-08-15 15:06:59 -05:00
James Prestwood d2639e5d4e test-runner: log iwd output for --shell
This will allow the user to see the iwd output in /tmp/iwd.log.

execute_program was extended to take a 'log' flag. If true, this
will cause the programs output to be stored in /tmp/<name>.log.
This is only useful when using the --shell command as this file
will go away once the VM stops. The verbose flag always overrides
the logging functionality.

For now only iwd output is logged when using --shell.
2019-08-07 16:37:51 -05:00
James Prestwood da65acbd07 test-runner: allow booting directly into a shell
It is sometimes valuable to just boot into a shell in order to manually
test functionality. Since test-runner already is setup to run a minimal
kernel with all the necessary requirements for hostapd/iwd it made
sense to allow the user to do this.

If -s,--shell is passed into test runner, no python tests will be run.
The hw.conf file is still used to setup IWD and hostapd so once booted
into the shell you can still (manually) run the test (e.g. via iwctl).

This also works when using USB/PCI passthrough. This makes testing
out different kernel version with real hardware much quicker than
using the host kernel.
2019-08-07 16:37:51 -05:00
James Prestwood d8dac9a330 tools: add tool for iOS mobileconfig conversion
This tool will convert an iOS 'mobileconfig' file into the IWD
format. The tool only supports PEAP and TTLS networks, including
hotspots.

It will also parse out any certificate chains found in the
mobileconfig file, and verify they lead to a root CA found on the
system. If they do, this root CA will be used as the CACert in
the provisioning file.
2019-07-29 14:04:03 -05:00
James Prestwood edd4f2b2a2 test-runner: allow glob matching of tests
This allows a glob match of tests, e.g.

./test-runner -A testEAP-TTLS*

would run all TTLS based tests
2019-06-05 16:49:45 -05:00
Denis Kenzior 71ebc00fb7 tools: Update test-runner to the new genl api 2019-05-17 17:10:15 -05:00
Denis Kenzior dea23bede7 tools: Update hwsim to the new genl api 2019-05-17 17:10:13 -05:00
James Prestwood f038c11205 test-runner: allow disabling of iftype/cipher
Two new hardware configuration keys were added:

[radX]
iftype_disable=station,ap,adhoc,p2p_client,p2p_go,mesh_point
cipher_disable=wep40,wep104,tkip,ccmp,bip

Any of the above values are supported and can be disabled.
2019-05-13 16:38:23 -05:00
James Prestwood 2d173e5f24 test-runner: add a radio parameters structure for creation
Support is coming to configure radios with a specific set of interface
type and cipher support, so the input to create_hwsim_radio is better
suited to use a parameter structure rather than adding more parameters.
2019-05-13 16:38:23 -05:00
James Prestwood 2d51622c0b test-runner: allow radio list subset to be configured
The radio_confs key was parsed in a way that required all radios
to be specified in the list. This isnt optimal, as you may want to
specially configure a certain radio, while keeping all the others
default.

This change reworks some logic and allows any radio to be specially
configured on its own.
2019-05-13 16:38:23 -05:00
James Prestwood 0e31b33631 hwsim: allow specific radio iftypes/ciphers
mac80211_hwsim now allows setting supported iftypes/ciphers. This patch
enables this support in hwsim. Specific iftypes/ciphers can now be
disabled via the command line when creating a radio:

Disable iftypes:
--iftype-disable station,ap,adhoc,p2p_client,p2p_go,mesh_point

Disable cipher types:
--cipher-disable ccmp,tkip,wep
2019-05-13 16:38:23 -05:00
James Prestwood 79dd04c13a test-runner: in native HW mode, check for AP capabilities
The test should be aborted if there are not enough radios that support
AP mode. The iftype attribute will now be parsed during the wiphy dump
and a flag is set on the wiphy so we know to skip this radio when
creating the hostapd instances. Since hostapd gets started first, it
will automatically choose all the radios it needs which support AP mode.
This leaves the remainder of the radios (potentially STA only) for IWD.
2019-05-13 14:13:34 -05:00
James Prestwood 7c7aafa812 test-runner: skip hostapd iface creation if native HW
In native hardware mode the interfaces already exist, so there is
no need for hostapd to create new ones.
2019-05-13 14:13:18 -05:00
James Prestwood 97ec50ce28 test-runner: fix radio index 0 deletion
In the PCI/USB passthrough changes the wiphy ID was changed to be an
unsigned integer, where id zero corresponded to an error when in native
hardware mode. Along with this, the radio ID for hwsim was changed to a
pre-increment (only in test-runner), so the radio IDs would start at 1.
The repercussions were not fully investigated, but if they were it would
have been seen that hwsim creates radios IDs starting at zero. This left
test-runner and hwsim with unsynchronized radio IDs, and radio zero
never got deleted after each test causing each successive test to
discover old radio IDs.
2019-05-13 14:11:54 -05:00
Andrew Zaborowski d256bc91ad test-runner: Drop options no longer supported by qemu
-nodefconfig doesn't exist anymore and according to the docs it either
had the same meaning or was implied by -no-user-config so it wouldn't be
needed anyway.  -balloon doesn't exist anymore and according to
https://lists.gnu.org/archive/html/qemu-devel/2018-02/msg06985.html
"-balloon none" was a nop, but I suspect -nodefaults may have already
had the effect of disabling creation of the virtio-balloon device.
2019-05-10 14:15:51 -05:00
James Prestwood 07115e56a1 test-runner: Allow native hardware passthrough
This patch allows the host machine to pass through its PCI/USB network
cards into the test-runner virtual machine. By doing this we can run
nearly all the same autotests using physical/real wireless hardware.

First off, utilizing this feature requires a properly configured host
machine. There are kernel boot parameters and config files that need to
be configured before any of this will work. Unfortunately there is no
way around this, and hence this feature is not particularly aimed for
"the masses", but rather for specially configured test machines.

A new configuration file was introduced (tools/hw.conf) which is just an
example, it should be edited to work with the host machine using it. This
file merely holds the PCI addresses/USB bus of the devices you wish to pass
through to qemu.

Passing in this hardware config file with --hw <file> tells test-runner
that you are attempting to use this new feature. The tests themselves
do not need to change, its the initial test setup that required some
changes.

Since we are no longer creating radios we must discover the radios that
are present (once in the VM). This is done using borrowed code from IWD
to dump wiphys and interfaces. As the wiphys/interfaces are dumped, we
build up the wiphy list. In the hwsim case we still build this list up
when we create the radios, which hasn't changed. This does lead us to
have some special cleaup, where in the native case we just 'reset' the
list into its state pre-test (removing any hostapd flags). And as before
with the hwsim case we fully destroy and free the wiphy list, since a
new list will be created on the next test (along with new radios).

There should not need to be any changes to the tests themselves, but
potentially to some hw.conf files. A new key was introduced, 'needs_hwsim'
which need to be set on any tests that require the hwsim dbus API. This
tells test-runner to skip this test, otherwise it would fail in native
mode.

One last minor detail; the wiphy->id was changed to an unsigned int. This
is to match the type the kernel uses when dumping wiphys. Because of
this '0' is now the error case for both hwsim and native mode rather than
-1. Error checks were updated accordingly.
2019-05-01 17:03:34 -05:00
Andrew Zaborowski d1c4921b86 test-runner: Only create/remove interfaces for hostapd
Move the interface creation code from configure_hw_radios to
configure_hostapd_instaces so as not to create unneeded interfaces on
the wiphys that IWD is going to manage.  We pass a wiphy whitelist to
IWD later and IWD now creates the interfaces it needs on those managed
wiphys.  Change TEST_WIPHY_LIST format to only include the interface
name for the wiphys used by hostapd.

Note that we still remove interfaces just before removing the hwsim
radios on exit, it seems like there's no point removing the interfaces
in that case.
2019-04-22 16:33:40 -05:00
Andrew Zaborowski 20faa37467 test-runner: Futher fix for the SETUP group support
Drop a pointless asignment of has_hw_conf to false when it's already
false, fix index when accessing radio_conf_list.  Apparently the SETUP
group is not used in any of our test and wasn't tested itself so could
as well have removed the code.
2019-04-22 16:33:40 -05:00
Andrew Zaborowski 1462d68eb6 test-runner: Check radio_conf_list is not null
The option may be present but may not parse correctly as a list in which
case has_hw_conf will be true but radio_conf_list will be NULL and we
might crash.
2019-04-22 16:33:40 -05:00
Andrew Zaborowski fcd5b8b54f test-runner: Drop unused wiphy.interface_index 2019-04-22 16:33:16 -05:00
James Prestwood 71c7d826e4 tools: fix test_runner_kernel_config for HT/VHT
This should now properly load regulatory.db and disable verification
2019-03-18 12:21:49 -05:00
James Prestwood 7b3831515a test-runner: allow test to set the regulatory domain
HT/VHT require setting the regulatory domain to something other
than 00. This adds an option to the hardware config which allows
the regulatory domain to be set to any country.
2019-02-21 16:45:30 -06:00
James Prestwood c275581389 tools: add option to disable reg domain verification
HT/VHT require channels who's use is restricted depending on
country. When using these channels, cfg80211 tries to load the
regulatory.db file in /lib/firmware and verify the signature.
This poses a problem as the host machine may not have a signed
regulatory.db, or it may have not been signed with the expected
signature which would cause cfg80211 to fail to load the database.

If cfg80211 fails to load the database the country will be set to
00, which is the most restrictive "world roaming" setting. This
does not allow HT/VHT to work properly.

In the context of test-runner we can simply disable the verification.
Unforunately this is not a very common practice, so CONFIG_EXPERT
must be enabled.

If your system does not have /lib/firmware/regulatory.db you must
get it. More info can be found here:

https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb
2019-02-21 16:42:48 -06:00
Mat Martineau 645b7dda4b tools: Add CONFIG_CRYPTO_USER_API_AEAD for full TLS support 2019-02-17 20:43:38 -06: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 1927e40fd0 test-runner: fix garbage output on test start
I missed this on a previous commit fixing the same issue with printing
the test results. This fixes garbage output on lines in between test
runs.
2019-01-17 15:43:12 -06:00
James Prestwood 2ec66c9d3f test-runner: fixed garbage output in test results
When printing test results the line separators were not NULL terminated
causing garbage bytes to be printed at the end.
2018-12-17 11:17:34 -06:00
James Prestwood dd835aba2e test-runner: fix removal of SIM/AKA/AKA' files
If ofono/phonesim is not found on the system, any test requiring those will
be skipped. In this case we would still try and remove symlinks that were
never created. An error would be printed, but the actual source tree files
were getting removed. This adds a new goto label where we can skip the tmpfs
removal in this error case.
2018-12-05 22:24:08 -06:00
Andrew Zaborowski 862707f943 test-runner: Add dbus verbose output options
-v dbus may help debug find client authentication problems but if
everything is ok it will not print any messages.  -v dbus-monitor starts
the dbus-monitor.
2018-11-30 10:26:30 -06:00
Tim Kourt 2cc4fdbf45 t-runner: Add verbosity option for TLS debug 2018-11-02 15:54:32 -05:00
Denis Kenzior a4512f3cd6 hwsim: Use l_genl_family_set_unicast_handler 2018-11-02 15:52:56 -05:00
Marcel Holtmann 554e4f55db build: Fix includes for using with -std=c99 compiler option 2018-11-01 22:37:11 +01:00
Marcel Holtmann 72a64fa7fb build: Adjust to the latest ELL signal API changes 2018-11-01 22:09:19 +01:00
Marcel Holtmann 2b36727f3a test-runner: Use l_main_run_with_signal instead of open coding it 2018-11-01 20:46:18 +01:00
Marcel Holtmann 36f5056810 hwsim: Use l_main_run_with_signal instead of open coding it 2018-11-01 19:58:34 +01:00
James Prestwood a2df686d97 hwsim: limit "Unknown attribute type:" print
Since we don't catch all hwsim attribute types in unicast_handler
you see tons of "Unknown attribute type: X" prints. Since this is
not an error, we should only print if the attribute does not exist
in the attribute list.
2018-10-24 16:23:12 -05:00
James Prestwood ceca5c42ba hwsim: update hwsim attrs to latest mac80211_hwsim 2018-10-24 16:23:12 -05:00
Marcel Holtmann 2606bc73ad build: Add DAEMON_ prefix to CONFIGDIR and STORAGEDIR 2018-09-14 17:58:44 +02:00
Marcel Holtmann ea20559599 tools: Change net.connman.iwd.hwsim to net.connman.hwsim 2018-09-14 15:27:57 +02:00
Marcel Holtmann 502aac073f tools: Add configure option and D-Bus policy file for hwsim utility 2018-09-14 15:24:15 +02:00
Marcel Holtmann b88388b172 hwsim: Fix missing handling of help option -h 2018-09-14 15:17:14 +02:00
Tim Kourt 83e66b5831 tools: add needed CONFIG_SECURITYFS option
Add CONFIG_SECURITYFS as a required configuration option
for the kernels to be used with test-runner.
2018-09-13 16:42:23 -05:00
Mat Martineau 27e9b6c435 tools: Remove unused kernel config
CONFIG_DRIVER_NL80211 isn't an option for the kernel. Maybe it was
mistakenly added based on the hostap configuration instructions in
doc/test-runner.txt

If the intent was to add CONFIG_CFG80211 and CONFIG_MAC80211, they're
already in the relevant kernel defconfigs.
2018-06-19 16:06:08 -05:00
Denis Kenzior e15caa2288 test-runner: Fix kernel command line parsing
Kernel command line arguments were not being parsed properly, $PATH in
particular was completely screwed up and causing commands in user's
$PATH to fail
2018-06-14 15:19:50 -05:00
James Prestwood 16a2fb2664 test-runner: added CONFIG_NLMON to kernel config 2018-05-24 19:42:19 -05:00
Andrew Zaborowski 465488878e hwsim: Look up radio address in radio_info
In mac80211_hwsim each radio is assigned two addresses, the second (addr
1) being used over nl80211.  In SendFrame we'd hardcode the mapping of
address 0 to address 1 even though we track all the addresses in radio_info,
so instead use that data to find the radio that has given address 0.  Also
if no address 0 matches what was supplied over DBus try to find a matching
address 1.

There are ways userspace can request different addresses when managing
mac80211_hwsim radios and the hardcoded mapping would become wrong.
2018-05-22 11:35:57 -05:00
Andrew Zaborowski 676a1f48c3 hwsim: Don't crash if source radio not found
We already print an error when this happens, no need to crash.
2018-05-22 11:35:05 -05:00
James Prestwood 23b9963b20 test-runner: fix iwd verbosity
Specifying --verbose iwd will now enable the -d flag for IWD
2018-05-21 17:49:01 -05:00
Denis Kenzior d13f10c111 test-runner: Add hwsim to --gdb support 2018-05-21 17:33:45 -05:00
Tim Kourt 79ce3f645f t-runner: init stat totals
the stat_totals structure was not initialized and produced
a garbage output when printed
2018-05-10 18:58:13 -05:00