Commit Graph

27 Commits

Author SHA1 Message Date
Jim Mussared
109717457e tests/run-multitests.py: Don't allow imports from the cwd.
Make tests run in an isolated environment (i.e. `import io` would
otherwise get the `tests/io` directory).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:24 +10:00
Damien George
af42634866 tests/run-multitests.py: Support outputting test metrics.
If a multitest calls `multitest.output_metric(...)` then that output will
be collected separately, not considered as part of the test verification
output, and instead be printed at the end.  This is useful for tests that
want to output performance/timing metrics that may change from one run to
the next.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-23 13:18:52 +11:00
Andrew Leech
211859b11f tests/run-multitests.py: Add ability to test instance over reboot.
The device-under-test should use `multitest.expect_reboot()` to indicate
that it will reboot.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-03-08 14:04:14 +11:00
stijn
9c7ff87643 all: Keep msvc build output in build/ directories.
This follow the change made for Makefile-based projects in b2e82402.
2022-12-13 17:18:53 +11:00
Andrew Leech
13c4470fd0 tests/run-multitests: Make paths more deterministic.
Allows running from a different directory, etc.

This work was funded by Planet Innovation.
2022-09-20 09:07:18 +10:00
Andrew Leech
7589d86b6b tests/run-multitests: Extend usage information. 2022-09-20 09:07:02 +10:00
Damien George
cbc9f944c4 tests,tools: Update path to unix micropython executable.
These were missed by 47c84286e8

Signed-off-by: Damien George <damien@micropython.org>
2022-08-18 11:47:58 +10:00
Andrew Leech
b7a39ad2d1 tests/run-multitests.py: Read IP address from boot nic if available.
This works if your network is pre-configured in boot.py as an object called
"nic".  Without this, multitests expects to access the WLAN/LAN class which
isn't always correct.

Signed-off-by: Andrew Leech <andrew@alelec.net>
2022-06-03 14:35:37 +10:00
robert-hh
dd35f76db3 tests/run-multitests.py: Use LAN for IP address if WLAN doesn't exist.
This allows running the test on boards with just a LAN interface.

Fixes issue #8681.
2022-05-24 13:21:05 +10:00
Damien George
c54717a78f tests/run-multitests.py: Set HOST_IP so tests work between PC and board.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-17 17:35:04 +11:00
Damien George
5df1d8be6c tests/run-multitests.py: Ignore lld_pdu_get_tx_flush_nb msgs from IDF.
BLE still functions correctly even though these messages are sometimes
printed by the IDF.  Ignoring them allows the multi_bluetooth tests to pass
on an esp32 board.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-17 14:23:24 +11:00
Damien George
90d47ee34d tests/run-multitests.py: Add broadcast and wait facility.
Test instances can now use the following methods to synchronise their
execution:

    multitest.broadcast("sync message")
    multitest.wait("sync message")

Signed-off-by: Damien George <damien@micropython.org>
2021-08-13 23:26:34 +10:00
Damien George
da8e47da21 tests/run-multitests.py: Allow to work without sys.stdout on target.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-06 21:58:07 +10:00
Damien George
6affcb0104 tests/run-multitests.py: Flush stdout for each line of trace output.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-13 16:26:07 +10:00
Damien George
76dab3bf31 tests/run-multitests.py: Provide some convenient serial device shorcuts.
It's now possible to specify a device serial port using shorcuts like:

    $ ./run-multitests.py -i pyb:a0 -i pyb:u1 multi_bluetooth/*.py

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 15:47:22 +10:00
Jim Mussared
c75ce37910 tests/run-multitests.py: Add a -p flag to run permutations of instances.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-11-13 17:19:05 +11:00
Jim Mussared
309fb822e6 tests/run-multitests.py: Fix diff order, show changes relative to truth.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-11-13 17:18:20 +11:00
Jim Mussared
06dda48144 tests/run-multitests.py: Show test/truth diff. 2020-09-18 12:51:21 +10:00
Jim Mussared
00c3e2156a tests/run-multitests.py: Allow passing unique env vars to each instance.
For example, to run the BLE multitests entirely with the unix port:

    env MICROPY_MICROPYTHON=../ports/unix/micropython-dev ./run-multitests.py \
        -i micropython,MICROPYBTUSB=01 \
        -i micropython,MICROPYBTUSB=02:02 \
        multi_bluetooth/ble_*.py
2020-06-10 22:41:57 +10:00
Jim Mussared
9902ce12eb tests/multi_bluetooth: Update to work with new BLE events.
Updates the tests to use non-bitmask events, event renames, as well as some
of the new completion events to improve reliability of the tests.
2020-06-05 14:08:47 +10:00
Damien George
035059eaf5 tests/run-multitests.py: Add TRACE banner and move TEST output to end.
To make it easier to understand the output when both -s and -t are used.
2020-05-09 00:06:06 +10:00
Jim Mussared
59a7865a7d tests/run-multitests.py: Add shortcuts for local Python instances.
One can now use `-i micropython` and `-i cpython` to add instances using
the `MICROPYTHON` and `CPYTHON3` variables (which can be overridden by env
vars).
2020-04-29 16:45:46 +10:00
Jim Mussared
f588138bbe tests/run-multitests.py: Allow filtering out lines from stdout.
And use this new feature to filter out certain lines in the Bluetooth
multitests.
2020-04-29 16:45:46 +10:00
David Lechner
3dc324d3f1 tests: Format all Python code with black, except tests in basics subdir.
This adds the Python files in the tests/ directory to be formatted with
./tools/codeformat.py.  The basics/ subdirectory is excluded for now so we
aren't changing too much at once.

In a few places `# fmt: off`/`# fmt: on` was used where the code had
special formatting for readability or where the test was actually testing
the specific formatting.
2020-03-30 13:21:58 +11:00
Damien George
18fa65e474 tests: Make default MICROPYPATH include extmod to find uasyncio. 2020-03-26 01:25:45 +11:00
Damien George
19ea30bdd5 tests/run-multitests.py: Print test summary and do exit(1) on failure. 2020-03-18 21:33:40 +11:00
Damien George
df9a949891 tests/run-multitests.py: Add new test runner for multiple Py instances.
This commit adds a test runner and initial test scripts which run multiple
Python/MicroPython instances (eg executables, target boards) in parallel.
This is useful for testing, eg, network and Bluetooth functionality.

Each test file has a set of functions called instanceX(), where X ranges
from 0 up to the maximum number of instances that are needed, N-1.  Then
run-multitests.py will execute this script on N separate instances (eg
micropython executables, or attached boards via pyboard.py) at the same
time, synchronising their start in the right order, possibly passing IP
address (or other address like bluetooth MAC) from the "server" instance to
the "client" instances so they can connect to each other.  It then runs
them to completion, collects the output, and then tests against what
CPython gives (or what's in a provided .py.exp file).

The tests will be run using the standard unix executable for all instances
by default, eg:

    $ ./run-multitests.py multi_net/*.py

Or they can be run with a board and unix executable via:

    $ ./run-multitests.py --instance pyb:/dev/ttyACM0 --instance exec:micropython multi_net/*.py
2020-03-10 02:22:34 +11:00