@@ -32,6 +32,35 @@ def script_to_map(test_file):
32
32
return r
33
33
34
34
35
+ def load_profile (profile_file ):
36
+ in_test_dirs = False
37
+ in_exclusion_list = False
38
+
39
+ test_dirs = set ()
40
+ exclusion_list = set ()
41
+
42
+ for line in profile_file :
43
+ # Allow quoted comment markers if that's absolutely needed.
44
+ if line := sub (r"\s*(?<!\\)#.*$" , "" , line .strip ()):
45
+ if line == "[test_directories]" :
46
+ in_test_dirs = True
47
+ in_exclusion_list = False
48
+ continue
49
+ if line == "[excluded_tests]" :
50
+ in_test_dirs = False
51
+ in_exclusion_list = True
52
+ continue
53
+
54
+ if in_test_dirs :
55
+ test_dirs .add (line )
56
+ elif in_exclusion_list :
57
+ exclusion_list .add (line )
58
+ else :
59
+ pass
60
+
61
+ return test_dirs , exclusion_list
62
+
63
+
35
64
test_function = (
36
65
"void {name}(void* data) {{\n "
37
66
" static const char pystr[] = {script};\n "
@@ -50,17 +79,15 @@ def script_to_map(test_file):
50
79
testgroup_member = ' {{ "{name}", {name}_tests }},'
51
80
52
81
## XXX: may be we could have `--without <groups>` argument...
53
- # currently these tests are selected because they pass on qemu-arm
54
- test_dirs = (
82
+
83
+ test_dirs = set ( (
55
84
"basics" ,
56
- "micropython" ,
57
- "misc" ,
58
85
"extmod" ,
59
86
"float" ,
60
- "inlineasm " ,
61
- "qemu-arm" ,
62
- ) # 'import', 'io',)
63
- exclude_tests = (
87
+ "misc " ,
88
+ ))
89
+
90
+ exclude_tests = set ( (
64
91
# pattern matching in .exp
65
92
"basics/bytes_compare3.py" ,
66
93
"extmod/ticks_diff.py" ,
@@ -80,19 +107,6 @@ def script_to_map(test_file):
80
107
"float/float2int_doubleprec_intbig.py" ,
81
108
"float/float_format_ints_doubleprec.py" ,
82
109
"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" ,
96
110
# needs sys stdfiles
97
111
"misc/print_exception.py" ,
98
112
# settrace .exp files are too large
@@ -102,7 +116,7 @@ def script_to_map(test_file):
102
116
# don't have f-string
103
117
"basics/string_fstring.py" ,
104
118
"basics/string_fstring_debug.py" ,
105
- )
119
+ ))
106
120
107
121
output = []
108
122
tests = []
@@ -112,11 +126,20 @@ def script_to_map(test_file):
112
126
)
113
127
argparser .add_argument ("--stdin" , action = "store_true" , help = "read list of tests from stdin" )
114
128
argparser .add_argument ("--exclude" , action = "append" , help = "exclude test by name" )
129
+ argparser .add_argument (
130
+ "--profile" ,
131
+ type = argparse .FileType ('rt' , encoding = 'utf-8' ),
132
+ help = "optional profile file providing test directories and exclusion list"
133
+ )
115
134
args = argparser .parse_args ()
116
135
117
136
if not args .stdin :
137
+ if args .profile :
138
+ directories , excluded = load_profile (args .profile )
139
+ test_dirs = test_dirs .union (directories )
140
+ exclude_tests = exclude_tests .union (excluded )
118
141
if args .exclude :
119
- exclude_tests += tuple (args .exclude )
142
+ exclude_tests = exclude_tests . union (args .exclude )
120
143
for group in test_dirs :
121
144
tests += [test for test in glob ("{}/*.py" .format (group )) if test not in exclude_tests ]
122
145
else :
0 commit comments