Commit Graph

17 Commits

Author SHA1 Message Date
Damien George
09b058559b tests/run-natmodtests.py: Create a _result.json at end of run.
Reuse the `create_test_report()` function from `run-tests.py` to generate a
`_result.json` file summarising the test run.

Signed-off-by: Damien George <damien@micropython.org>
2025-06-12 21:53:31 +10:00
Alessandro Gatti
9ef7322a5d tests/run-natmodtests.py: Allow injected code customisation.
This commit introduces a mechanism to customise the code that is
injected to the board when performing a native module import.

A new argument, "-b"/"--begin", is added so regular Python code can be
inserted in the injected fragment between the module file creation and
the effective module import.  This is needed for running natmod tests on
ESP8266 as that board does not have enough memory to fit certain modules
unless additional configuration is performed.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-06-04 22:35:39 +10:00
Alessandro Gatti
dfd1d69a72 tests/run-natmodtests.py: Autodetect the test target architecture.
This commit lets the natmod tests runner to automatically detect the
architecture of the test target.  This allows to avoid to explicitly
pass the architecture name to the runner in test scripts.

However, the ability to manually specify a target was not removed but it
was made optional.  This way the user is able to override the
architecture name if needed (like if one wants to test an armv6 MPY on
an armv7 board).

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07 17:37:04 +11:00
Damien George
a3128f89cc tests: Fix all file ioctl's to support only MP_STREAM_CLOSE.
A return value of 0 from Python-level `ioctl()` means success, but if
that's returned unconditionally it means that the method supports all
ioctl calls, which is not true.  Returning 0 without doing anything can
potentially lead to a crash, eg for MP_STREAM_SEEK which requires returning
a value in the passed-in struct pointer.

This commit makes it so that all `ioctl()` methods respond only to
MP_STREAM_CLOSE, ie they return -1 (indicating error) for all other ioctl
calls.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-20 21:52:19 +11:00
Damien George
5d07d0c7b0 tests/run-natmodtests.py: Fix search for supported native tests.
Signed-off-by: Damien George <damien@micropython.org>
2024-05-27 11:44:54 +10:00
Damien George
b87bbaeb43 tests: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07 13:25:09 +11:00
Jim Mussared
ea1a5e43d0 examples/natmod/deflate: Add deflate as a dynamic native module.
This replaces the previous zlib version.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 19:32:42 +10:00
Jim Mussared
add1200343 all: Remove the zlib module.
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-07-21 18:48:29 +10:00
Jim Mussared
9d7eac0713 tests/run-natmodtests.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
Jim Mussared
4216bc7d13 tests: Replace umodule with module everywhere.
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
d53c3b6ade unix/variants: Remove variant suffix from executable filename.
The executable now lives in the build directory, and since the build
directory already contains the variant name there is no need to also add
it to the executable.

Signed-off-by: Damien George <damien@micropython.org>
2022-08-11 13:34:34 +10:00
Daniel Jour
47c84286e8 all: Fix paths to mpy-cross and micropython binaries.
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-08-11 13:31:13 +10:00
stijn
40ad8f1666 all: Rename "sys" module to "usys".
This is consistent with the other 'micro' modules and allows implementing
additional features in Python via e.g. micropython-lib's sys.

Note this is a breaking change (not backwards compatible) for ports which
do not enable weak links, as "import sys" must now be replaced with
"import usys".
2020-09-04 00:10:24 +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
Jim Mussared
977b532c8f unix: Rename unix binaries to micropython-variant (not _variant).
For consistency with mpy-cross, and other unix tools in general.
2020-01-12 10:37:40 +11:00
Damien George
ba84453f77 examples/natmod: Add urandom native module example. 2019-12-13 13:33:40 +11:00
Damien George
4eef940edb tests: Add script to run dynamic-native-module tests. 2019-12-12 20:15:28 +11:00