summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-08-18 11:13:08 +1000
committerDamien George <damien@micropython.org>2025-08-28 23:13:40 +1000
commitbf185c37ed13e120383f2cbdf85e606e1e0a368a (patch)
treec1a7d9ce3881a46b4b0fdfa57b292f78c9a8d5aa
parentf62c614d3e5f8bdfa6a3e1265cd5af8dca00adb1 (diff)
tests/run-natmodtests.py: Change -p/-d arguments to -t.
Following the similar change to `run-tests.py` and `run-multitests.py`. What was previously, eg, `-p -d /dev/ttyACM0` is now `-t a0`. Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--ports/qemu/Makefile2
-rwxr-xr-xtests/run-natmodtests.py28
2 files changed, 17 insertions, 13 deletions
diff --git a/ports/qemu/Makefile b/ports/qemu/Makefile
index 7784a266c..d213c8fc0 100644
--- a/ports/qemu/Makefile
+++ b/ports/qemu/Makefile
@@ -225,7 +225,7 @@ test_natmod: $(BUILD)/firmware.elf
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && \
for natmod in btree deflate framebuf heapq random_basic re; do \
- ./run-natmodtests.py -p -d execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_TESTS_EXTRA) extmod/$$natmod*.py; \
+ ./run-natmodtests.py -t execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_TESTS_EXTRA) extmod/$$natmod*.py; \
done
$(BUILD)/firmware.elf: $(LDSCRIPT) $(OBJ)
diff --git a/tests/run-natmodtests.py b/tests/run-natmodtests.py
index 55adb6049..50e8d1272 100755
--- a/tests/run-natmodtests.py
+++ b/tests/run-natmodtests.py
@@ -11,9 +11,6 @@ import argparse
run_tests_module = __import__("run-tests")
-sys.path.append("../tools")
-import pyboard
-
# Paths for host executables
CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3")
MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/build-coverage/micropython")
@@ -112,7 +109,7 @@ class TargetPyboard:
output = self.pyb.exec_(script)
output = output.replace(b"\r\n", b"\n")
return output, None
- except pyboard.PyboardError as er:
+ except run_tests_module.pyboard.PyboardError as er:
return b"", er
@@ -227,14 +224,16 @@ def run_tests(target_truth, target, args, resolved_arch):
def main():
cmd_parser = argparse.ArgumentParser(
- description="Run dynamic-native-module tests under MicroPython"
- )
- cmd_parser.add_argument(
- "-p", "--pyboard", action="store_true", help="run tests via pyboard.py"
+ description="Run dynamic-native-module tests under MicroPython",
+ epilog=run_tests_module.test_instance_epilog,
+ formatter_class=argparse.RawDescriptionHelpFormatter,
)
cmd_parser.add_argument(
- "-d", "--device", default="/dev/ttyACM0", help="the device for pyboard.py"
+ "-t", "--test-instance", default="unix", help="the MicroPython instance to test"
)
+ cmd_parser.add_argument("--baudrate", default=115200, help="baud rate of the serial device")
+ cmd_parser.add_argument("--user", default="micro", help="telnet login username")
+ cmd_parser.add_argument("--password", default="python", help="telnet login password")
cmd_parser.add_argument(
"-a", "--arch", choices=AVAILABLE_ARCHS, help="override native architecture of the target"
)
@@ -256,10 +255,15 @@ def main():
target_truth = TargetSubprocess([CPYTHON3])
- if args.pyboard:
- target = TargetPyboard(pyboard.Pyboard(args.device))
- else:
+ target = run_tests_module.get_test_instance(
+ args.test_instance, args.baudrate, args.user, args.password
+ )
+ if target is None:
+ # Use the unix port of MicroPython.
target = TargetSubprocess([MICROPYTHON])
+ else:
+ # Use a remote target.
+ target = TargetPyboard(target)
if hasattr(args, "arch") and args.arch is not None:
target_arch = args.arch