mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-25 02:55:35 +00:00
Add --error-test option to test error detection and reporting
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
3de7be8b88
commit
a5eb22d434
|
@ -235,6 +235,8 @@ General options:
|
||||||
Prefix for a cross-compiler for arm-linux-gnueabi
|
Prefix for a cross-compiler for arm-linux-gnueabi
|
||||||
(default: "${ARM_LINUX_GNUEABI_GCC_PREFIX}")
|
(default: "${ARM_LINUX_GNUEABI_GCC_PREFIX}")
|
||||||
--armcc Run ARM Compiler builds (on by default).
|
--armcc Run ARM Compiler builds (on by default).
|
||||||
|
--error-test Error test mode: run a failing function in addition
|
||||||
|
to any specified component.
|
||||||
--except Exclude the COMPONENTs listed on the command line,
|
--except Exclude the COMPONENTs listed on the command line,
|
||||||
instead of running only those.
|
instead of running only those.
|
||||||
--no-append-outcome Write a new outcome file and analyze it (default).
|
--no-append-outcome Write a new outcome file and analyze it (default).
|
||||||
|
@ -372,6 +374,7 @@ check_headers_in_cpp () {
|
||||||
pre_parse_command_line () {
|
pre_parse_command_line () {
|
||||||
COMMAND_LINE_COMPONENTS=
|
COMMAND_LINE_COMPONENTS=
|
||||||
all_except=0
|
all_except=0
|
||||||
|
error_test=0
|
||||||
no_armcc=
|
no_armcc=
|
||||||
|
|
||||||
# Note that legacy options are ignored instead of being omitted from this
|
# Note that legacy options are ignored instead of being omitted from this
|
||||||
|
@ -385,6 +388,7 @@ pre_parse_command_line () {
|
||||||
--armcc) no_armcc=;;
|
--armcc) no_armcc=;;
|
||||||
--armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
|
--armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";;
|
||||||
--armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
|
--armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";;
|
||||||
|
--error-test) error_test=$((error_test + 1));;
|
||||||
--except) all_except=1;;
|
--except) all_except=1;;
|
||||||
--force|-f) FORCE=1;;
|
--force|-f) FORCE=1;;
|
||||||
--gnutls-cli) shift; GNUTLS_CLI="$1";;
|
--gnutls-cli) shift; GNUTLS_CLI="$1";;
|
||||||
|
@ -2799,6 +2803,19 @@ post_report () {
|
||||||
#### Run all the things
|
#### Run all the things
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
|
# Function invoked by --error-test to test error reporting.
|
||||||
|
pseudo_component_error_test () {
|
||||||
|
msg "Testing error reporting $error_test"
|
||||||
|
if [ $KEEP_GOING -ne 0 ]; then
|
||||||
|
echo "Expect three failing commands."
|
||||||
|
fi
|
||||||
|
error_test='this should not be used since the component runs in a subshell'
|
||||||
|
grep non_existent /dev/null
|
||||||
|
not grep -q . "$0"
|
||||||
|
make unknown_target
|
||||||
|
false "this should not be executed"
|
||||||
|
}
|
||||||
|
|
||||||
# Run one component and clean up afterwards.
|
# Run one component and clean up afterwards.
|
||||||
run_component () {
|
run_component () {
|
||||||
# Back up the configuration in case the component modifies it.
|
# Back up the configuration in case the component modifies it.
|
||||||
|
@ -2847,6 +2864,10 @@ pre_check_tools
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
# Run the requested tests.
|
# Run the requested tests.
|
||||||
|
while [ $error_test -gt 0 ]; do
|
||||||
|
run_component pseudo_component_error_test
|
||||||
|
error_test=$((error_test - 1))
|
||||||
|
done
|
||||||
for component in $RUN_COMPONENTS; do
|
for component in $RUN_COMPONENTS; do
|
||||||
run_component "component_$component"
|
run_component "component_$component"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue