diff --git a/ports/esp32/modules/machine.py b/ports/esp32/modules/machine.py index 9cfda12f17753..eecdc14931a1a 100644 --- a/ports/esp32/modules/machine.py +++ b/ports/esp32/modules/machine.py @@ -189,4 +189,7 @@ def phases(self): # Delegate to built-in machine module. def __getattr__(attr): - return getattr(_machine, attr) + value = getattr(_machine, attr, None) + if value is None: + raise ImportError(attr) + return value diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index da712fce9be15..d2e22b7e60f7d 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -109,7 +109,7 @@ static void print_reset_info(void) { static void mp_reset(void) { mp_stack_set_top((void *)0x40000000); - mp_stack_set_limit(8192); + mp_stack_set_limit(8192 - 64); mp_hal_init(); gc_init(heap, heap + sizeof(heap)); mp_init(); diff --git a/py/persistentcode.h b/py/persistentcode.h index cf257a7ab1fb6..d6226eeaa0fcd 100644 --- a/py/persistentcode.h +++ b/py/persistentcode.h @@ -54,9 +54,9 @@ #define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_X64) #elif MICROPY_EMIT_THUMB #if defined(__thumb2__) - #if defined(__ARM_FP) && (__ARM_FP & 8) == 8 + #if defined(__ARM_FP) && (__ARM_FP & 8) == 8 && defined(__ARM_PCS_VFP) #define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7EMDP) - #elif defined(__ARM_FP) && (__ARM_FP & 4) == 4 + #elif defined(__ARM_FP) && (__ARM_FP & 4) == 4 && defined(__ARM_PCS_VFP) #define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7EMSP) #else #define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_ARMV7EM) diff --git a/tests/extmod/machine_i2s_rate.py b/tests/extmod/machine_i2s_rate.py index c8fa11514c96b..a38874fa06523 100644 --- a/tests/extmod/machine_i2s_rate.py +++ b/tests/extmod/machine_i2s_rate.py @@ -26,7 +26,10 @@ (2, Pin("D4"), Pin("D3"), Pin("D2"), None), ) elif "esp32" in sys.platform: - i2s_instances = ((0, Pin(18), Pin(19), Pin(21), Pin(14)),) + if "ESP32C3" in sys.implementation._machine or "ESP32-C3" in sys.implementation._machine: + i2s_instances = ((0, Pin(5), Pin(6), Pin(7), Pin(4)),) + else: + i2s_instances = ((0, Pin(18), Pin(19), Pin(21), Pin(14)),) # Allow for small additional RTOS overhead MAX_DELTA_MS = 8 diff --git a/tests/extmod/machine_spi_rate.py b/tests/extmod/machine_spi_rate.py index fe15b66fe648a..f78a089aae7e9 100644 --- a/tests/extmod/machine_spi_rate.py +++ b/tests/extmod/machine_spi_rate.py @@ -16,6 +16,9 @@ if "alif" in sys.platform: MAX_DELTA_MS = 20 spi_instances = ((0, None, None, None),) +elif "samd" in sys.platform: + # Use default SPI instance (tested working on ADAFRUIT_ITSYBITSY_M0_EXPRESS). + spi_instances = ((None, None, None, None),) elif "pyboard" in sys.platform: spi_instances = ( (1, None, None, None), # "explicit choice of sck/mosi/miso is not implemented" @@ -25,10 +28,10 @@ spi_instances = ((0, Pin(18), Pin(19), Pin(16)),) elif "esp32" in sys.platform: impl = str(sys.implementation) - if any(soc in impl for soc in ("ESP32C2", "ESP32C3", "ESP32C6")): - spi_instances = ((1, Pin(4), Pin(5), Pin(6)),) + if any(soc in impl for soc in ("ESP32C2", "ESP32C3", "ESP32-C3", "ESP32C6")): + spi_instances = ((1, None, None, None),) else: - spi_instances = ((1, Pin(18), Pin(19), Pin(21)), (2, Pin(18), Pin(19), Pin(21))) + spi_instances = ((1, None, None, None), (2, None, None, None)) elif "esp8266" in sys.platform: MAX_DELTA_MS = 50 # port requires much looser timing requirements spi_instances = ((1, None, None, None),) # explicit pin choice not allowed @@ -111,8 +114,10 @@ def test_spi(spi_id, sck, mosi, miso, baudrate, polarity, phase, print_results): polarity=polarity, phase=phase, ) - else: + elif spi_id is not None: s = SPI(spi_id, baudrate=baudrate, polarity=polarity, phase=phase) + else: + s = SPI(baudrate=baudrate, polarity=polarity, phase=phase) # to keep the test runtime down, use shorter buffer for lower baud rate wr_buf = wr_long if baudrate > 500_000 else wr_short diff --git a/tests/extmod/vfs_blockdev_invalid.py b/tests/extmod/vfs_blockdev_invalid.py index 4d00f4b00273a..78de383784315 100644 --- a/tests/extmod/vfs_blockdev_invalid.py +++ b/tests/extmod/vfs_blockdev_invalid.py @@ -45,6 +45,8 @@ def ioctl(self, op, arg): try: bdev = RAMBlockDevice(50) + vfs.VfsLfs2.mkfs(bdev) + vfs.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit diff --git a/tests/float/string_format_modulo2_intbig.py b/tests/float/string_format_modulo2_intbig.py index 8110bc7f62e2f..0157c7f44d170 100644 --- a/tests/float/string_format_modulo2_intbig.py +++ b/tests/float/string_format_modulo2_intbig.py @@ -1,5 +1,13 @@ # test formatting floats with large precision, that it doesn't overflow the buffer +try: + import micropython +except: + + class micropython: + def bytecode(f): + return f + def test(num, num_str): if num == float("inf") or num == 0.0 and num_str != "0.0": @@ -18,6 +26,12 @@ def test(num, num_str): # check most powers of 10, making sure to include exponents with 3 digits -for e in range(-101, 102): - num = pow(10, e) - test(num, "1e%d" % e) +# force bytecode emitter so it can feed the WDT on esp8266 +@micropython.bytecode +def main(): + for e in range(-101, 102): + num = pow(10, e) + test(num, "1e%d" % e) + + +main() diff --git a/tests/multi_net/asyncio_tls_server_client.py b/tests/multi_net/asyncio_tls_server_client.py index 98f15c6625f0e..0a19aec6853b0 100644 --- a/tests/multi_net/asyncio_tls_server_client.py +++ b/tests/multi_net/asyncio_tls_server_client.py @@ -69,5 +69,8 @@ def instance0(): def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.next() asyncio.run(tcp_client(b"client data")) diff --git a/tests/multi_net/asyncio_tls_server_client_cert_required_error.py b/tests/multi_net/asyncio_tls_server_client_cert_required_error.py index 178ad39274032..fcc09698dac36 100644 --- a/tests/multi_net/asyncio_tls_server_client_cert_required_error.py +++ b/tests/multi_net/asyncio_tls_server_client_cert_required_error.py @@ -8,6 +8,10 @@ print("SKIP") raise SystemExit +if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + PORT = 8000 # These are test certificates. See tests/README.md for details. diff --git a/tests/multi_net/asyncio_tls_server_client_readline.py b/tests/multi_net/asyncio_tls_server_client_readline.py index da5f1afee2ad6..cbeed781d0294 100644 --- a/tests/multi_net/asyncio_tls_server_client_readline.py +++ b/tests/multi_net/asyncio_tls_server_client_readline.py @@ -73,5 +73,8 @@ def instance0(): def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.next() asyncio.run(tcp_client(b"client data\nclient data2\n")) diff --git a/tests/multi_net/asyncio_tls_server_client_verify_error.py b/tests/multi_net/asyncio_tls_server_client_verify_error.py index 362f0fc8ecf72..1b4d904035416 100644 --- a/tests/multi_net/asyncio_tls_server_client_verify_error.py +++ b/tests/multi_net/asyncio_tls_server_client_verify_error.py @@ -73,5 +73,8 @@ def instance0(): def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.next() asyncio.run(tcp_client(b"client data")) diff --git a/tests/multi_net/ssl_cert_ec.py b/tests/multi_net/ssl_cert_ec.py index 2c5734e052661..d1040fa740141 100644 --- a/tests/multi_net/ssl_cert_ec.py +++ b/tests/multi_net/ssl_cert_ec.py @@ -45,6 +45,9 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/ssl_cert_rsa.py b/tests/multi_net/ssl_cert_rsa.py index d148c8ebcfea8..b007d55101724 100644 --- a/tests/multi_net/ssl_cert_rsa.py +++ b/tests/multi_net/ssl_cert_rsa.py @@ -45,6 +45,9 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/sslcontext_check_hostname_error.py b/tests/multi_net/sslcontext_check_hostname_error.py index d85363f00bd63..e45b7d33b5069 100644 --- a/tests/multi_net/sslcontext_check_hostname_error.py +++ b/tests/multi_net/sslcontext_check_hostname_error.py @@ -43,6 +43,9 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/sslcontext_getpeercert.py b/tests/multi_net/sslcontext_getpeercert.py index e9d96be248c70..b54f96b262ed2 100644 --- a/tests/multi_net/sslcontext_getpeercert.py +++ b/tests/multi_net/sslcontext_getpeercert.py @@ -25,6 +25,9 @@ # Server def instance0(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit multitest.globals(IP=multitest.get_network_ip()) s = socket.socket() s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) diff --git a/tests/multi_net/sslcontext_server_client.py b/tests/multi_net/sslcontext_server_client.py index 6516de53f7dfb..10b0abea8f16c 100644 --- a/tests/multi_net/sslcontext_server_client.py +++ b/tests/multi_net/sslcontext_server_client.py @@ -44,6 +44,10 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/sslcontext_server_client_ciphers.py b/tests/multi_net/sslcontext_server_client_ciphers.py index 3334d9d9e4c17..931638c1d5977 100644 --- a/tests/multi_net/sslcontext_server_client_ciphers.py +++ b/tests/multi_net/sslcontext_server_client_ciphers.py @@ -45,6 +45,10 @@ def instance0(): # Client def instance1(): + if not hasattr(tls, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/sslcontext_server_client_files.py b/tests/multi_net/sslcontext_server_client_files.py index 64a4215c75b44..8b3d26e8e6aec 100644 --- a/tests/multi_net/sslcontext_server_client_files.py +++ b/tests/multi_net/sslcontext_server_client_files.py @@ -42,6 +42,10 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/sslcontext_verify_callback.py b/tests/multi_net/sslcontext_verify_callback.py index 74b97382453bd..168c5bf63a1e6 100644 --- a/tests/multi_net/sslcontext_verify_callback.py +++ b/tests/multi_net/sslcontext_verify_callback.py @@ -32,6 +32,10 @@ def verify_callback(cert, depth): # Server def instance0(): + if not hasattr(tls, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + multitest.globals(IP=multitest.get_network_ip()) s = socket.socket() s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) diff --git a/tests/multi_net/sslcontext_verify_error.py b/tests/multi_net/sslcontext_verify_error.py index 5dc461e7708a8..19727efd63933 100644 --- a/tests/multi_net/sslcontext_verify_error.py +++ b/tests/multi_net/sslcontext_verify_error.py @@ -43,6 +43,10 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/sslcontext_verify_time_error.py b/tests/multi_net/sslcontext_verify_time_error.py index fbefdecf9f430..f6bbe5d855e0e 100644 --- a/tests/multi_net/sslcontext_verify_time_error.py +++ b/tests/multi_net/sslcontext_verify_time_error.py @@ -43,6 +43,10 @@ def instance0(): # Client def instance1(): + if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + multitest.next() s = socket.socket() s.connect(socket.getaddrinfo(IP, PORT)[0][-1]) diff --git a/tests/multi_net/tls_dtls_server_client.py b/tests/multi_net/tls_dtls_server_client.py index a81c4cb28230c..e9ad0ab254004 100644 --- a/tests/multi_net/tls_dtls_server_client.py +++ b/tests/multi_net/tls_dtls_server_client.py @@ -7,6 +7,10 @@ print("SKIP") raise SystemExit +if not hasattr(tls, "PROTOCOL_DTLS_SERVER"): + print("SKIP") + raise SystemExit + PORT = 8000 # These are test certificates. See tests/README.md for details. diff --git a/tests/multi_net/udp_data_multi.py b/tests/multi_net/udp_data_multi.py index 5d7b13e5188dd..a2ed33d292d78 100644 --- a/tests/multi_net/udp_data_multi.py +++ b/tests/multi_net/udp_data_multi.py @@ -5,7 +5,7 @@ NUM_NEW_SOCKETS = 4 NUM_PACKET_BURSTS = 6 -NUM_PACKET_GROUPS = 5 +NUM_PACKET_GROUPS = 4 TOTAL_PACKET_BURSTS = NUM_NEW_SOCKETS * NUM_PACKET_BURSTS # The tast passes if more than 75% of packets are received in each group. PACKET_RECV_THRESH = 0.75 * TOTAL_PACKET_BURSTS diff --git a/tests/multi_net/udp_data_multi.py.exp b/tests/multi_net/udp_data_multi.py.exp index bc67c6ab0cf01..a74ef42b7309c 100644 --- a/tests/multi_net/udp_data_multi.py.exp +++ b/tests/multi_net/udp_data_multi.py.exp @@ -7,7 +7,6 @@ pass group=0 pass group=1 pass group=2 pass group=3 -pass group=4 --- instance1 --- test socket 0 test socket 1 diff --git a/tests/net_hosted/ssl_verify_callback.py b/tests/net_hosted/ssl_verify_callback.py index 0dba4e4fddcf6..cd03ff49d77f1 100644 --- a/tests/net_hosted/ssl_verify_callback.py +++ b/tests/net_hosted/ssl_verify_callback.py @@ -4,6 +4,12 @@ import socket import tls +context = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT) + +if not hasattr(context, "verify_callback"): + print("SKIP") + raise SystemExit + def verify_callback(cert, depth): print("verify_callback:", type(cert), len(cert) > 100, depth) @@ -16,7 +22,6 @@ def verify_callback_fail(cert, depth): def test(peer_addr): - context = tls.SSLContext(tls.PROTOCOL_TLS_CLIENT) context.verify_mode = tls.CERT_OPTIONAL context.verify_callback = verify_callback s = socket.socket() diff --git a/tests/net_inet/asyncio_tls_open_connection_readline.py b/tests/net_inet/asyncio_tls_open_connection_readline.py index 70145d91a794b..796d576a0a3ff 100644 --- a/tests/net_inet/asyncio_tls_open_connection_readline.py +++ b/tests/net_inet/asyncio_tls_open_connection_readline.py @@ -2,6 +2,10 @@ import os import asyncio +if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + # This certificate was obtained from micropython.org using openssl: # $ openssl s_client -showcerts -connect micropython.org:443 /dev/null # The certificate is from Let's Encrypt: diff --git a/tests/net_inet/ssl_cert.py b/tests/net_inet/ssl_cert.py index 7bb270d5fda7a..4f065c5657ee2 100644 --- a/tests/net_inet/ssl_cert.py +++ b/tests/net_inet/ssl_cert.py @@ -1,6 +1,9 @@ import socket import ssl +if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit # This certificate was obtained from micropython.org using openssl: # $ openssl s_client -showcerts -connect micropython.org:443 /dev/null diff --git a/tests/net_inet/ssl_errors.py b/tests/net_inet/ssl_errors.py index bc4e5910bccd8..c23f736b09b08 100644 --- a/tests/net_inet/ssl_errors.py +++ b/tests/net_inet/ssl_errors.py @@ -3,6 +3,10 @@ import sys, errno, select, socket, ssl +if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + def test(addr, hostname, block=True): print("---", hostname) diff --git a/tests/net_inet/test_sslcontext_client.py b/tests/net_inet/test_sslcontext_client.py index 0c83abb733378..574a64ae6729a 100644 --- a/tests/net_inet/test_sslcontext_client.py +++ b/tests/net_inet/test_sslcontext_client.py @@ -2,6 +2,10 @@ import socket import ssl +if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + # This certificate was obtained from micropython.org using openssl: # $ openssl s_client -showcerts -connect micropython.org:443 /dev/null # The certificate is from Let's Encrypt: diff --git a/tests/net_inet/test_tls_nonblock.py b/tests/net_inet/test_tls_nonblock.py index 60af858b1f146..3f9a61413f9cf 100644 --- a/tests/net_inet/test_tls_nonblock.py +++ b/tests/net_inet/test_tls_nonblock.py @@ -1,5 +1,12 @@ import socket, ssl, errno, sys, time, select +# Although this test doesn't need ssl.CERT_REQUIRED, it does require the ssl module +# to support modern ciphers. So exclude the test on axTLS which doesn't have +# CERT_REQUIRED. +if not hasattr(ssl, "CERT_REQUIRED"): + print("SKIP") + raise SystemExit + def test_one(site, opts): ai = socket.getaddrinfo(site, 443, socket.AF_INET) diff --git a/tests/net_inet/tls_num_errors.py b/tests/net_inet/tls_num_errors.py index 34aa2bb455134..9c12114eab1f6 100644 --- a/tests/net_inet/tls_num_errors.py +++ b/tests/net_inet/tls_num_errors.py @@ -3,15 +3,21 @@ import socket, ssl, sys try: - from micropython import alloc_emergency_exception_buf, heap_lock, heap_unlock + from micropython import heap_lock, heap_unlock except: print("SKIP") raise SystemExit +try: + from micropython import alloc_emergency_exception_buf + + alloc_emergency_exception_buf(256) +except: + pass + # test with heap locked to see it switch to number-only error message def test(addr): - alloc_emergency_exception_buf(256) s = socket.socket() s.connect(addr) try: diff --git a/tests/perf_bench/core_import_mpy_multi.py b/tests/perf_bench/core_import_mpy_multi.py index 8affa157fa0c5..3d5f89c8f68f0 100644 --- a/tests/perf_bench/core_import_mpy_multi.py +++ b/tests/perf_bench/core_import_mpy_multi.py @@ -1,8 +1,9 @@ # Test performance of importing an .mpy file many times. -import sys, io, vfs - -if not hasattr(io, "IOBase"): +try: + import sys, vfs + from io import IOBase +except ImportError: print("SKIP") raise SystemExit @@ -26,7 +27,7 @@ def f(): file_data = b'M\x06\x00\x1f\x14\x03\x0etest.py\x00\x0f\x02A\x00\x02f\x00\x0cresult\x00/-5#\x82I\x81{\x81w\x82/\x81\x05\x81\x17Iom\x82\x13\x06arg\x00\x05\x1cthis will be a string object\x00\x06\x1bthis will be a bytes object\x00\n\x07\x05\x0bconst tuple\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\x81\\\x10\n\x01\x89\x07d`T2\x00\x10\x024\x02\x16\x022\x01\x16\x03"\x80{\x16\x04Qc\x02\x81d\x00\x08\x02(DD\x11\x05\x16\x06\x10\x02\x16\x072\x00\x16\x082\x01\x16\t2\x02\x16\nQc\x03`\x1a\x08\x08\x12\x13@\xb1\xb0\x18\x13Qc@\t\x08\t\x12` Qc@\t\x08\n\x12``Qc\x82@ \x0e\x03\x80\x08+)##\x12\x0b\x12\x0c\x12\r\x12\x0e*\x04Y\x12\x0f\x12\x10\x12\x11*\x03Y#\x00\xc0#\x01\xc0#\x02\xc0Qc' -class File(io.IOBase): +class File(IOBase): def __init__(self): self.off = 0 diff --git a/tests/perf_bench/core_import_mpy_single.py b/tests/perf_bench/core_import_mpy_single.py index 4d9aa67bf2f0e..843bdab934d08 100644 --- a/tests/perf_bench/core_import_mpy_single.py +++ b/tests/perf_bench/core_import_mpy_single.py @@ -2,9 +2,10 @@ # The first import of a module will intern strings that don't already exist, and # this test should be representative of what happens in a real application. -import sys, io, vfs - -if not hasattr(io, "IOBase"): +try: + import sys, vfs + from io import IOBase +except ImportError: print("SKIP") raise SystemExit @@ -81,7 +82,7 @@ def f1(): file_data = b"M\x06\x00\x1f\x81=\x1e\x0etest.py\x00\x0f\x04A0\x00\x04A1\x00\x04f0\x00\x04f1\x00\x0cresult\x00/-5\x04a0\x00\x04a1\x00\x04a2\x00\x04a3\x00\x13\x15\x17\x19\x1b\x1d\x1f!#%')+1379;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}\x7f\x81\x01\x81\x03\x81\x05\x81\x07\x81\t\x81\x0b\x81\r\x81\x0f\x81\x11\x81\x13\x81\x15\x81\x17\x81\x19\x81\x1b\x81\x1d\x81\x1f\x81!\x81#\x81%\x81'\x81)\x81+\x81-\x81/\x811\x813\x815\x817\x819\x81;\x81=\x81?\x81A\x81C\x81E\x81G\x81I\x81K\x81M\x81O\x81Q\x81S\x81U\x81W\x81Y\x81[\x81]\x81_\x81a\x81c\x81e\x81g\x81i\x81k\x81m\x81o\x81q\x81s\x81u\x81w\x81y\x81{\x81}\x81\x7f\x82\x01\x82\x03\x82\x05\x82\x07\x82\t\x82\x0b\x82\r\x82\x0f\x82\x11\x82\x13\x82\x15\x82\x17\x82\x19\x82\x1b\x82\x1d\x82\x1f\x82!\x82#\x82%\x82'\x82)\x82+\x82-\x82/\x821\x823\x825\x827\x829\x82;\x82=\x82?\x82A\x82E\x82G\x82I\x82K\nname0\x00\nname1\x00\nname2\x00\nname3\x00\nname4\x00\nname5\x00\nname6\x00\nname7\x00\nname8\x00\nname9\x00$quite_a_long_name0\x00$quite_a_long_name1\x00$quite_a_long_name2\x00$quite_a_long_name3\x00$quite_a_long_name4\x00$quite_a_long_name5\x00$quite_a_long_name6\x00$quite_a_long_name7\x00$quite_a_long_name8\x00$quite_a_long_name9\x00&quite_a_long_name10\x00&quite_a_long_name11\x00\x05\x1ethis will be a string object 0\x00\x05\x1ethis will be a string object 1\x00\x05\x1ethis will be a string object 2\x00\x05\x1ethis will be a string object 3\x00\x05\x1ethis will be a string object 4\x00\x05\x1ethis will be a string object 5\x00\x05\x1ethis will be a string object 6\x00\x05\x1ethis will be a string object 7\x00\x05\x1ethis will be a string object 8\x00\x05\x1ethis will be a string object 9\x00\x06\x1dthis will be a bytes object 0\x00\x06\x1dthis will be a bytes object 1\x00\x06\x1dthis will be a bytes object 2\x00\x06\x1dthis will be a bytes object 3\x00\x06\x1dthis will be a bytes object 4\x00\x06\x1dthis will be a bytes object 5\x00\x06\x1dthis will be a bytes object 6\x00\x06\x1dthis will be a bytes object 7\x00\x06\x1dthis will be a bytes object 8\x00\x06\x1dthis will be a bytes object 9\x00\n\x07\x05\rconst tuple 0\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 1\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 2\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 3\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 4\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 5\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 6\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 7\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 8\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 9\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\x82d\x10\x12\x01i@i@\x84\x18\x84\x1fT2\x00\x10\x024\x02\x16\x02T2\x01\x10\x034\x02\x16\x032\x02\x16\x042\x03\x16\x05\"\x80{\x16\x06Qc\x04\x82\x0c\x00\n\x02($$$\x11\x07\x16\x08\x10\x02\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04@\t\x08\n\x81\x0b Qc@\t\x08\x0b\x81\x0b@Qc@\t\x08\x0c\x81\x0b`QcH\t\n\r\x81\x0b` Qc\x82\x14\x00\x0c\x03h`$$$\x11\x07\x16\x08\x10\x03\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04H\t\n\n\x81\x0b``QcH\t\n\x0b\x81\x0b\x80\x07QcH\t\n\x0c\x81\x0b\x80\x08QcH\t\n\r\x81\x0b\x80\tQc\xa08P:\x04\x80\x0b13///---997799<\x1f%\x1f\"\x1f%)\x1f\"//\x12\x0e\x12\x0f\x12\x10\x12\x11\x12\x12\x12\x13\x12\x14*\x07Y\x12\x15\x12\x16\x12\x17\x12\x18\x12\x19\x12\x1a\x12\x08\x12\x07*\x08Y\x12\x1b\x12\x1c\x12\t\x12\x1d\x12\x1e\x12\x1f*\x06Y\x12 \x12!\x12\"\x12#\x12$\x12%*\x06Y\x12&\x12'\x12(\x12)\x12*\x12+*\x06Y\x12,\x12-\x12.\x12/\x120*\x05Y\x121\x122\x123\x124\x125*\x05Y\x126\x127\x128\x129\x12:*\x05Y\x12;\x12<\x12=\x12>\x12?\x12@\x12A\x12B\x12C\x12D\x12E*\x0bY\x12F\x12G\x12H\x12I\x12J\x12K\x12L\x12M\x12N\x12O\x12P*\x0bY\x12Q\x12R\x12S\x12T\x12U\x12V\x12W\x12X\x12Y\x12Z*\nY\x12[\x12\\\x12]\x12^\x12_\x12`\x12a\x12b\x12c\x12d*\nY\x12e\x12f\x12g\x12h\x12i\x12j\x12k\x12l\x12m\x12n\x12o*\x0bY\x12p\x12q\x12r\x12s\x12t\x12u\x12v\x12w\x12x\x12y\x12z*\x0bY\x12{\x12|\x12}\x12~\x12\x7f\x12\x81\x00\x12\x81\x01\x12\x81\x02\x12\x81\x03\x12\x81\x04*\nY\x12\x81\x05\x12\x81\x06\x12\x81\x07\x12\x81\x08\x12\x81\t\x12\x81\n\x12\x81\x0b\x12\x81\x0c\x12\x81\r\x12\x81\x0e\x12\x81\x0f*\x0bY\x12\x81\x10\x12\x81\x11\x12\x81\x12\x12\x81\x13\x12\x81\x14\x12\x81\x15\x12\x81\x16\x12\x81\x17\x12\x81\x18\x12\x81\x19*\nY\x12\x81\x1a\x12\x81\x1b\x12\x81\x1c\x12\x81\x1d\x12\x81\x1e\x12\x81\x1f\x12\x81 \x12\x81!\x12\x81\"\x12\x81#\x12\x81$*\x0bY\x12\x81%\x12\x81&*\x02Y\x12\x81'\x12\x81(\x12\x81)\x12\x81*\x12\x81+\x12\x81,\x12\x81-\x12\x81.\x12\x81/\x12\x810*\nY\x12\x811\x12\x812\x12\x813\x12\x814*\x04Y\x12\x815\x12\x816\x12\x817\x12\x818*\x04Y\x12\x819\x12\x81:\x12\x81;\x12\x81<*\x04YQc\x87p\x08@\x05\x80###############################\x00\xc0#\x01\xc0#\x02\xc0#\x03\xc0#\x04\xc0#\x05\xc0#\x06\xc0#\x07\xc0#\x08\xc0#\t\xc0#\n\xc0#\x0b\xc0#\x0c\xc0#\r\xc0#\x0e\xc0#\x0f\xc0#\x10\xc0#\x11\xc0#\x12\xc0#\x13\xc0#\x14\xc0#\x15\xc0#\x16\xc0#\x17\xc0#\x18\xc0#\x19\xc0#\x1a\xc0#\x1b\xc0#\x1c\xc0#\x1d\xc0Qc" -class File(io.IOBase): +class File(IOBase): def __init__(self): self.off = 0 diff --git a/tests/ports/stm32/adcall.py b/tests/ports/stm32/adcall.py index 18896c40cb2a3..cf60aad04cc65 100644 --- a/tests/ports/stm32/adcall.py +++ b/tests/ports/stm32/adcall.py @@ -33,10 +33,14 @@ print(type(adc.read_channel(c))) # call special reading functions -print(skip_temp_test or 0 < adc.read_core_temp() < 100) -print(0 < adc.read_core_vbat() < 4) -print(0 < adc.read_core_vref() < 2) -print(0 < adc.read_vref() < 4) +core_temp = adc.read_core_temp() +core_vbat = adc.read_core_vbat() +core_vref = adc.read_core_vref() +vref = adc.read_vref() +print(skip_temp_test or 0 < core_temp < 100 or core_temp) +print(0 < core_vbat < 4 or core_vbat) +print(0 < core_vref < 2 or core_vref) +print(0 < vref < 4 or vref) if sys.implementation._build == "NUCLEO_WB55": # Restore button pin settings. diff --git a/tests/run-perfbench.py b/tests/run-perfbench.py index cac2fee58f0dc..f29326a88f26f 100755 --- a/tests/run-perfbench.py +++ b/tests/run-perfbench.py @@ -100,14 +100,20 @@ def run_benchmarks(args, target, param_n, param_m, n_average, test_list): print(test_file + ": ", end="") # Check if test should be skipped + skip_reason = "" skip = ( skip_complex - and test_file.find("bm_fft") != -1 + and test_file.endswith(("bm_fft.py", "misc_mandel.py")) or skip_native and test_file.find("viper_") != -1 ) + # bm_hexiom is large. Assume a target without complex support + # doesn't have much RAM and also so skip bm_hexiom. + if skip_complex and test_file.find("bm_hexiom") != -1: + skip = True + skip_reason = "too large" if skip: - test_results.append((test_file, "skip", "")) + test_results.append((test_file, "skip", skip_reason)) print("SKIP") continue @@ -168,6 +174,9 @@ def run_benchmarks(args, target, param_n, param_m, n_average, test_list): if error is not None: if error.startswith("SKIP"): test_results.append((test_file, "skip", error)) + elif error.startswith("CRASH:") and error.find("MemoryError:") != -1: + test_results.append((test_file, "skip", "too large")) + error = "SKIP: too large" else: test_results.append((test_file, "fail", error)) print(error) diff --git a/tests/run-tests.py b/tests/run-tests.py index 48dfc2f26e070..eed921650c55f 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -135,6 +135,24 @@ def open(self, path, mode): "thread/thread_lock3.py", "thread/thread_shared2.py", ), + "samd/armv6m": ( + # Requires unicode. + "extmod/json_loads.py", + # Fails timing bounds. + "extmod/time_res.py", + # Require more detailed error messages. + "micropython/emg_exc.py", + "micropython/heapalloc_exc_compressed.py", + "micropython/heapalloc_exc_compressed_emg_exc.py", + "micropython/native_with.py", + "micropython/opt_level_lineno.py", + "micropython/viper_with.py", + "misc/print_exception.py", + # Not enough memory running the test. + "micropython/viper_ptr16_store_boundary_intbig.py", + "micropython/viper_ptr32_store_boundary_intbig.py", + "micropython/viper_ptr8_store_boundary_intbig.py", + ), "qemu": ( # Skip tests that require Cortex-M4. "inlineasm/thumb/asmfpaddsub.py", @@ -350,7 +368,7 @@ def run_script_on_remote_target(pyb, args, test_file, is_special): return had_crash, output_mupy -special_tests = [ +tests_with_regex_output = [ base_path(file) for file in ( "micropython/meminfo.py", @@ -367,10 +385,7 @@ def run_micropython(pyb, args, test_file, test_file_abspath, is_special=False): had_crash = False if pyb is None: # run on PC - if ( - test_file_abspath.startswith((base_path("cmdline/"), base_path("feature_check/"))) - or test_file_abspath in special_tests - ): + if test_file_abspath.startswith((base_path("cmdline/"), base_path("feature_check/"))): # special handling for tests of the unix cmdline program is_special = True @@ -502,7 +517,7 @@ def send_get(what): if is_special and not had_crash and b"\nSKIP\n" in output_mupy: return b"SKIP\n" - if is_special or test_file_abspath in special_tests: + if is_special or test_file_abspath in tests_with_regex_output: # convert parts of the output that are not stable across runs with open(test_file + ".exp", "rb") as f: lines_exp = [] @@ -714,13 +729,18 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add("inlineasm/thumb/asmbitops.py") skip_tests.add("inlineasm/thumb/asmconst.py") skip_tests.add("inlineasm/thumb/asmdiv.py") + skip_tests.add("inlineasm/thumb/asmit.py") + skip_tests.add("inlineasm/thumb/asmspecialregs.py") + if ( + output != b"thumb2\n" + or args.via_mpy + and args.arch not in ("armv7emsp", "armv7emdp") + ): skip_tests.add("inlineasm/thumb/asmfpaddsub.py") skip_tests.add("inlineasm/thumb/asmfpcmp.py") skip_tests.add("inlineasm/thumb/asmfpldrstr.py") skip_tests.add("inlineasm/thumb/asmfpmuldiv.py") skip_tests.add("inlineasm/thumb/asmfpsqrt.py") - skip_tests.add("inlineasm/thumb/asmit.py") - skip_tests.add("inlineasm/thumb/asmspecialregs.py") # Check if emacs repl is supported, and skip such tests if it's not t = run_feature_check(pyb, args, "repl_emacs_check.py") @@ -826,6 +846,8 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): # Skip platform-specific tests. skip_tests.update(platform_tests_to_skip.get(args.platform, ())) + if args.arch is not None: + skip_tests.update(platform_tests_to_skip.get(args.platform + "/" + args.arch, ())) # Some tests are known to fail on 64-bit machines if pyb is None and platform.architecture()[0] == "64bit": @@ -876,6 +898,8 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add("stress/bytecode_limit.py") # bytecode specific test skip_tests.add("extmod/asyncio_event_queue.py") # native can't run schedule skip_tests.add("extmod/asyncio_iterator_event.py") # native can't run schedule + skip_tests.add("misc/sys_settrace_cov.py") # sys.settrace() not supported + skip_tests.add("thread/thread_exc2.py") # requires traceback info def run_one_test(test_file): test_file = test_file.replace("\\", "/")