all.sh: with non-option arguments, run only these components
@@ -104,6 +104,7 @@ pre_initialize_variables () {
CONFIG_H='include/mbedtls/config.h'
CONFIG_BAK="$CONFIG_H.bak"
+ COMPONENTS=
MEMORY=0
FORCE=0
INTROSPECTION_MODE=
@@ -131,8 +132,9 @@ pre_initialize_variables () {
usage()
{
cat <<EOF
-Usage: $0 [OPTION]...
+Usage: $0 [OPTION]... [COMPONENT]...
Run mbedtls release validation tests.
+By default, run all tests. With one or more COMPONENT, run only those.
Special options:
-h|--help Print this help and exit.
@@ -275,11 +277,13 @@ pre_parse_command_line () {
--random-seed) unset SEED;;
--release-test|-r) SEED=1;;
--seed|-s) shift; SEED="$1";;
- *)
+ -*)
echo >&2 "Unknown option: $1"
echo >&2 "Run $0 --help for usage."
exit 120
;;
+ *)
+ COMPONENTS="$COMPONENTS $1";;
esac
shift
done
@@ -1139,44 +1143,7 @@ post_report () {
#### Run all the things
################################################################
-# Run one component and clean up afterwards.
-run_component () {
- "$@"
- cleanup
-}
-
-# Preliminary setup
-pre_check_environment
-pre_initialize_variables
-pre_parse_command_line "$@"
-
-case "$INTROSPECTION_MODE" in
- list_components)
- components=
- newline='
-'
- run_component () {
- components="${components}${newline}${1}"
- }
- ;;
-
- *)
- pre_check_git
- build_status=0
- if [ $KEEP_GOING -eq 1 ]; then
- pre_setup_keep_going
- else
- record_status () {
- "$@"
- }
- fi
- pre_print_configuration
- pre_check_tools
- pre_print_tools
- cleanup
- ;;
-esac
-
+run_all_components () {
# Small things
run_component component_check_recursion
run_component component_check_generated_files
@@ -1244,6 +1211,53 @@ run_component component_test_cmake_out_of_source
run_component component_test_zeroize
run_component component_check_python_files
run_component component_check_generate_test_code
+}
+
+# Run one component and clean up afterwards.
+run_component () {
+ "$@"
+ cleanup
+}
+
+# Preliminary setup
+pre_check_environment
+pre_initialize_variables
+pre_parse_command_line "$@"
+
+case "$INTROSPECTION_MODE" in
+ list_components)
+ components=
+ newline='
+'
+ run_component () {
+ components="${components}${newline}${1#component_}"
+ }
+ ;;
+
+ *)
+ pre_check_git
+ build_status=0
+ if [ $KEEP_GOING -eq 1 ]; then
+ pre_setup_keep_going
+ else
+ record_status () {
+ "$@"
+ }
+ fi
+ pre_print_configuration
+ pre_check_tools
+ pre_print_tools
+ cleanup
+ ;;
+esac
+
+if [ -n "$COMPONENTS" ]; then
+ for component in $COMPONENTS; do
+ run_component "component_$component"
+ done
+else
+ run_all_components
+fi
# We're done.
case "$INTROSPECTION_MODE" in
