Skip to content

Commit f2ac471

Browse files
committed
tests/run-tests.py: Simplify the way target-specific tests are given.
Signed-off-by: Damien George <[email protected]>
1 parent c88a9d6 commit f2ac471

File tree

1 file changed

+84
-74
lines changed

1 file changed

+84
-74
lines changed

tests/run-tests.py

Lines changed: 84 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,88 @@ def open(self, path, mode):
8989
__import__('__injected_test')
9090
"""
9191

92+
# Tests to skip on specific targets.
93+
# These are tests that are difficult to detect that they should not be run on the given target.
94+
target_tests_to_skip = {
95+
"esp8266": (
96+
"micropython/viper_args.py", # too large
97+
"micropython/viper_binop_arith.py", # too large
98+
"misc/rge_sm.py", # too large
99+
),
100+
"minimal": (
101+
"basics/class_inplace_op.py", # all special methods not supported
102+
"basics/subclass_native_init.py", # native subclassing corner cases not support
103+
"misc/rge_sm.py", # too large
104+
"micropython/opt_level.py", # don't assume line numbers are stored
105+
),
106+
"nrf": (
107+
"basics/io_buffered_writer.py",
108+
"basics/io_bytesio_cow.py",
109+
"basics/io_bytesio_ext.py",
110+
"basics/io_bytesio_ext2.py",
111+
"basics/io_iobase.py",
112+
"basics/io_stringio1.py",
113+
"basics/io_stringio_base.py",
114+
"basics/io_stringio_with.py",
115+
"basics/io_write_ext.py",
116+
"basics/memoryview1.py", # no item assignment for memoryview
117+
"extmod/random_basic.py", # unimplemented: random.seed
118+
"micropython/opt_level.py", # no support for line numbers
119+
"misc/non_compliant.py", # no item assignment for bytearray
120+
),
121+
"renesas-ra": (
122+
"extmod/time_time_ns.py", # RA fsp rtc function doesn't support nano sec info
123+
),
124+
"rp2": (
125+
# Skip thread tests that require more that 2 threads.
126+
"thread/stress_heap.py",
127+
"thread/thread_lock2.py",
128+
"thread/thread_lock3.py",
129+
"thread/thread_shared2.py",
130+
),
131+
"qemu": (
132+
# Skip tests that require Cortex-M4.
133+
"inlineasm/asmfpaddsub.py",
134+
"inlineasm/asmfpcmp.py",
135+
"inlineasm/asmfpldrstr.py",
136+
"inlineasm/asmfpmuldiv.py",
137+
"inlineasm/asmfpsqrt.py",
138+
),
139+
"webassembly": (
140+
"basics/string_format_modulo.py", # can't print nulls to stdout
141+
"basics/string_strip.py", # can't print nulls to stdout
142+
"extmod/asyncio_basic2.py",
143+
"extmod/asyncio_cancel_self.py",
144+
"extmod/asyncio_current_task.py",
145+
"extmod/asyncio_exception.py",
146+
"extmod/asyncio_gather_finished_early.py",
147+
"extmod/asyncio_get_event_loop.py",
148+
"extmod/asyncio_heaplock.py",
149+
"extmod/asyncio_loop_stop.py",
150+
"extmod/asyncio_new_event_loop.py",
151+
"extmod/asyncio_threadsafeflag.py",
152+
"extmod/asyncio_wait_for_fwd.py",
153+
"extmod/binascii_a2b_base64.py",
154+
"extmod/re_stack_overflow.py",
155+
"extmod/time_res.py",
156+
"extmod/vfs_posix.py",
157+
"extmod/vfs_posix_enoent.py",
158+
"extmod/vfs_posix_paths.py",
159+
"extmod/vfs_userfs.py",
160+
"micropython/emg_exc.py",
161+
"micropython/extreme_exc.py",
162+
"micropython/heapalloc_exc_compressed_emg_exc.py",
163+
),
164+
"wipy": (
165+
"misc/print_exception.py", # requires error reporting full
166+
),
167+
"zephyr": (
168+
# Skip thread tests that require more than 4 threads.
169+
"thread/stress_heap.py",
170+
"thread/thread_lock3.py",
171+
),
172+
}
173+
92174

93175
def rm_f(fname):
94176
if os.path.exists(fname):
@@ -629,85 +711,13 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
629711
if t.startswith("thread/mutate_"):
630712
skip_tests.add(t)
631713

632-
# Skip thread tests that require many threads on targets that don't support multiple threads.
633-
if args.target == "rp2":
634-
skip_tests.add("thread/stress_heap.py")
635-
skip_tests.add("thread/thread_lock2.py")
636-
skip_tests.add("thread/thread_lock3.py")
637-
skip_tests.add("thread/thread_shared2.py")
638-
elif args.target == "zephyr":
639-
skip_tests.add("thread/stress_heap.py")
640-
skip_tests.add("thread/thread_lock3.py")
641-
642714
# Some tests shouldn't be run on pyboard
643715
if args.target != "unix":
644716
skip_tests.add("basics/exception_chain.py") # warning is not printed
645717
skip_tests.add("micropython/meminfo.py") # output is very different to PC output
646718

647-
if args.target == "wipy":
648-
skip_tests.add("misc/print_exception.py") # requires error reporting full
649-
skip_tests.update(
650-
{
651-
"extmod/uctypes_%s.py" % t
652-
for t in "bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native array_assign_le array_assign_native_le".split()
653-
}
654-
) # requires uctypes
655-
skip_tests.add("extmod/heapq1.py") # heapq not supported by WiPy
656-
skip_tests.add("extmod/random_basic.py") # requires random
657-
skip_tests.add("extmod/random_extra.py") # requires random
658-
elif args.target == "esp8266":
659-
skip_tests.add("micropython/viper_args.py") # too large
660-
skip_tests.add("micropython/viper_binop_arith.py") # too large
661-
skip_tests.add("misc/rge_sm.py") # too large
662-
elif args.target == "minimal":
663-
skip_tests.add("basics/class_inplace_op.py") # all special methods not supported
664-
skip_tests.add(
665-
"basics/subclass_native_init.py"
666-
) # native subclassing corner cases not support
667-
skip_tests.add("misc/rge_sm.py") # too large
668-
skip_tests.add("micropython/opt_level.py") # don't assume line numbers are stored
669-
elif args.target == "nrf":
670-
skip_tests.add("basics/memoryview1.py") # no item assignment for memoryview
671-
skip_tests.add("extmod/random_basic.py") # unimplemented: random.seed
672-
skip_tests.add("micropython/opt_level.py") # no support for line numbers
673-
skip_tests.add("misc/non_compliant.py") # no item assignment for bytearray
674-
for t in tests:
675-
if t.startswith("basics/io_"):
676-
skip_tests.add(t)
677-
elif args.target == "renesas-ra":
678-
skip_tests.add(
679-
"extmod/time_time_ns.py"
680-
) # RA fsp rtc function doesn't support nano sec info
681-
elif args.target == "qemu":
682-
skip_tests.add("inlineasm/asmfpaddsub.py") # requires Cortex-M4
683-
skip_tests.add("inlineasm/asmfpcmp.py")
684-
skip_tests.add("inlineasm/asmfpldrstr.py")
685-
skip_tests.add("inlineasm/asmfpmuldiv.py")
686-
skip_tests.add("inlineasm/asmfpsqrt.py")
687-
elif args.target == "webassembly":
688-
skip_tests.add("basics/string_format_modulo.py") # can't print nulls to stdout
689-
skip_tests.add("basics/string_strip.py") # can't print nulls to stdout
690-
skip_tests.add("extmod/asyncio_basic2.py")
691-
skip_tests.add("extmod/asyncio_cancel_self.py")
692-
skip_tests.add("extmod/asyncio_current_task.py")
693-
skip_tests.add("extmod/asyncio_exception.py")
694-
skip_tests.add("extmod/asyncio_gather_finished_early.py")
695-
skip_tests.add("extmod/asyncio_get_event_loop.py")
696-
skip_tests.add("extmod/asyncio_heaplock.py")
697-
skip_tests.add("extmod/asyncio_loop_stop.py")
698-
skip_tests.add("extmod/asyncio_new_event_loop.py")
699-
skip_tests.add("extmod/asyncio_threadsafeflag.py")
700-
skip_tests.add("extmod/asyncio_wait_for_fwd.py")
701-
skip_tests.add("extmod/binascii_a2b_base64.py")
702-
skip_tests.add("extmod/re_stack_overflow.py")
703-
skip_tests.add("extmod/time_res.py")
704-
skip_tests.add("extmod/vfs_posix.py")
705-
skip_tests.add("extmod/vfs_posix_enoent.py")
706-
skip_tests.add("extmod/vfs_posix_paths.py")
707-
skip_tests.add("extmod/vfs_userfs.py")
708-
skip_tests.add("micropython/emg_exc.py")
709-
skip_tests.add("micropython/extreme_exc.py")
710-
skip_tests.add("micropython/heapalloc_exc_compressed_emg_exc.py")
719+
# Skip target-specific tests.
720+
skip_tests.update(target_tests_to_skip.get(args.target, ()))
711721

712722
# Some tests are known to fail on 64-bit machines
713723
if pyb is None and platform.architecture()[0] == "64bit":

0 commit comments

Comments
 (0)