Commit Graph

14 Commits

Author SHA1 Message Date
James Prestwood c36f94a15a test-runner: only remove /tmp files if they exist
This bit of code was throwing exceptions if a test cleaned up files that
test-runner was expecting to clean up. Specifically testHotspot swaps out
main.conf and PSK files many times. This led to the exception being thrown,
caught, and ignored but further on test-runner would print:

"File _X_ not cleaned up!"

Now the files will be checked if they exist before trying to remove it.
2022-06-03 11:59:13 -05:00
James Prestwood df46776046 auto-t: allow skipping tests is wpa_supplicant is not found
Similarly to ofono/phonesim allow tests to be skipped if wpa_supplicant
is not found on the system.

This required some changes to DPP/P2P where Wpas() should be called first
since this can now throw a SkipTest exception.

The Wpas class was also made to allow __del__ to be called without
throwing additional exceptions in case wpa_supplicant was not found.
2022-06-02 16:47:02 -05:00
James Prestwood 5453f71a7c test-runner: fix check for phonesim
This got changed to use which, but not updated to remove the
list argument.
2022-04-06 17:22:06 -05:00
James Prestwood e70d7e0857 test-runner: write separators for transient processes
Many processes are not long running (e.g. hostapd_cli, ip, iw, etc)
and the separators written to log files don't show up for these which
makes debugging difficult. This is even true for IWD/Hostapd for tests
with start_iwd=0.

After writing separators for long running processes write them out for
any additional log files too.
2022-04-06 14:47:24 -05:00
James Prestwood f199e3f40d test-runner: move BarChart into utils.py 2022-04-06 14:47:18 -05:00
James Prestwood bc9dfee7cd test-runner: remove unused class members 2022-04-06 14:47:13 -05:00
James Prestwood e993503c4d test-runner: simplify start_iwd handling
Replace two separate if blocks to handle the default value
with fallback=True.
2022-04-06 14:47:06 -05:00
James Prestwood b731e121c9 test-runner: remove path_exists/find_binary
These are already implemented in the shutil module
2022-04-06 14:46:59 -05:00
James Prestwood c74ac94c31 test-runner: isolate Process/Namespace into utils
Way too many classes have a dependency on the TestContext class, in
most cases only for is_verbose. This patch removes the dependency from
Process and Namespace classes.

For Process, the test arguments can be parsed in the class itself which
will allow for this class to be completely isolated into its own file.

The Namespace class was already relatively isolated. Both were moved
into utils.py which makes 'run-tests' quite a bit nicer to look at and
more fitting to its name.
2022-04-06 14:46:10 -05:00
James Prestwood 31b5275c1f auto-t: hostapd.py: use IO watch for hostapd events
With how fast UML is hostapd events were being sent out prior to
ever calling wait_for_event. Instead set an IO watch on the control
socket and cache all events as they come. Then, when wait_for_event
is called, it can reference this list. If the event is found any
older events are purged from the list.

The AP-ENABLED event needed a special case because hostapd gets
started before the IO watch can be registered. To fix this an
enabled property was added which queries the state directly. This
is checked first, and if not enabled wait_for_event continues normally.
2022-03-31 18:12:59 -05:00
James Prestwood b342dfd8d5 test-runner: don't kill dmesg after individual tests
This prevents any kernel logging from being available after the first
test is finished.
2022-03-31 18:12:43 -05:00
James Prestwood 5a14daf9b8 test-runner: use may_block=True for context iteration (and move location)
This allows the callers condition to be checked immediately without
the mainloop running. In addition may_block=True allows the mainloop
to poll/sleep rather than immediately return back to the caller. This
handles async IO much better than may_block=False, at least for our
use-case.
2022-03-31 18:12:40 -05:00
James Prestwood 54552db7ba test-runner: fix logging for namespaces and pre-test processes
Namespace process logs were appearing under 'ip' (and also overwriting
actual 'ip' logs) since they were executed with 'ip netns exec <namespace>'.
Instead special case this and append '-<namespace>' to the log file name.

In addition processes executed prior to any tests were being put under
a folder (name of testhome directory). Now this case is detected and these
logs are put at the top level log directory.
2022-03-31 18:12:37 -05:00
James Prestwood 2894f2e3eb test-runner: rename test-runner, add run-tests
In order to keep all test-runner dev scripts working and to work with
the new runner.py system some file renaming was required.

test-runner was renamed to run-tests
A new test-runner was added which only creates the Runner() class.
2022-03-31 18:12:31 -05:00