| Age | Commit message (Collapse) | Author |
|
This commit introduces a test file (along with its necessary data) to
test MPY files pass/reject cases, due to either mismatching architecture
flag requirements or unneeded "no-flags" values set.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit lets "run-tests.py" use the encoded architecture flags
provided by the interpreter when invoking "mpy-cross".
If architecture flags are detected, they're mapped into the necessary
strings needed by "mpy-cross"'s "-march-flags" argument, so that tests
will always use all available extensions reported by the target.
Currently this is limited to the RV32 platform, as it is the only one
that is making use of this facility as of now. This also lets the QEMU
port remove forced arguments to "mpy-cross" when running the test suite.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit extends the "micropython/import_mpy_native_gc" test with a
pre-built serialised MPY file built for RV32.
Before this commit, the test was skipped on said platform due to the
lack of a known-good MPY file to test the import procedure against.
Now the test is executed as part of the general CI test checks.
The MPY file's Makefile script was also updated to cater for modern
Linux environments where the required Python interpreter's command name
isn't "python", but "python3" instead (this occurs when using the past
two LTS Ubuntu releases for example). This is the same kind of change
made in 31a008c6e26eccc3798a9ab4169019a02eadb830.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit adds the currently supported architecture flags value as the
upper part of "sys.implementation._mpy".
This had the side effect of perturbing quite a bit of testing
infrastructure and invalidating documentation related to MPY files. To
make the test suite run successfully and keep the documentation in sync
the following changes have been made:
* The target info feature check file now isolates eventual architecture
flags and adds them as a separate field
* The test runner now picks up the new architecture flags field, reports
it to STDOUT if needed and stores it for future uses
* Relevant test files for MPY files import code had to be updated to
mask out the architecture flags bits in order to perform correctly
* MPY file format documentation was updated to show how to mask off and
properly display the architecture flags information.
This works out of the box if the flag bits can fit in a smallint value
once merged with the MPY file header value.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This moves the `port:<dev>` check for the test instance to the
`convert_device_shortcut_to_real_device()` helper function, which means
that `run-multitests.py` can use this specification.
Signed-off-by: Damien George <damien@micropython.org>
|
|
If `time.time` doesn't exist, it tries to use `globals()['time']` which is
the time module itself, and that causes the test to fail. Instead it
should just skip `time.time`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
axTLS does not implement the `verify_callback` attribute.
Signed-off-by: Damien George <damien@micropython.org>
|
|
axTLS will print a warning, and the added .exp file will skip that line.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This test is very specific to mbedTLS and how it raises errors when the
heap is locked.
Signed-off-by: Damien George <damien@micropython.org>
|
|
These tests cannot run with axTLS, eg on esp8266.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This makes it clear what this test is expected to return/do.
Signed-off-by: Damien George <damien@micropython.org>
|
|
The main reason for moving this test is that it needs internet connection
to pass. So putting it in `net_inet` makes sure it's alongside other tests
that need the internet.
Also, it's a general test that could eventually run on other ports, if/when
they support doing an address resolution as part of `socket.connect()`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This makes sure that `open()` raises `OSError(ENOENT)` if the test script
attempts to open a file that does not exist.
For example, the test `tests/ports/esp32/check_err_str.py` attempts to do
this and this test currently fails when run with `--via-mpy` because the
injected filesystem lets a file by any name be opened.
The fix here tries to be as minimal as possible, so includes a size
optimisation for `stat()` to use a fixed 10-tuple. It also fixes the
`OSError` argument, which should be positive.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Correctly format integers when there are leading zeros with a grouping
character, such as "{:04,d}".format(0x100) -> "0,256".
The new padding patterns for commas-and-zeroes and underscores-and-zeroes
are smooshed together into the existing pad_zeroes to save space.
Only the two combinations of (decimal + commas) and (other bases +
underscores) are properly supported.
Also add a test for it.
Fixes issue #18082.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
When calling from Python into JavaScript and passing along keyword
arguments, the FFI bindings currently only support at most 1 positional
argument. For example:
import js
js.func(1, b=2, c=3)
This commit fixes that by supporting arbitrary number of positional
arguments, in combination with keyword arguments. So now the following
works:
import js
js.func(1, 2, c=3, d=4)
Tests are added for these new, supported cases.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
This fixes several assertion errors that were found in fuzz testing, for
unimplemented portions of the websocket spec. The assertions were either
turned into Python exceptions, or the missing functionality was
implemented.
Split frames are now enabled and work, enabling reception of frames up to
64kB (assuming they are encoded with a 16-bit size field).
Frames with a 64-bit size fields remain unsupported but no longer result in
an assertion error. Instead, Initial reception of such a frame will result
in OSError(EIO) and subsequent operations on the same websocket will fail
because framing has been lost.
Transmitting frames larger than 64kB is unsupported. Attempting to
transmit such a frame will result in OSError(ENOBUFS). Subsequent
operations on the websocket are possible.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
With the aim of getting consistency, and removing the need to learn an
additional term, replace uses of uPy/uPython with MPy/MicroPython.
Rule of thumb was to use "MPy" abbreviation where "CPy" is used nearby, but
the full word MicroPython otherwise.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This is a test script used to test USB CDC (or USB UART) serial reliability
and throughput.
Run against any MicroPython remote target with:
$ python serial_test.py -t <device>
Signed-off-by: Damien George <damien@micropython.org>
|
|
These two tests can't run on the unix minimal build because it doesn't have
the relevant build options enabled. So skip them.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
The unix minimal variant cannot run these tests because:
- it doesn't support -v -v debug printing
- it doesn't have `open()`
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
So it can be used on targets without set enabled (or at least not raise a
SyntaxError when compiling it).
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
This skips some additional tests that use slice, and no longer skips
`basics/string_format_modulo.py` which doesn't actually use slice (but
`float/string_format_modulo.py` does).
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Changes here are:
- Split out string format module sub-test to a separate test file, so it
can be skipped on targets that don't have str% capabilities.
- Print the whole type instead of `.__name__` to support targets that don't
have `.__name__` enabled (this still tests the same thing).
- Print `RuntimeError` exception message to be sure the correct exception
is being raised.
This test now runs on unix and zephyr minimal configurations.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Running the tests now requires CPython 3.8.2 or newer, which was
released February 2020 and should be widely available.
A few examples of features that were previously not supported by CPython,
but which are now:
- %-formatting for bytes and bytearray (PEP 461), CPython 3.5
- annotated variables (PEP 526), CPython 3.6
- assignment expressions (PEP 572), CPython 3.8
Note that `basics/fun_code_full.py.exp` is added here because that requires
CPython 3.10 or newer.
Signed-off-by: Damien George <damien@micropython.org>
|
|
These tests cannot pass when using `--via-mpy`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This catches cases where the return type is not a small int, eg it could be
a string, or even a big integer.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Prior to this fix, if a JavaScript thenable/Promise that was part of an
asyncio chain was rejected it would be ignored because the Python-side
`ThenableEvent` did not register a handler for the rejection.
That's fixed by this commit, and a corresponding test added.
Signed-off-by: Damien George <damien@micropython.org>
|
|
`cur_task` can never be `None` in the webassembly port, so test it for the
top-level task to see if an asyncio Task is active or not.
This fixes a bug where await'ing on a JavaScript awaitable that ends up
raising an error would not be caught on the Python side. The fix here
makes sure it is caught by Python, as tested by the new test.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This tests `from mod import foo` where `mod` is a module registered using
the webassembly API `registerJsModule(mod)`, and where `foo` is a
JavaScript function. Prior to the parent commit, this would fail.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This change follows CPython behaviour, allowing use of:
from instance import method
to import a bound method from a class instance, eg registered via
setting `sys.modules["instance"] = instance`.
Admittedly this is probably a very rarely used pattern in Python, but it
resolves a long standing comment about whether or not this is actually
possible (it turns out it is possible!). A test is added to show how it
works.
The main reason for this change is to fix a problem with imports in the
webassembly port: prior to this fix, it was not possible to do `from
js_module import function`, where `js_module` is a JavaScript object
registered to be visible to Python through the webassembly API function
`registerJsModule(js_module)`. But now with this fix that is possible.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
So these tests can run and pass using OBJ_REPR_B.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Different results are needed for different integer sizes.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
That is, an object whose type defines the protocol slot.
Note that due to protocol confusion, a variant of the original crasher that
returned e.g., a machine.Pin instance could still lead to a crash (#17852).
Fixes issue #17841.
Signed-off-by: Jeff Epler <jepler@gmail.com>
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Commit ffa98cb0143c43af9f4c61142784a08a19f660c5 improved equality for
`JsProxy` objects so that, eg, `js.Object == js.Object` is true.
As mentioned in #17758, a further optimisation is to make identity work in
that case, eg `js.Object is js.Object` should be true (on the Python side).
This commit implements that, by keeping track of all `JsProxy` Python
objects and reusing them where possible: where the underlying JS ref is
equal, ie they point to the same JS object. That reduces memory churn and
gives better identity behaviour of JS objects proxied over to Python.
As part of this, a bug is fixed where JS objects can be freed while there's
still a `JsProxy` referring to that JS object. A test is added for that
exact scenario, and the test now passes.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This test is not a PyProxy test, rather it's a JsProxy test.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This avoids remaining buggy cases where C signed overflow occurs.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
And expand the test for `readinto()` to test the difference between trying
to read the requested amount by doing multiple underlying IO calls, and
only doing one call.
Signed-off-by: Damien George <damien@micropython.org>
|