Commit Graph

388 Commits

Author SHA1 Message Date
eightycc a4c4c16dd5
Update vfs_fat_ramdisk.py.exp 2023-11-07 13:52:43 -08:00
eightycc 6d1b1700bb
Update vfs_blockdev.py.exp 2023-11-07 13:50:51 -08:00
Bob Abeles 966e6e4fe5 Shrink root dir size for tiny (<=128K) FAT12 fs 2023-11-07 10:24:36 -08:00
Dan Halbert 8f254035dd pre-commit fixes 2023-10-23 20:14:40 -04:00
Scott Shawcroft 508b064ebb
Fix tests and update translations 2023-10-20 16:56:30 -07:00
Dan Halbert 367e13c69f change CIRCUITPY change markers to CIRCUITPY-CHANGE 2023-10-19 16:42:36 -04:00
Dan Halbert f2ebe6839c Initial MicroPython v1.21.0 merge; not compiled yet 2023-10-18 17:49:14 -04:00
Scott Shawcroft 9930bc151a
Fix skipped test 2023-10-16 10:43:30 -07:00
Scott Shawcroft 9633c4e78f
Merge remote-tracking branch 'adafruit/main' into v1.20-merge 2023-10-11 11:21:57 -07:00
Jim Mussared fae83a6b4d tests/extmod/asyncio_threadsafeflag.py: Update for unix select.
1. Remove the skip for detecting support for polling user-defined objects
   as this is always possible now on all ports.
2. Don't print when the scheduled task runs as the ordering of this
   relative to the other prints is dependent on other factors (e.g. if
   using the native emitter).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-29 17:58:40 +10:00
Damien George 62c3033ba6 tests/extmod/vfs_fat_finaliser.py: Tweak test so files are collected.
Signed-off-by: Damien George <damien@micropython.org>
2023-09-29 12:02:36 +10:00
Damien George a7e2a6d9f2 tests/extmod/ssl_cadata.py: Skip test on axtls.
The axtls bindings don't support this.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-29 12:01:50 +10:00
Damien George a33766880e tests/extmod/deflate_decompress.py: Skip test when not enough memory.
Signed-off-by: Damien George <damien@micropython.org>
2023-09-29 12:01:04 +10:00
Dan Halbert 2c0fa0f7dc initial merge from v1.20.0; just satisifying conflicts 2023-09-19 11:10:12 -04:00
Damien George 397697aa83 py/persistentcode: Always close reader even if an exception is raised.
Fixes issue #3874.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-14 13:03:31 +10:00
Damien George 5e122b11ea py/parse: Always free lexer even if an exception is raised.
Fixes issue #3843.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-14 13:03:31 +10:00
Dan Halbert 88c22d5052 remove last uses of 'u' prefix 2023-08-22 12:57:47 -04:00
Jeff Epler 562520e158
Skip these tests when using --emit native
.. in which case the __await__ attribute is not available due to
"CIRCUITPY: no support for mp_type_native_coro_wrap" (emitglue.c)
2023-08-20 08:02:31 -05:00
Dan Halbert bfccb77ec1 asyncio test fixes and asyncio library updates 2023-08-18 13:16:16 -04:00
Jeff Epler f0a8d449c1
fix vfs_fat_case 2023-08-15 11:50:11 -05:00
Damien George 88518009ce tests/extmod/select_poll_eintr.py: Improve robustness of test.
Increase allowed range of dt_ms, and print it in case of failure.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-15 00:08:51 +10:00
Damien George f6af48416d extmod/modselect: Properly track number of poll objects that are fd's.
Signed-off-by: Damien George <damien@micropython.org>
2023-08-14 18:48:47 +10:00
Damien George d529c20674 extmod/modssl_mbedtls: Fix ioctl of a socket in closed/error state.
Signed-off-by: Damien George <damien@micropython.org>
2023-08-09 13:22:57 +10:00
Damien George 20d3a6b196 extmod/modssl_mbedtls: Reject ioctls that are not supported.
An SSL stream can only handle CLOSE and POLL ioctls.  Other ones do not
make sense, or at least it doesn't make sense to pass the ioctl request
directly down to the underlying stream.

In particular MP_STREAM_GET_FILENO should not be passed to the underlying
stream because the SSL stream is not directly related to a file descriptor,
and the SSL stream must handle the polling itself.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-09 13:22:32 +10:00
Damien George 218242d1de tests/extmod: Skip select/socket tests if they can't create UDP socket.
Some targets (eg PYBV10) have the socket module but are unable to create
UDP sockets without a registered NIC.  So skip UDP tests on these targets.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-07 12:39:29 +10:00
Damien George 6b78a1bf00 tests/extmod: Add coverage tests for select module.
Signed-off-by: Damien George <damien@micropython.org>
2023-08-07 12:37:48 +10:00
Dan Halbert 0d4bc8c163 initial v1.19.1 merge; not compiled yet 2023-08-01 13:50:05 -04:00
Jim Mussared 8b315ef0d8 tests/extmod: Add deflate.DeflateIO tests.
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
Damien George 9900eaa269 tests/extmod: Add test for passing cadata into ssl.wrap_socket().
For coverage.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-26 16:34:41 +10:00
Damien George b50da3dbd7 tests/extmod: Add tests for ssl.SSLContext.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-26 16:34:41 +10:00
Damien George e8a4c1dd53 extmod/modssl: Add SSLContext class.
This commit adds the SSLContext class to the ssl module, and retains the
existing ssl.wrap_socket() function to maintain backwards compatibility.

CPython deprecated the ssl.wrap_socket() function since CPython 3.7 and
instead one should use ssl.SSLContext().wrap_socket().  This commit makes
that possible.

For the axtls implementation:
- ssl.SSLContext is added, although it doesn't hold much state because
  axtls requires calling ssl_ctx_new() for each new socket
- ssl.SSLContext.wrap_socket() is added
- ssl.PROTOCOL_TLS_CLIENT and ssl.PROTOCOL_TLS_SERVER are added

For the mbedtls implementation:
- ssl.SSLContext is added, and holds most of the mbedtls state
- ssl.verify_mode is added (getter and setter)
- ssl.SSLContext.wrap_socket() is added
- ssl.PROTOCOL_TLS_CLIENT and ssl.PROTOCOL_TLS_SERVER are added

The signatures match CPython:
- SSLContext(protocol)
- SSLContext.wrap_socket(sock, *, server_side=False,
    do_handshake_on_connect=True, server_hostname=None)

The existing ssl.wrap_socket() functions retain their existing signature.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-26 16:34:41 +10:00
Duncan Lowther 41c91422f0
tests/extmod/framebuf: Fix buffer size issues.
Tests framebuf1 and framebuf2 do not take the need for byte-aligned
strides into consideration when calculating buffer lengths.
Accordingly, the buffers allocated are slightly too small. Fixed
buffer length calculations.

Signed-off-by: Duncan Lowther <Duncan.Lowther@glasgow.ac.uk>
2023-06-21 09:49:03 +01:00
Duncan Lowther bc2ed8c55a
tests/extmod/uctypes_array_assign_le: Fix buffer.
Structure descriptor in test extmod/uctypes_array_assign_le
is 6 bytes long, due to member "arr3" having length 4
(2 * UINT16) and offset 2, but only 5 bytes are allocated.
Increased buffer length to 6 bytes.

Signed-off-by: Duncan Lowther <Duncan.Lowther@glasgow.ac.uk>
2023-06-21 09:48:37 +01:00
Jim Mussared ca79b49619 extmod/asyncio/uasyncio.py: Add backwards-compatible uasyncio alias.
This allows existing code that does `import uasyncio` or
`import uasyncio as asyncio` to continue working.

It uses the same lazy-loading as asyncio to prevent loading of unused
features.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 18:37:34 +10:00
Jim Mussared 6027c41c8f tests: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 17:33:03 +10:00
Jim Mussared a1fbb1980c extmod/modtimeq: Remove timeq module.
This is a MicroPython-specific module that existed to support the old
version of uasyncio.  It's undocumented and not enabled on all ports and
takes up code size unnecessarily.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:28 +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 b1229efbd1 all: Fix spelling mistakes based on codespell check.
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27 18:03:06 +10:00
Damien George a4672149b6 tests/extmod/vfs_fat_ilistdir_del.py: Use 512-byte erase block size.
Following other vfs_fat tests, so the test works on ports like stm32 that
only support 512-byte block size.

Signed-off-by: Damien George <damien@micropython.org>
2023-03-29 23:15:16 +11:00
Jeremy Rand d677023b3d extmod/vfs_posix: Do not filter '..*' in ilistdir when filtering '..'.
When iterating over os.ilistdir(), the special directories '.' and '..'
are filtered from the results.  But the code inadvertently also filtered
any file/directory which happened to match '..*'.  This change fixes the
filter.

Fixes issue #11032.

Signed-off-by: Jeremy Rand <jeremy@rand-family.com>
2023-03-21 16:13:10 +11:00
hathach fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
Scott Shawcroft 144aed40e3
Rename flag. Turn on UTF-8 and flag on unix
Also added label portion to the test.
2023-02-24 12:23:59 -08:00
Scott Shawcroft 1197394a03
Add simple test 2023-02-23 15:53:59 -08:00
Damien George d99ebb310c tests/extmod: Skip vfs tests if target doesn't have enough memory.
Signed-off-by: Damien George <damien@micropython.org>
2023-02-09 15:32:06 +11:00
Damien George b1123a54c1 tests/extmod: Get DecompIO test running on low-memory targets.
By changing the zlib header so that it uses a small (256 byte) window.

Signed-off-by: Damien George <damien@micropython.org>
2023-02-09 15:20:25 +11:00
Jim Mussared 8b27482692 top: Update Python formatting to black "2023 stable style".
See https://black.readthedocs.io/en/stable/the_black_code_style/index.html

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-02 12:51:03 +11:00
MicroDev d9d94eacca
run updated pre-commit 2023-02-01 13:38:41 +05:30
Damien George fc745d85fe tests/extmod/ure_namedclass: Add tests for named classes in class sets.
Signed-off-by: Damien George <damien@micropython.org>
2023-01-18 09:15:32 +11:00
Damien Tournoud ed58d6e4ce extmod/modussl_mbedtls: Fix support for ioctl(MP_STREAM_POLL).
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-15 12:06:22 -08:00