Support wildcard patterns with a positive list of components to run
Wildcard patterns now work with command line COMPONENT arguments without --except as well as with. You can now run e.g. `all.sh "check_*` to run all the sanity checks.
This commit is contained in:
parent
53190e6160
commit
a28db923d9
1 changed files with 20 additions and 21 deletions
|
@ -154,11 +154,9 @@ pre_initialize_variables () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test whether $1 is excluded via the command line.
|
# Test whether the component $1 is included in the command line patterns.
|
||||||
is_component_excluded()
|
is_component_included()
|
||||||
{
|
{
|
||||||
# Is $1 excluded via $COMPONENTS (a space-separated list of wildcard
|
|
||||||
# patterns)?
|
|
||||||
set -f
|
set -f
|
||||||
for pattern in $COMMAND_LINE_COMPONENTS; do
|
for pattern in $COMMAND_LINE_COMPONENTS; do
|
||||||
set +f
|
set +f
|
||||||
|
@ -174,6 +172,13 @@ usage()
|
||||||
Usage: $0 [OPTION]... [COMPONENT]...
|
Usage: $0 [OPTION]... [COMPONENT]...
|
||||||
Run mbedtls release validation tests.
|
Run mbedtls release validation tests.
|
||||||
By default, run all tests. With one or more COMPONENT, run only those.
|
By default, run all tests. With one or more COMPONENT, run only those.
|
||||||
|
COMPONENT can be the name of a component or a shell wildcard pattern.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
$0 "check_*"
|
||||||
|
Run all sanity checks.
|
||||||
|
$0 --no-armcc --except test_memsan
|
||||||
|
Run everything except builds that require armcc and MemSan.
|
||||||
|
|
||||||
Special options:
|
Special options:
|
||||||
-h|--help Print this help and exit.
|
-h|--help Print this help and exit.
|
||||||
|
@ -185,11 +190,8 @@ General options:
|
||||||
-k|--keep-going Run all tests and report errors at the end.
|
-k|--keep-going Run all tests and report errors at the end.
|
||||||
-m|--memory Additional optional memory tests.
|
-m|--memory Additional optional memory tests.
|
||||||
--armcc Run ARM Compiler builds (on by default).
|
--armcc Run ARM Compiler builds (on by default).
|
||||||
--except If some components are passed on the command line,
|
--except Exclude the COMPONENTs listed on the command line,
|
||||||
run all the tests except for these components. In
|
instead of running only those.
|
||||||
this mode, you can pass shell wildcard patterns as
|
|
||||||
component names, e.g. "$0 --except 'test_*'" to
|
|
||||||
exclude all components that run tests.
|
|
||||||
--no-armcc Skip ARM Compiler builds.
|
--no-armcc Skip ARM Compiler builds.
|
||||||
--no-force Refuse to overwrite modified files (default).
|
--no-force Refuse to overwrite modified files (default).
|
||||||
--no-keep-going Stop at the first error (default).
|
--no-keep-going Stop at the first error (default).
|
||||||
|
@ -302,7 +304,7 @@ check_headers_in_cpp () {
|
||||||
|
|
||||||
pre_parse_command_line () {
|
pre_parse_command_line () {
|
||||||
COMMAND_LINE_COMPONENTS=
|
COMMAND_LINE_COMPONENTS=
|
||||||
all_except=
|
all_except=0
|
||||||
no_armcc=
|
no_armcc=
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
|
@ -342,27 +344,24 @@ pre_parse_command_line () {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# With no list of components, run everything.
|
||||||
if [ -z "$COMMAND_LINE_COMPONENTS" ]; then
|
if [ -z "$COMMAND_LINE_COMPONENTS" ]; then
|
||||||
all_except=1
|
all_except=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --no-armcc is a legacy option. The modern way is --except '*_armcc*'.
|
# --no-armcc is a legacy option. The modern way is --except '*_armcc*'.
|
||||||
# Ignore it if components are listed explicitly on the command line.
|
# Ignore it if components are listed explicitly on the command line.
|
||||||
if [ -n "$no_armcc" ] && [ -n "$all_except" ]; then
|
if [ -n "$no_armcc" ] && [ $all_except -eq 1 ]; then
|
||||||
COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS *_armcc*"
|
COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS *_armcc*"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the list of components to run.
|
# Build the list of components to run.
|
||||||
if [ -n "$all_except" ]; then
|
|
||||||
RUN_COMPONENTS=
|
RUN_COMPONENTS=
|
||||||
for component in $SUPPORTED_COMPONENTS; do
|
for component in $SUPPORTED_COMPONENTS; do
|
||||||
if ! is_component_excluded "$component"; then
|
if is_component_included "$component"; [ $? -eq $all_except ]; then
|
||||||
RUN_COMPONENTS="$RUN_COMPONENTS $component"
|
RUN_COMPONENTS="$RUN_COMPONENTS $component"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
RUN_COMPONENTS="$COMMAND_LINE_COMPONENTS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset all_except
|
unset all_except
|
||||||
unset no_armcc
|
unset no_armcc
|
||||||
|
|
Loading…
Reference in a new issue