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

255 Commits

Author SHA1 Message Date
James Prestwood
5709a4afcf test-runner: special case python3 verbose option
Historically if you wanted to see output from a python test you needed
to specify -v pytests. This was also the case if IWD was started from
python.

Nearly every time I run test-runner I would specify "-v iwd,pytests"
only to get the IWD output on these specific tests.

Instead we can special case 'python3' (previously 'pytests') inside
execute_program so that turning on verbosity for 'iwd' also turns it
on for the python tests.
2019-11-06 15:16:40 -06:00
James Prestwood
8ec4a53adb test-runner: refactor/fix valgrind logging issue
After the logging changes verbose IWD with valgrind did not show any IWD
output. This commit fixes this by checking the verbosity against log_name
rather than argv[0] since log_name has a special case for valgrind/iwd.

The valgrind logic in start_iwd was refactored to only use the --log-fd
option rather than using --log-file in addition to --log-fd.
2019-11-06 15:15:20 -06:00
James Prestwood
6bdb154da5 test-runner: log process output to host system
All the processes verbose output is just written to stdout, and very
hard to parse after the test runs. Having test-runner write the
processes output to separate log files is much nicer to view after
the test runs.

A read/write file system is created which is separate and isolated
from the current FS mount (which mounts the whole host file system).
Doing this requires the user to create a folder somewhere to be used
as the mount point. This folder is where all the log files will end
up after test-runner runs.

Since test-runner must be run as root, care was taken to keep the
log files owned by the user which runs test-runner. The UID/GID
are passed to the VM, and any log files created are chown'ed back
to the user who ran test-runner.

execute_program was refactored, and both verbose and log arguments
were removed. The verbose argument was not really required since
we can do check_verbosity(argv[0]) internally. The 'log' flag was
only used along with --shell, and now the user can simply use
--log instead of dumping /tmp/iwd.log.

You can use this feature by specifying --log[=path] to test-runner.
If no path is provided the current directory will be used. Using
the --log flag will result in all processes being run with the
--verbose flag.

A new folder will be created under the --log path. The folder will
be of the name "run-<year>-<month>-<dat>-<PID>". Under this folder
you will find any global process logs. These are processes that
are only run once for ALL tests (hwsim, ifconfig, dbus etc.). There
will also be folders for specific tests that were run. Inside these
test folders will be logs of processes that are run per-test (iwd,
hostapd, python etc.).
2019-11-04 14:41:18 -06:00
Denis Kenzior
fb76ca1f1c hwsim: Update to the new ell API 2019-10-28 15:02:30 -05:00
Marcel Holtmann
152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
Tim Kourt
25b3cb77e1 hwsim: Fix potential memory leak
If msg has multiple RADIO NAME attributes, memory leak occurs.

Note that this doesn't happen in practice.
2019-10-23 17:58:51 -05:00
James Prestwood
bf3b403e90 test-runner: fix double free issue on subtest queue
Coverity reported this as a leak, but the test queue is actually
getting freed later and does not need to be freed locally in add_path

This basically reverts c0863e5bc6
2019-10-23 12:28:51 -05:00
Tim Kourt
6fea4e6f4f t-runner: Check for errors after opening file 2019-10-22 21:57:31 -05:00
Tim Kourt
e3551ab56b t-runner: Check for NULL before using strcmp 2019-10-22 21:57:31 -05:00
Tim Kourt
e859e98869 t-runner: Fix possible assignment of NULL pointer 2019-10-22 21:57:31 -05:00
Tim Kourt
43efadcf92 t-runner: Fix out-of-bounds write 2019-10-22 21:57:31 -05:00
Tim Kourt
c0863e5bc6 t-runner: Fix mem leak caused by python test names 2019-10-22 21:57:31 -05:00
Tim Kourt
269bf497c7 t-runner: Fix mem leak caused by unclosed dir 2019-10-22 21:57:31 -05:00
Tim Kourt
7dd32ac093 t-runner: Fix mem leak with sim keys
Use l_settings_get_value instead of l_settings_get_string to
prevent unnecessary memory duplication.
2019-10-22 21:57:31 -05:00
Denis Kenzior
b6554ee41c hwsim: Invoke l_queue_remove prior to object deletion
While the current code is quite safe, the new ordering makes more
logical sense and doesn't confuse static analysis tools.
2019-10-17 13:03:08 -05:00
James Prestwood
e39bb6bfa0 test-runner: allow all unit tests to be run in VM
The -U parameter only allowed for a list of unit tests to be run.
Most of the time for sanity checking you want to run all the unit
tests so this has been changed to take an optional argument.

Now, the -U flag (by itself) will run all unit tests. Running a
single or list of unit tests can still be achieved by:

--unit-tests=test-eapol,test-crypto
2019-10-09 14:33:08 -05:00
James Prestwood
c4ecf2c5c6 tools: ios_convert: embed certs rather than using paths 2019-10-07 23:09:29 -05:00
James Prestwood
64ff5dda77 test-runner: sort test list alphabetically
This makes every full test run consistent. The test list was being
stored as a hashmap, which has no been changed to a queue so we can
insert each test sorted.
2019-09-24 10:07:40 -05:00
Marcel Holtmann
765bb92084 build: Add skeleton manual pages for all installed binaries 2019-09-22 21:57:47 +02:00
James Prestwood
d8aadc49b2 tools: enable CONFIG_CRYPTO_ARC4 in kernel config 2019-09-11 11:40:39 -05:00
Marcel Holtmann
1104d69e29 build: Add StateDirectoryMode=0700 option to systemd service 2019-09-09 06:55:22 +02:00
Marcel Holtmann
c1a9f71b39 build: Add script to start iwd.service via systemd-run 2019-09-08 22:10:28 +02:00
Marcel Holtmann
7e4a6e8a49 test-runner: Remove pointless NULL check before calling l_free 2019-09-08 18:14:13 +02:00
Marcel Holtmann
9d1f7ad6f5 test-runner: Provide CONFIGURATION_DIRECTORY and STATE_DIRECTORY 2019-09-08 18:12:51 +02:00
Marcel Holtmann
7347bd4098 test-runner: Use execvpe to provide environment context 2019-09-08 18:03:10 +02:00
James Prestwood
7acb910a26 test-runner: better define --shell behavior
Specifically, this defines the behavior when --shell is used when no
specific test is specified. In this case test-runner will assume the
'shell' test/sandbox should be used as the test environment as
running all autotests with --shell is not useful or feasable.
2019-08-28 15:55:57 -05:00
James Prestwood
202f65be69 tools/ios_convert: use join rather than manually looping 2019-08-27 10:14:08 -05:00
James Prestwood
de2c808970 tools/ios_convert: add ServerDomainMask
Parses mobileconfig TLSTrustedServerNames
2019-08-27 10:14:08 -05:00
James Prestwood
96ce39c1c2 tools/ios_convert: add raw XML option
This option allows the script to be called with a raw XML file. This
is mostly useful for testing, but since its already implemented we
might as well include it.
2019-08-27 10:14:08 -05:00
James Prestwood
ab0c8cae3c tools/ios_convert: parse DisplayedOperatorName
Some hotspot networks do not contain SSID_STR, which was required
for both naming the provisioning file as well as the 'Name' key.
The DisplayedOperatorName is a better option for this 'Name' key
and could also be used for the filename.

Now, DisplayedOperatorName is preferred, and if not found SSID_STR
is used.
2019-08-27 10:14:08 -05:00
James Prestwood
b05689fc81 tools/ios_convert: Use tag instead of text for IsHotspot
The IsHotspot key just contains a tag after it (true/false), not
a tag with inner text.
2019-08-22 13:05:16 -05:00
James Prestwood
54a5791195 tools/ios_convert: add 'Name' to hotspot config
Also fixed a indentation issue for NAIRealms
2019-08-22 12:46:16 -05:00
James Prestwood
0e317ed9b1 test-runner: print if haveged fails to start
If haveged is not installed it attempts to start but exits with no
indication of what happened.
2019-08-20 14:23:35 -05:00
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