summaryrefslogtreecommitdiff
path: root/tests/run-tests.py
AgeCommit message (Collapse)Author
2024-07-23tests/run-tests.py: Enable thread tests on esp32.Angus Gratton
Before the fix in parent commit, some of these tests hung indefinitely. After, they seem to consistently pass. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-06-21py/emitnative: Fix native async with.Damien George
The code generating the entry to the finally handler of an async-with statement was simply wrong for the case of the native emitter. Among other things the layout of the stack was incorrect. This is fixed by this commit. The setup of the async-with finally handler is now put in a dedicated emit function, for both the bytecode and native emitters to implement in their own way (the bytecode emitter is unchanged, just factored to a function). With this fix all of the async-with tests now work when using the native emitter. Signed-off-by: Damien George <damien@micropython.org>
2024-06-21py/emitnative: Place thrown value in dedicated local variable.Damien George
A value thrown/injected into a native generator needs to be stored in a dedicated variable outside `nlr_buf_t`, following the `inject_exc` variable in `py/vm.c`. Signed-off-by: Damien George <damien@micropython.org>
2024-06-17qemu-riscv: Add new QEMU RV32 port.Alessandro Gatti
This adds a QEMU-based bare metal RISC-V 32 bits port. For the time being only QEMU's "virt" 32 bits board is supported, using the ilp32 ABI and the RV32IMC architecture. The top-level README and the run-tests.py files are updated for this new port. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-05-14webassembly/mpconfigport: Enable importing of .mpy files.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-04-24webassembly: Add JavaScript-based asyncio support.Damien George
This commit adds a significant portion of the existing MicroPython asyncio module to the webassembly port, using parts of the existing asyncio code and some custom JavaScript parts. The key difference to the standard asyncio is that this version uses the JavaScript runtime to do the actual scheduling and waiting on events, eg Promise fulfillment, timeouts, fetching URLs. This implementation does not include asyncio.run(). Instead one just uses asyncio.create_task(..) to start tasks and then returns to the JavaScript. Then JavaScript will run the tasks. The implementation here tries to reuse as much existing asyncio code as possible, and gets all the semantics correct for things like cancellation and asyncio.wait_for. An alternative approach would reimplement Task, Event, etc using JavaScript Promise's. That approach is very difficult to get right when trying to implement cancellation (because it's not possible to cancel a JavaScript Promise). Signed-off-by: Damien George <damien@micropython.org>
2024-03-22tests/ports/webassembly: Add webassembly JS tests.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-03-22tests/run-tests.py: Support running webassembly tests via node.Damien George
This allows running tests with a .js/.mjs suffix, and also .py tests using node and the webassembly port. Signed-off-by: Damien George <damien@micropython.org>
2024-02-20py/objfun: Support __name__ on native functions and generators.Damien George
This is now easy to support, since the first machine-word of a native function tells how to find the prelude, from which the function name can be extracted in the same way as for bytecode. Signed-off-by: Damien George <damien@micropython.org>
2024-02-07tests: Use vfs module instead of os.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-02-06github/workflows: Move Windows CI from AppVeyor to GitHub Actions.David Lechner
By moving to GitHub actions, all MicroPython CI builds are now on GitHub actions. This allows faster parallel builds and saves time by not building when no relevant files changed. This reveals a few failing tests, so those are temporarily disabled until they can be fixed. Signed-off-by: David Lechner <david@pybricks.com> Signed-off-by: Damien George <damien@micropython.org>
2024-01-22tests/ports/rp2: Add rp2-specific tests with a test for rp2.DMA.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-01-22tests: Move port-specific test directories into tests/ports/ directory.Damien George
To keep them all together, mirroring the top-level directory structure. Signed-off-by: Damien George <damien@micropython.org>
2024-01-10tests/run-tests.py: Fix path-based special test detection.stijn
Compare the full absolute path instead of relying on the path form passed by the user. For instance, this will make python3 run-tests.py -d basics python3 run-tests.py -d ./basics python3 run-tests.py -d ../tests/basics python3 run-tests.py -d /full/path/to/basics all behave the same by correctly treating the bytes_compare3 and builtin_help tests as special, whereas previously only the first invocation would do that and hence result in these tests to fail when called with a different path form. Signed-off-by: stijn <stijn@ignitron.net>
2024-01-10tests/run-tests.py: Make repl test detection more correct.stijn
Avoid unrelated tests which happen to have "repl_" anywhere in their path to be treated as repl tests. Signed-off-by: stijn <stijn@ignitron.net>
2024-01-10tests/run-tests.py: Remove unneeded argument from run_feature_check().stijn
In 405893af this was likely left as-is to minimize the diff, but it just complicates things. Signed-off-by: stijn <stijn@ignitron.net>
2024-01-05tests/run-tests.py: Add an option for running only the failed tests.stijn
Implement the typical 're-run the failed tests' most test runners have, for convenience. Accessible via the new --run-failures argument, and implemented using a json file containing a list of the failed tests. Signed-off-by: stijn <stijn@ignitron.net>
2024-01-05tests/thread: Adjust thread tests so most are able to run on rp2 port.Damien George
The aim of this commit is to make it so that the existing thread tests can be used to test the _thread module on the rp2 port. The rp2 port only allows up to one thread to be created at a time, and does not have the GIL enabled. The following changes have been made: - run-tests.py skips mutation tests on rp2, because there's no GIL. - run-tests.py skips other tests on rp2 that require more than one thread. - The tests stop trying to start a new thread after there is an OSError, which indicates that the system cannot create more threads. - Some of these tests also now run the test function on the main thread, not just the spawned threads. - In some tests the output printing is adjusted so it's the same regardless of how many threads were spawned. - Some time.sleep(1) are replaced with time.sleep(0) to make the tests run a little faster (finish sooner when the work is done). For the most part the tests are unchanged for existing platforms like esp32 and unix. Signed-off-by: Damien George <damien@micropython.org>
2024-01-04tests/run-tests.py: Remove machine_mem.py test from skip list.Damien George
This test was removed long ago in eb0e3bab1ed5aa09e491641f427a5d637fe688bd. Signed-off-by: Damien George <damien@micropython.org>
2023-12-06tests/run-tests.py: Skip Thumb2 tests if target doesn't support them.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-29tests/float/float_format_ints.py: Put power-of-10 test in separate file.Damien George
This test doesn't pass on builds with 30-bit floats (object repr C). Signed-off-by: Damien George <damien@micropython.org>
2023-09-01tests/run-tests.py: Capture output of stderr when running on CPython.stephanelsmith
Signed-off-by: stephanelsmith <stephane.smith@titansensor.com>
2023-07-21all: Remove the zlib module.Jim Mussared
This will be replaced with a new deflate module providing the same functionality, with an optional frozen Python wrapper providing a replacement zlib module. binascii.crc32 is temporarily disabled. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19tests: Rename uasyncio to asyncio.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08tests: Replace umodule with module everywhere.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-05-18tests/run-tests.py: Ensure correct cwd for mpy tests.Jim Mussared
Previously when using --via-mpy, the file was compiled to tests/<tmp>.mpy and then run using `micropython -m <tmp>` in the current cwd (usually tests/). This meant that an import in the test would be resolved relative to tests/. This is different to regular (non-via-mpy) tests, where we run (for example) `micropython basics/test.py` which means that an import would be resolved relative to basics/. Now --via-mpy matches the .py behavior. This is important because: a) It makes it so import tests do the right thing. b) There are directory names in tests/ that match built-in module names. Furthermore, it always ensures the cwd (for both micropython and cpython) is the test directory (e.g. basics/) rather than being left unset. This also makes it clearer inside the test that e.g. file access is relative to the Python file. Updated tests with file paths to match. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-09tests/float: Skip new complex tests if complex unavailable.Damien George
These complex tests were recently added. Signed-off-by: Damien George <damien@micropython.org>
2022-12-15extmod/modussl_mbedtls: Fix support for ioctl(MP_STREAM_POLL).Damien Tournoud
During the initial handshake or subsequent renegotiation, the protocol might need to read in order to write (or conversely to write in order to read). It might be blocked from doing so by the state of the underlying socket (i.e. there is no data to read, or there is no space to write). The library indicates this condition by returning one of the errors `MBEDTLS_ERR_SSL_WANT_READ` or `MBEDTLS_ERR_SSL_WANT_WRITE`. When that happens, we need to enforce that the next poll operation only considers the direction that the library indicated. In addition, mbedtls does its own read buffering that we need to take into account while polling, and we need to save the last error between read()/write() and ioctl().
2022-12-13all: Keep msvc build output in build/ directories.stijn
This follow the change made for Makefile-based projects in b2e82402.
2022-11-17tests/run-tests.py: Use host arch for mpy-cross for target=unix.Jim Mussared
This will make mpy-cross auto-detect. Allow overriding for non-default configurations (e.g. using 32-bit build of the unix port). Also use armv7m by default for qemu-arm (the default qemu target is Cortex-M3). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-23tests: Allow 'special' tests to output "SKIP" on a single line.Angus Gratton
2022-08-11tests/run-tests.py: Provide better default MPYCROSS value for Windows.Daniel Jour
2022-08-11all: Fix paths to mpy-cross and micropython binaries.Daniel Jour
Binaries built using the Make build system now no longer appear in the working directory of the build, but rather in the build directory. Thus some paths had to be adjusted.
2022-07-26py/formatfloat: Format all whole-number floats exactly.Dan Ellis
Formerly, py/formatfloat would print whole numbers inaccurately with nonzero digits beyond the decimal place. This resulted from its strategy of successive scaling of the argument by 0.1 which cannot be exactly represented in floating point. The change in this commit avoids scaling until the value is smaller than 1, so all whole numbers print with zero fractional part. Fixes issue #4212. Signed-off-by: Dan Ellis dan.ellis@gmail.com
2022-07-25py/obj: Add support for __float__ and __complex__ functions.Andrew Leech
2022-06-25py/objfun: Support function attributes on native functions.Damien George
Native functions can just reuse the bytecode function attribute code. Signed-off-by: Damien George <damien@micropython.org>
2022-05-26tests: Move native while test from pybnative to micropython.Damien George
And make it so this test can run on any target. LED and time testing has been removed from this test, that can now be tested using: ./run-tests.py --via-mpy --emit native. Signed-off-by: Damien George <damien@micropython.org>
2022-05-26tests/run-tests.py: Add rp2 test target.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-24tests/run-tests.py: Enable `-X realtime` option for macOS tests.David Lechner
This enables the new `-X realtime` runtime option when running tests on macOS. This causes MicroPython to configure all threads to be high priority so that they are allowed to use high precision timers. This makes tests that depend on the passage of time more likely to succeed. CI tests that were disabled because of this are now enabled again. Signed-off-by: David Lechner <david@pybricks.com>
2022-05-23tests/run-tests.py: Handle case where mpy-cross fails to compile script.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-19tests/run-tests.py: Allow running tests via mpy-cross on remote targets.Damien George
This adds support for the `--via-mpy` and `--emit native` options when running tests on remote targets (via pyboard.py). It's now possible to do: $ ./run-tests.py --target pyboard --via-mpy $ ./run-tests.py --target pyboard --via-mpy --emit native Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/run-tests.py: Exclude settrace tests when using native emitter.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-29tests/run-tests.py: Update for renesas-ra port.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-21tests/run-tests.py: Add timeout for running PC-based MicroPython test.Damien George
So the test suite runs to completion, even if the interpreter locks up. Signed-off-by: Damien George <damien@micropython.org>
2022-03-28py: Change jump opcodes to emit 1-byte jump offset when possible.Damien George
This commit introduces changes: - All jump opcodes are changed to have variable length arguments, of either 1 or 2 bytes (previously they were fixed at 2 bytes). In most cases only 1 byte is needed to encode the short jump offset, saving bytecode size. - The bytecode emitter now selects 1 byte jump arguments when the jump offset is guaranteed to fit in 1 byte. This is achieved by checking if the code size changed during the last pass and, if it did (if it shrank), then requesting that the compiler make another pass to get the correct offsets of the now-smaller code. This can continue multiple times until the code stabilises. The code can only ever shrink so this iteration is guaranteed to complete. In most cases no extra passes are needed, the original 4 passes are enough to get it right by the 4th pass (because the 2nd pass computes roughly the correct labels and the 3rd pass computes the correct size for the jump argument). This change to the jump opcode encoding reduces .mpy files and RAM usage (when bytecode is in RAM) by about 2% on average. The performance of the VM is not impacted, at least within measurment of the performance benchmark suite. Code size is reduced for builds that include a decent amount of frozen bytecode. ARM Cortex-M builds without any frozen code increase by about 350 bytes. Signed-off-by: Damien George <damien@micropython.org>
2022-03-10py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.Damien George
This allows customising the REPL prompt strings. Signed-off-by: Damien George <damien@micropython.org>
2022-03-10py/modsys: Add optional sys.tracebacklimit attribute.Damien George
With behaviour as per CPython. Signed-off-by: Damien George <damien@micropython.org>
2022-03-07tests/run-tests.py: Include test files ending in _set as set tests.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-02-18tests/run-tests.py: Skip repl tests when running windows underneath.stijn
Some versions of Python (for instance: the mingw-w64 version which can be installed on MSYS2) do include a pty module and claim to be posix-like (os.name == 'posix'), yet the select.select call used in run-tests.py hangs forever. To be on the safe side just exclude anything which might be running on windows.
2021-12-29ports: Move '.frozen' to second entry in sys.path.Damien George
In commit 86ce4426079b1b368881c22f46d80045e2f720b0 the '.frozen' entry was added at the start of sys.path, to allow control over when frozen modules are searched during import, and retain existing behaviour whereby frozen was searched before the filesystem. But Python semantics of sys.path require sys.path[0] to be the directory of the currently executing script, or ''. This commit moves the '.frozen' entry to second place in sys.path, so sys.path[0] retains its correct value (described above). Signed-off-by: Damien George <damien@micropython.org>