3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00
iwd/autotests
James Prestwood 0772d4b61a auto-t: introduce pure python test-runner re-write
This patch completely re-writes test-runner in Python. This was done
because the existing C test-runner had some clunky work arounds and
maintaining or adding new features was starting to become a huge pain.

There were a few aspects of test-runner which continually had to
be dealt with when adding any new functionality:

 * Argument parsing: Adding new arguments to test-runner wasn't so
   bad, but if you wanted those arguments passed into the VM it
   became a huge pain. Arguments needed to be parsed, then re-formatted
   into the qemu command line, then re-parsed in a special order
   (backwards) once in the VM. The burden for adding new arguments was
   quite high so it was avoided (at least by me) at all costs.
 * The separation between C and Python: The tests are all written in
   python, but the executables, radios, and interfaces were all created
   from C. The way we solved this was by encoding the require info as
   environment variables, then parsing those from Python. It worked,
   but it was, again, a huge pain.
 * Process management: It started with all processes being launched
   from C, but eventually tests required the ability to start IWD, or
   kill hostapd ungracefully in order to test certain functionality.
   Since the processes were tracked in C, Python had no way of
   signalling that it killed a process and when it started one C had
   no idea. This was mitigated (basically by killall), but it was
   no where close to an elegant solution.

Re-writing test-runner in python solves all these problems and will
be much easier to maintain.

 * Argument parsing: Now all arguments are forwarded automatically
   to the VM. The ArgParse library takes care of parsing and each
   argument is stored in a dictionary.
 * Separation between C and Python: No more C, so no more separation.
 * Process management: Python will now manage all processes. This
   allows a test to kill, restart, or start a new process and not
   have to remember the PID or to kill it after the test.

There are a few more important aspects of the python implementation
that should now be considered when writing new tests:

 * The IWD constructor now has different default arugments. IWD
   will always be started unless specified and the configuration
   directory will always be /tmp
 * Any non *.py file in the test directory will be copied to /tmp.
   This avoids the need for 'tmpfs_extra_stuff' completely.
 * ctrl_interface will automatically be appended to every hostapd
   config. There is no need to include this in a config file from
   now on.
 * Test cleanup is extremely important. All tests get run in the
   same interpreter now and the tests themselves are actually loaded
   as python modules. This means e.g. if you somehow kept a reference
   to IWD() any subsequent tests would not start since IWD is still
   running.
 * For debugging, the test context can be printed which shows running
   processes, radios, and interfaces.

Three non-native python modules were used: PrettyTable, colored, and
pyroute2

$ pip3 install prettytable
$ pip3 install termcolor
$ pip3 install pyroute2
2020-09-10 17:59:49 -05:00
..
misc auto-t: Test PEAPv0 cryptobinding 2020-02-03 11:34:29 -06:00
shell auto-t: add shell test 2019-08-07 16:37:51 -05:00
testAddressRandomization auto-t: fix testAddressRandomization 2020-03-21 00:10:34 -05:00
testAdHoc auto-t: Remove unused imports 2020-04-09 16:46:31 -05:00
testAgent auto-t: Test Agent ops 2020-05-13 05:50:45 -05:00
testAP auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testAP-no-support auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testAPRoam auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testBSSBlacklist auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testClientNonInteractive auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testConnectAutoconnect auto-t: use scan_if_needed for testConnectAutoconnect 2020-05-02 06:40:23 -05:00
testDisconnectByAP auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testDisconnectOnConnect auto-t: Test disconnect on connect while connected 2019-07-23 17:19:12 -05:00
testEAP-AKA auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-AKA-ofono auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-AKA-prime auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-AKA-prime-ofono auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-MSCHAPV2 auto-t: fix intermittent failures in testEAP-MSCHAPV2 2019-11-14 12:58:18 -06:00
testEAP-PEAP treewide: Rename EAP mtu key to MTU 2019-10-24 13:51:20 -05:00
testEAP-PEAP-GTC auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-PEAP-MSCHAPv2 auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-PEAP-SIM auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-PEAPv0-CryptoBinding auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-PWD auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-SIM auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-SIM-ofono auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-TLS auto-t: update testEAP-TLS to use HostapdCLI 2019-10-28 15:01:36 -05:00
testEAP-TLS-embedded-pems auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-TLS-Frag auto-t: remove iwd_config_dir from autotests 2020-03-21 00:10:36 -05:00
testEAP-TLSwithMFPC auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-TLSwithMFPR auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-TTLS auto-t: Rename setting Autoconnect to AutoConnect 2019-10-24 13:04:53 -05:00
testEAP-TTLS-CHAP auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-TTLS-EAP-MSCHAPV2 auto-t: update tests to use get_ordered_network call 2018-12-14 13:47:00 -06:00
testEAP-TTLS-Frag auto-t: remove iwd_config_dir from autotests 2020-03-21 00:10:36 -05:00
testEAP-TTLS-MSCHAP auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-TTLS-MSCHAPv2 auto-t: remove busy wait for eapol reauth 2020-07-08 18:29:01 -05:00
testEAP-TTLS-PAP auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-WPS auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testEAP-WPS-Frag auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFILS auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFT-8021x-roam auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFT-FILS-SHA256 auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFT-FILS-SHA384 auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFT-PSK-over-DS auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFT-PSK-roam auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testFT-SAE-roam auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testHiddenNetworks auto-t: Validate Connect after ConnectHiddenNetwork 2020-06-09 21:58:52 -05:00
testHotspot auto-t: add test for delayed ANQP response 2020-06-12 15:04:43 -05:00
testHT-VHT auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testKnownNetworks treewide: Use CamelCase for disable_anqp setting 2019-10-24 23:18:23 -05:00
testMFP-Options autotests: Remove del wd at the end function pattern 2019-04-22 18:20:01 -05:00
testOpen auto-t: update tests to use get_ordered_network call 2018-12-14 13:47:00 -06:00
testOWE auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testPreauth-roam auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testRRM auto-t: add RRM test for scan duration 2019-11-15 14:17:25 -06:00
testRSSIAgent auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testSAE auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testSAQuery auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testSAQuery-spoofing auto-t: prepare autotests for test-runner re-write 2020-09-10 17:59:49 -05:00
testScan treewide: Use CamelCase for [Scan] settings 2019-10-24 15:58:08 -05:00
testScanKnownFreqs auto-t: updated testScanKnownFreqs 2019-09-12 11:36:00 -05:00
testWPA auto-t: update tests to use get_ordered_network call 2018-12-14 13:47:00 -06:00
testWPA2 autotests: Remove del wd at the end function pattern 2019-04-22 18:20:01 -05:00
testWPA2-no-CCMP auto-t: add test for CCMP with no support 2019-05-13 16:38:23 -05:00
testWPA2-SHA256 auto-t: update tests to use get_ordered_network call 2018-12-14 13:47:00 -06:00
testWPA2withMFP auto-t: update tests to use get_ordered_network call 2018-12-14 13:47:00 -06:00
util auto-t: introduce pure python test-runner re-write 2020-09-10 17:59:49 -05:00