diff options
| author | Damien George <damien@micropython.org> | 2024-08-17 00:10:40 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-09-04 16:34:01 +1000 |
| commit | 6be1dbc784ba1f845a4f7525bb2ecd6b61a79405 (patch) | |
| tree | ba3b78a935f6e66f89090a7d640b3133a7bb9991 /tests/run-tests.py | |
| parent | 838c490eb4403885e96cbe3ded6f73a082c9399f (diff) | |
tests/run-tests.py: Automatically detect native arch and mpy-cross flag.
Now that some ports support multiple architectures (eg esp32 has both
Xtensa and RISC-V CPUs) it's no longer possible to set mpy-cross flags
based on the target, eg `./run-tests.py --target esp32`. Instead this
commit makes it so the `-march=xxx` argument to mpy-cross is detected
automatically via evaluation of `sys.implementation._mpy`.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/run-tests.py')
| -rwxr-xr-x | tests/run-tests.py | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py index 60bfc2599..999812bd5 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1065,11 +1065,6 @@ the last matching regex is used: pyb = None elif args.target in LOCAL_TARGETS: pyb = None - if not args.mpy_cross_flags: - if args.target == "unix": - args.mpy_cross_flags = "-march=host" - elif args.target == "qemu-arm": - args.mpy_cross_flags = "-march=armv7m" if args.target == "webassembly": pyb = PyboardNodeRunner() elif args.target in EXTERNAL_TARGETS: @@ -1077,24 +1072,19 @@ the last matching regex is used: sys.path.append(base_path("../tools")) import pyboard - if not args.mpy_cross_flags: - if args.target == "esp8266": - args.mpy_cross_flags = "-march=xtensa" - elif args.target == "esp32": - args.mpy_cross_flags = "-march=xtensawin" - elif args.target == "rp2": - args.mpy_cross_flags = "-march=armv6m" - elif args.target == "pyboard": - args.mpy_cross_flags = "-march=armv7emsp" - else: - args.mpy_cross_flags = "-march=armv7m" - pyb = pyboard.Pyboard(args.device, args.baudrate, args.user, args.password) pyboard.Pyboard.run_script_on_remote_target = run_script_on_remote_target pyb.enter_raw_repl() else: raise ValueError("target must be one of %s" % ", ".join(LOCAL_TARGETS + EXTERNAL_TARGETS)) + # Automatically detect the native architecture for mpy-cross if not given. + if not (args.list_tests or args.write_exp) and not args.mpy_cross_flags: + output = run_feature_check(pyb, args, "target_info.py") + arch = str(output, "ascii").strip() + if arch != "None": + args.mpy_cross_flags = "-march=" + arch + if args.run_failures and (any(args.files) or args.test_dirs is not None): raise ValueError( "--run-failures cannot be used together with files or --test-dirs arguments" |
