@@ -154,11 +154,9 @@ pre_initialize_variables () {
154
154
done
155
155
}
156
156
157
- # Test whether $1 is excluded via the command line.
158
- is_component_excluded ()
157
+ # Test whether the component $1 is included in the command line patterns .
158
+ is_component_included ()
159
159
{
160
- # Is $1 excluded via $COMPONENTS (a space-separated list of wildcard
161
- # patterns)?
162
160
set -f
163
161
for pattern in $COMMAND_LINE_COMPONENTS ; do
164
162
set +f
@@ -174,6 +172,13 @@ usage()
174
172
Usage: $0 [OPTION]... [COMPONENT]...
175
173
Run mbedtls release validation tests.
176
174
By default, run all tests. With one or more COMPONENT, run only those.
175
+ COMPONENT can be the name of a component or a shell wildcard pattern.
176
+
177
+ Examples:
178
+ $0 "check_*"
179
+ Run all sanity checks.
180
+ $0 --no-armcc --except test_memsan
181
+ Run everything except builds that require armcc and MemSan.
177
182
178
183
Special options:
179
184
-h|--help Print this help and exit.
@@ -185,11 +190,8 @@ General options:
185
190
-k|--keep-going Run all tests and report errors at the end.
186
191
-m|--memory Additional optional memory tests.
187
192
--armcc Run ARM Compiler builds (on by default).
188
- --except If some components are passed on the command line,
189
- run all the tests except for these components. In
190
- this mode, you can pass shell wildcard patterns as
191
- component names, e.g. "$0 --except 'test_*'" to
192
- exclude all components that run tests.
193
+ --except Exclude the COMPONENTs listed on the command line,
194
+ instead of running only those.
193
195
--no-armcc Skip ARM Compiler builds.
194
196
--no-force Refuse to overwrite modified files (default).
195
197
--no-keep-going Stop at the first error (default).
@@ -302,7 +304,7 @@ check_headers_in_cpp () {
302
304
303
305
pre_parse_command_line () {
304
306
COMMAND_LINE_COMPONENTS=
305
- all_except=
307
+ all_except=0
306
308
no_armcc=
307
309
308
310
while [ $# -gt 0 ]; do
@@ -342,27 +344,24 @@ pre_parse_command_line () {
342
344
shift
343
345
done
344
346
347
+ # With no list of components, run everything.
345
348
if [ -z " $COMMAND_LINE_COMPONENTS " ]; then
346
349
all_except=1
347
350
fi
348
351
349
352
# --no-armcc is a legacy option. The modern way is --except '*_armcc*'.
350
353
# Ignore it if components are listed explicitly on the command line.
351
- if [ -n " $no_armcc " ] && [ -n " $all_except " ]; then
354
+ if [ -n " $no_armcc " ] && [ $all_except -eq 1 ]; then
352
355
COMMAND_LINE_COMPONENTS=" $COMMAND_LINE_COMPONENTS *_armcc*"
353
356
fi
354
357
355
358
# Build the list of components to run.
356
- if [ -n " $all_except " ]; then
357
- RUN_COMPONENTS=
358
- for component in $SUPPORTED_COMPONENTS ; do
359
- if ! is_component_excluded " $component " ; then
360
- RUN_COMPONENTS=" $RUN_COMPONENTS $component "
361
- fi
362
- done
363
- else
364
- RUN_COMPONENTS=" $COMMAND_LINE_COMPONENTS "
365
- fi
359
+ RUN_COMPONENTS=
360
+ for component in $SUPPORTED_COMPONENTS ; do
361
+ if is_component_included " $component " ; [ $? -eq $all_except ]; then
362
+ RUN_COMPONENTS=" $RUN_COMPONENTS $component "
363
+ fi
364
+ done
366
365
367
366
unset all_except
368
367
unset no_armcc
0 commit comments