tests/run-tests.py: Remove --write-exp and --list-tests options.

Removing the now-unused (see previous commit for details) `--write-exp` and
`--list-tests` options helps to simplify the rather complex logic in
`run-tests.py`.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-09-04 17:13:55 +10:00
parent 067ef81cd0
commit 1be38e8077
3 changed files with 4 additions and 198 deletions

View File

@@ -465,9 +465,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
upy_float_precision = 32
# If we're asked to --list-tests, we can't assume that there's a
# connection to target, so we can't run feature checks usefully.
if not (args.list_tests or args.write_exp):
if True:
# Even if we run completely different tests in a different directory,
# we need to access feature_checks from the same directory as the
# run-tests.py script itself so use base_path.
@@ -797,11 +795,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
skip_it |= skip_io_module and is_io_module
skip_it |= skip_fstring and is_fstring
if args.list_tests:
if not skip_it:
print(test_file)
return
if skip_it:
print("skip ", test_file)
skipped_tests.append(test_name)
@@ -821,18 +814,12 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
cwd=os.path.dirname(test_file),
stderr=subprocess.STDOUT,
)
if args.write_exp:
with open(test_file_expected, "wb") as f:
f.write(output_expected)
except subprocess.CalledProcessError:
output_expected = b"CPYTHON3 CRASH"
# canonical form for all host platforms is to use \n for end-of-line
output_expected = output_expected.replace(b"\r\n", b"\n")
if args.write_exp:
return
# run MicroPython
output_mupy = run_micropython(pyb, args, test_file, test_file_abspath)
@@ -861,7 +848,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
test_count.increment()
if pyb or args.list_tests:
if pyb:
num_threads = 1
if num_threads > 1:
@@ -871,10 +858,6 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
for test in tests:
run_one_test(test)
# Leave RESULTS_FILE untouched here for future runs.
if args.list_tests:
return True
print(
"{} tests performed ({} individual testcases)".format(
test_count.value, testcase_count.value
@@ -983,14 +966,6 @@ the last matching regex is used:
dest="filters",
help="include test by regex on path/name.py",
)
cmd_parser.add_argument(
"--write-exp",
action="store_true",
help="use CPython to generate .exp files to run tests w/o CPython",
)
cmd_parser.add_argument(
"--list-tests", action="store_true", help="list tests instead of running them"
)
cmd_parser.add_argument(
"--emit", default="bytecode", help="MicroPython emitter to use (bytecode or native)"
)
@@ -1062,9 +1037,7 @@ the last matching regex is used:
"rp2",
"zephyr",
)
if args.list_tests:
pyb = None
elif args.target in LOCAL_TARGETS:
if args.target in LOCAL_TARGETS:
pyb = None
if args.target == "webassembly":
pyb = PyboardNodeRunner()
@@ -1080,7 +1053,7 @@ the last matching regex is used:
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:
if not args.mpy_cross_flags:
output = run_feature_check(pyb, args, "target_info.py")
arch = str(output, "ascii").strip()
if arch != "None":