Skip to content

Commit 7ec2899

Browse files
committed
tools/tinytest-codegen, qemu-arm: Generate port-specific tests.
Tinytest code generation for bare-metal targets now allows to choose which port to generate tests for. Tinytest generation is not hardcoded to `qemu-arm` anymore, allowing more bare-metal targets to have their own tests. The `qemu-arm` port was modified to work with the generator changes. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent 06a7bf9 commit 7ec2899

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

ports/qemu-arm/Makefile.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ CFLAGS += -DTEST
1616
$(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h
1717
$(BUILD)/genhdr/tests.h:
1818
(cd $(TOP)/tests; ./run-tests.py --target=qemu-arm --write-exp)
19-
$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py $(addprefix --exclude ,$(TESTS_EXCLUDE))) > $@
19+
$(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py --port qemu-arm $(addprefix --exclude ,$(TESTS_EXCLUDE))) > $@
2020

2121
$(BUILD)/lib/tinytest/tinytest.o: CFLAGS += -DNO_FORKING
2222

tools/tinytest-codegen.py

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ def script_to_map(test_file):
5050
testgroup_member = ' {{ "{name}", {name}_tests }},'
5151

5252
## XXX: may be we could have `--without <groups>` argument...
53-
# currently these tests are selected because they pass on qemu-arm
54-
test_dirs = (
53+
54+
# Common test directories and tests exclusion list
55+
56+
common_test_directories = (
5557
"basics",
56-
"micropython",
57-
"misc",
5858
"extmod",
5959
"float",
60-
"inlineasm",
61-
"qemu-arm",
62-
) # 'import', 'io',)
63-
exclude_tests = (
60+
"misc",
61+
)
62+
63+
common_excluded_tests = (
6464
# pattern matching in .exp
6565
"basics/bytes_compare3.py",
6666
"extmod/ticks_diff.py",
@@ -80,19 +80,6 @@ def script_to_map(test_file):
8080
"float/float2int_doubleprec_intbig.py",
8181
"float/float_format_ints_doubleprec.py",
8282
"float/float_parse_doubleprec.py",
83-
# inline asm FP tests (require Cortex-M4)
84-
"inlineasm/asmfpaddsub.py",
85-
"inlineasm/asmfpcmp.py",
86-
"inlineasm/asmfpldrstr.py",
87-
"inlineasm/asmfpmuldiv.py",
88-
"inlineasm/asmfpsqrt.py",
89-
# different filename in output
90-
"micropython/emg_exc.py",
91-
"micropython/heapalloc_traceback.py",
92-
# don't have emergency exception buffer
93-
"micropython/heapalloc_exc_compressed_emg_exc.py",
94-
# pattern matching in .exp
95-
"micropython/meminfo.py",
9683
# needs sys stdfiles
9784
"misc/print_exception.py",
9885
# settrace .exp files are too large
@@ -104,6 +91,30 @@ def script_to_map(test_file):
10491
"basics/string_fstring_debug.py",
10592
)
10693

94+
# Port-specific test directories and tests exclusion list
95+
96+
port_test_directories = {
97+
"qemu-arm": ("inlineasm", "micropython", "qemu-arm"),
98+
}
99+
100+
port_tests_exclusion_lists = {
101+
"qemu-arm": (
102+
# inline asm FP tests (require Cortex-M4)
103+
"inlineasm/asmfpaddsub.py",
104+
"inlineasm/asmfpcmp.py",
105+
"inlineasm/asmfpldrstr.py",
106+
"inlineasm/asmfpmuldiv.py",
107+
"inlineasm/asmfpsqrt.py",
108+
# different filename in output
109+
"micropython/emg_exc.py",
110+
"micropython/heapalloc_traceback.py",
111+
# don't have emergency exception buffer
112+
"micropython/heapalloc_exc_compressed_emg_exc.py",
113+
# pattern matching in .exp
114+
"micropython/meminfo.py",
115+
)
116+
}
117+
107118
output = []
108119
tests = []
109120

@@ -112,8 +123,13 @@ def script_to_map(test_file):
112123
)
113124
argparser.add_argument("--stdin", action="store_true", help="read list of tests from stdin")
114125
argparser.add_argument("--exclude", action="append", help="exclude test by name")
126+
argparser.add_argument("--port", help="optional MicroPython port name to generate tests for")
115127
args = argparser.parse_args()
116128

129+
port_name = args.port.lower() if args.port else None
130+
test_dirs = common_test_directories + port_test_directories.get(port_name, ())
131+
exclude_tests = common_excluded_tests + port_tests_exclusion_lists.get(port_name, ())
132+
117133
if not args.stdin:
118134
if args.exclude:
119135
exclude_tests += tuple(args.exclude)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy