summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
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-26tests/micropython: Make import_mpy_native test run on all architectures.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-26tests/micropython: Make import_mpy_native_gc run on ARMv6-M and above.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-24tests/run-multitests.py: Use LAN for IP address if WLAN doesn't exist.robert-hh
This allows running the test on boards with just a LAN interface. Fixes issue #8681.
2022-05-24tests/multi_net: Fix TCP accept test when using system error numbers.iabdalkader
If a port is not using internal error numbers, which match both lwIP and Linux error numbers, ENTOCONN from standard libraries errno.h equals 128, not 107.
2022-05-24tests/extmod: Change expected errno code from 36 to 30 in VfsLfs2 test.Damien George
Errno 30 is EROFS, which is now the correct value reported by littlefs 2. 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-23tests/basics: Unlock heap if skipping nanbox small-int test.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-19tests/run-perfbench.py: Allow running tests via mpy and native emitter.Damien George
The performance benchmark tests now support `--via-mpy` and `--emit native` on remote targets. For example: $ ./run-perfbench.py -p --via-mpy --emit native 100 100 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-18py/parse: Allow all constant objects to be used in "X = const(o)".Damien George
Now that constant tuples are supported in the parser, eg (1, True, "str"), it's a small step to allow anything that is a constant to be used with the pattern: from micropython import const X = const(obj) This commit makes the required changes to allow the following types of constants: from micropython import const _INT = const(123) _FLOAT = const(1.2) _COMPLEX = const(3.4j) _STR = const("str") _BYTES = const(b"bytes") _TUPLE = const((_INT, _STR, _BYTES)) _TUPLE2 = const((None, False, True, ..., (), _TUPLE)) Prior to this, only integers could be used in const(...). Signed-off-by: Damien George <damien@micropython.org>
2022-05-18tests/micropython: Add more test cases for native generators.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-18tests/extmod: Use bytearray instead of bytes for uctypes test.Damien George
Because the test modifies the (now) bytearray object, and if it's a bytes object it's not guaranteed that it can be modified, or that this constant object isn't used elsewhere. Signed-off-by: Damien George <damien@micropython.org>
2022-05-18tests/micropython: Fully unlink nested list in extreme exc test.Damien George
To make sure there are no dangling references to the lists, and the GC can reclaim heap memory. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/compile: Allow new qstrs to be allocated at all compiler passes.Damien George
Prior to this commit, all qstrs were required to be allocated (by calling mp_emit_common_use_qstr) in the MP_PASS_SCOPE pass (the first one). But this is an unnecessary restriction, which is lifted by this commit. Lifting the restriction simplifies the compiler because it can allocate qstrs in later passes. This also generates better code, because in some cases (eg when a variable is closed over) the scope of an identifier is not known until a bit later and then the identifier no longer needs its qstr allocated in the global table. Code size is reduced for all ports with this commit. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/multi_net: Skip SSL test if relevant modules aren't available.Damien George
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-05-17tests/thread: Use less resources for stress_aes if settrace enabled.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/run-perfbench.py: Return error code if any test fails on target.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests/perf_bench: Update .mpy file header to remove old unicode flag.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17py/persistentcode: Remove unicode feature flag from .mpy file.Damien George
Prior to this commit, even with unicode disabled .py and .mpy files could contain unicode characters, eg by entering them directly in a string as utf-8 encoded. The only thing the compiler disallowed (with unicode disabled) was using \uxxxx and \Uxxxxxxxx notation to specify a character within a string with value >= 0x100; that would give a SyntaxError. With this change mpy-cross will now accept \u and \U notation to insert a character with value >= 0x100 into a string (because the -mno-unicode option is now gone, there's no way to forbid this). The runtime will happily work with strings with such characters, just like it already works with strings with characters that were utf-8 encoded directly. This change simplifies things because there are no longer any feature flags in .mpy files, and any bytecode .mpy will now run on any target. Signed-off-by: Damien George <damien@micropython.org>
2022-05-17tests: Fix tests to use sys.implementation._mpy.Damien George
The field was renamed to _mpy in 59c5d4161120db28bc6cbc7653f2e7fdb4a87370 Signed-off-by: Damien George <damien@micropython.org>
2022-05-05py/malloc: Introduce m_tracked_calloc, m_tracked_free functions.Damien George
Enabled by MICROPY_TRACKED_ALLOC. Signed-off-by: Damien George <damien@micropython.org>
2022-05-03tests/extmod: Increase timing on uasyncio tests to make more reliable.Damien George
Non-real-time systems like Windows, Linux and macOS do not have reliable timing, so increase the sleep intervals to make these tests more likely to pass. Signed-off-by: Damien George <damien@micropython.org>
2022-05-03py/emitcommon: Don't implicitly close class vars that are assigned to.Damien George
When in a class body or at the module level don't implicitly close over variables that have been assigned to. Fixes issue #8603. 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-29tests/renesas-ra: Add tests for renesas-ra port.Takeo Takahashi
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-22tests/cmdline: Add test for REPL auto-indent.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-21extmod/uasyncio: Fix bug with task ending just after gather is cancel'd.Damien George
This fixes a bug where the gather is cancelled externally and then one of its sub-tasks (that the gather was waiting on) finishes right between the cancellation being queued and being executed. Signed-off-by: Damien George <damien@micropython.org>
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-04-20tests/extmod/uasyncio_gather: Make double-raise gather test reliable.Damien George
This double-raise test could fail when task[0] raises and stops the gather before task[1] raises, then task[1] is left to raise later on and spoil the test. Signed-off-by: Damien George <damien@micropython.org>
2022-04-20py/objtype: Convert result of user __contains__ method to bool.Jon Bjarni Bjarnason
Per https://docs.python.org/3/reference/expressions.html#membership-test-operations For user-defined classes which define the contains() method, x in y returns True if y.contains(x) returns a true value, and False otherwise. Fixes issue #7884.
2022-04-15tests/micropython: Add tests that const tuples don't use the heap.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14tests/perf_bench: Update import tests for changes to .mpy consts.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/parse: Add MICROPY_COMP_CONST_TUPLE option to build const tuples.Damien George
This commit adds support to the parser so that tuples which contain only constant elements (bool, int, str, bytes, etc) are immediately converted to a tuple object. This makes it more efficient to use tuples containing constant data because they no longer need to be created at runtime by the bytecode (or native code). Furthermore, with this improvement constant tuples that are part of frozen code are now able to be stored fully in ROM (this will be implemented in later commits). Code size is increased by about 400 bytes on Cortex-M4 platforms. See related issue #722. Signed-off-by: Damien George <damien@micropython.org>
2022-04-14py/parse: Print const object value in mp_parse_node_print.Damien George
To give more information when printing the parse tree. Signed-off-by: Damien George <damien@micropython.org>
2022-04-11tests/inlineasm: Add test for PUSH LR and POP PC.Christian Zietz
2022-04-11extmod/modusocket: Implement optional socket.listen backlog argument.Jon Bjarni Bjarnason
This follows the CPython change: https://bugs.python.org/issue21455 Socket listen backlog defaults to 2 if not given, based on most bare metal targets not having many resources for a large backlog. On UNIX it defaults to SOMAXCONN or 128, whichever is less.
2022-04-02tests/pyb: Update CAN tests to match revised CAN API.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-01tests/basics/fun_callstardblstar: Add test for large arg allocation.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-04-01py: Fix compiling and decoding of *args at large arg positions.Damien George
There were two issues with the existing code: 1. "1 << i" is computed as a 32-bit number so would overflow when executed on 64-bit machines (when mp_uint_t is 64-bit). This meant that *args beyond 32 positions would not be handled correctly. 2. star_args must fit as a positive small int so that it is encoded correctly in the emitted code. MP_SMALL_INT_BITS is too big because it overflows a small int by 1 bit. MP_SMALL_INT_BITS - 1 does not work because it produces a signed small int which is then sign extended when extracted (even by mp_obj_get_int_truncated), and this sign extension means that any position arg after *args is also treated as a star-arg. So the maximum bit position is MP_SMALL_INT_BITS - 2. This means that MP_OBJ_SMALL_INT_VALUE() can be used instead of mp_obj_get_int_truncated() to get the value of star_args. These issues are fixed by this commit, and a test added. Signed-off-by: Damien George <damien@micropython.org>
2022-03-31tests/basics/fun_callstardblstar: Add coverage test.David Lechner
This fixes code coverage for the case where a *arg without __len__ is unpacked and uses exactly the amount of memory that was allocated for kw args. This triggers the code branch where the memory for the kw args gets reallocated since it was used already by the *arg unpacking. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/runtime: Allow multiple *args in a function call.David Lechner
This is a partial implementation of PEP 448 to allow unpacking multiple star args in a function or method call. This is implemented by changing the emitted bytecodes so that both positional args and star args are stored as positional args. A bitmap is added to indicate if an argument at a given position is a positional argument or a star arg. In the generated code, this new bitmap takes the place of the old star arg. It is stored as a small int, so this means only the first N arguments can be star args where N is the number of bits in a small int. The runtime is modified to interpret this new bytecode format while still trying to perform as few memory reallocations as possible. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31py/runtime: Allow multiple **args in a function call.David Lechner
This is a partial implementation of PEP 448 to allow multiple ** unpackings when calling a function or method. The compiler is modified to encode the argument as a None: obj key-value pair (similar to how regular keyword arguments are encoded as str: obj pairs). The extra object that was pushed on the stack to hold a single ** unpacking object is no longer used and is removed. The runtime is modified to decode this new format. Signed-off-by: David Lechner <david@pybricks.com>
2022-03-30extmod/uasyncio: Fix gather cancelling and handling of exceptions.Damien George
The following fixes are made: - cancelling a gather now cancels all sub-tasks of the gather (previously it would only cancel the first) - if any sub-task of a gather raises an exception then the gather finishes (previously it would only finish if the first sub-task raised) Fixes issues #5798, #7807, #7901. Signed-off-by: Damien George <damien@micropython.org>
2022-03-30tests/extmod: Update I2S rate test to work on mimxrt.Damien George
Tested on Teensy 4.0. Signed-off-by: Damien George <damien@micropython.org>
2022-03-29tests/extmod: Add test for machine.I2S data rate.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2022-03-28py/emitbc: Add check for bytecode jump offset overflow.Damien George
Signed-off-by: Damien George <damien@micropython.org>