tests/run-multitests.py: Change -i argument to -t.

Back in commit 8978102f35 (see PR #16111) the
`run-tests.py` script was changed to use an improved way of selecting the
test instance, eg:

    $ ./run-tests.py -t a0

that would run on /dev/ttyACM0.  This has been a very nice improvement,
makes it easier to specify the target.

This commit updates `run-multitests.py` to use the same scheme.  It
previously used `-i` but now that's changed to `-t`.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2025-08-18 11:02:39 +10:00
parent 7a8ae72640
commit f62c614d3e

View File

@@ -238,17 +238,8 @@ class PyInstanceSubProcess(PyInstance):
class PyInstancePyboard(PyInstance):
@staticmethod
def map_device_shortcut(device):
if device[0] == "a" and device[1:].isdigit():
return "/dev/ttyACM" + device[1:]
elif device[0] == "u" and device[1:].isdigit():
return "/dev/ttyUSB" + device[1:]
else:
return device
def __init__(self, device):
device = self.map_device_shortcut(device)
device = device
self.device = device
self.pyb = pyboard.Pyboard(device)
self.pyb.enter_raw_repl()
@@ -562,16 +553,24 @@ def main():
cmd_parser = argparse.ArgumentParser(
description="Run network tests for MicroPython",
epilog=(
run_tests_module.test_instance_epilog
+ "Each instance arg can optionally have custom env provided, eg. <cmd>,ENV=VAR,ENV=VAR...\n"
),
formatter_class=argparse.RawTextHelpFormatter,
)
cmd_parser.add_argument(
"-s", "--show-output", action="store_true", help="show test output after running"
)
cmd_parser.add_argument(
"-t", "--trace-output", action="store_true", help="trace test output while running"
"-c", "--trace-output", action="store_true", help="trace test output while running"
)
cmd_parser.add_argument(
"-i", "--instance", action="append", default=[], help="instance(s) to run the tests on"
"-t",
"--test-instance",
action="append",
default=[],
help="instance(s) to run the tests on",
)
cmd_parser.add_argument(
"-p",
@@ -586,14 +585,6 @@ def main():
default=run_tests_module.base_path("results"),
help="directory for test results",
)
cmd_parser.epilog = (
"Supported instance types:\r\n"
" -i pyb:<port> physical device (eg. pyboard) on provided repl port.\n"
" -i micropython unix micropython instance, path customised with MICROPY_MICROPYTHON env.\n"
" -i cpython desktop python3 instance, path customised with MICROPY_CPYTHON3 env.\n"
" -i exec:<path> custom program run on provided path.\n"
"Each instance arg can optionally have custom env provided, eg. <cmd>,ENV=VAR,ENV=VAR...\n"
)
cmd_parser.add_argument("files", nargs="+", help="input test files")
cmd_args = cmd_parser.parse_args()
@@ -606,22 +597,23 @@ def main():
instances_truth = [PyInstanceSubProcess([PYTHON_TRUTH]) for _ in range(max_instances)]
instances_test = []
for i in cmd_args.instance:
for i in cmd_args.test_instance:
# Each instance arg is <cmd>,ENV=VAR,ENV=VAR...
i = i.split(",")
cmd = i[0]
env = i[1:]
if cmd.startswith("exec:"):
instances_test.append(PyInstanceSubProcess([cmd[len("exec:") :]], env))
elif cmd == "micropython":
elif cmd == "unix":
instances_test.append(PyInstanceSubProcess([MICROPYTHON], env))
elif cmd == "cpython":
instances_test.append(PyInstanceSubProcess([CPYTHON3], env))
elif cmd.startswith("pyb:"):
instances_test.append(PyInstancePyboard(cmd[len("pyb:") :]))
elif cmd == "webassembly" or cmd.startswith("execpty:"):
print("unsupported instance string: {}".format(cmd), file=sys.stderr)
sys.exit(2)
else:
print("unknown instance string: {}".format(cmd), file=sys.stderr)
sys.exit(1)
device = run_tests_module.convert_device_shortcut_to_real_device(cmd)
instances_test.append(PyInstancePyboard(device))
for _ in range(max_instances - len(instances_test)):
instances_test.append(PyInstanceSubProcess([MICROPYTHON]))