Merge pull request #3447 from mpg/use-all-sh-checks-for-pre-push-2.7

[backport 2.7] Use all.sh in pre-push hook
This commit is contained in:
Gilles Peskine 2020-06-23 14:37:24 +02:00 committed by GitHub
commit b1d1097316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 17 deletions

View File

@ -72,18 +72,4 @@ echo "URL is $URL"
set -eu set -eu
run_test() tests/scripts/all.sh -q -k 'check_*'
{
TEST=$1
echo "running '$TEST'"
if ! `$TEST > /dev/null 2>&1`; then
echo "test '$TEST' failed"
return 1
fi
}
run_test ./tests/scripts/check-doxy-blocks.pl
run_test ./tests/scripts/check-names.sh
run_test ./tests/scripts/check-generated-files.sh
run_test ./tests/scripts/check-files.py
run_test ./tests/scripts/doxygen.sh

View File

@ -158,6 +158,7 @@ pre_initialize_variables () {
MEMORY=0 MEMORY=0
FORCE=0 FORCE=0
QUIET=0
KEEP_GOING=0 KEEP_GOING=0
YOTTA=1 YOTTA=1
@ -238,6 +239,7 @@ Special options:
--list-components List components supported on this platform and exit. --list-components List components supported on this platform and exit.
General options: General options:
-q|--quiet Only output component names, and errors if any.
-f|--force Force the tests to overwrite any modified files. -f|--force Force the tests to overwrite any modified files.
-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.
@ -252,6 +254,7 @@ General options:
--no-keep-going Stop at the first error (default). --no-keep-going Stop at the first error (default).
--no-memory No additional memory tests (default). --no-memory No additional memory tests (default).
--no-yotta Skip yotta module build. --no-yotta Skip yotta module build.
--no-quiet Print full ouput from components.
--out-of-source-dir=<path> Directory used for CMake out-of-source build tests. --out-of-source-dir=<path> Directory used for CMake out-of-source build tests.
--random-seed Use a random seed value for randomized tests (default). --random-seed Use a random seed value for randomized tests (default).
-r|--release-test Run this script in release mode. This fixes the seed value to ${RELEASE_SEED}. -r|--release-test Run this script in release mode. This fixes the seed value to ${RELEASE_SEED}.
@ -318,6 +321,11 @@ msg()
else else
current_section="$1" current_section="$1"
fi fi
if [ $QUIET -eq 1 ]; then
return
fi
echo "" echo ""
echo "******************************************************************" echo "******************************************************************"
echo "* $current_section " echo "* $current_section "
@ -381,9 +389,11 @@ pre_parse_command_line () {
--no-keep-going) KEEP_GOING=0;; --no-keep-going) KEEP_GOING=0;;
--no-memory) MEMORY=0;; --no-memory) MEMORY=0;;
--no-yotta) YOTTA=0;; --no-yotta) YOTTA=0;;
--no-quiet) QUIET=0;;
--openssl) shift; OPENSSL="$1";; --openssl) shift; OPENSSL="$1";;
--openssl-legacy) shift; OPENSSL_LEGACY="$1";; --openssl-legacy) shift; OPENSSL_LEGACY="$1";;
--out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";; --out-of-source-dir) shift; OUT_OF_SOURCE_DIR="$1";;
--quiet|-q) QUIET=1;;
--random-seed) unset SEED;; --random-seed) unset SEED;;
--release-test|-r) SEED=$RELEASE_SEED;; --release-test|-r) SEED=$RELEASE_SEED;;
--seed|-s) shift; SEED="$1";; --seed|-s) shift; SEED="$1";;
@ -478,7 +488,7 @@ pre_setup_keep_going () {
failure_summary="$failure_summary failure_summary="$failure_summary
$text" $text"
failure_count=$((failure_count + 1)) failure_count=$((failure_count + 1))
echo "${start_red}^^^^$text^^^^${end_color}" echo "${start_red}^^^^$text^^^^${end_color}" >&2
fi fi
} }
make () { make () {
@ -524,8 +534,23 @@ not() {
! "$@" ! "$@"
} }
pre_setup_quiet_redirect () {
if [ $QUIET -ne 1 ]; then
redirect_out () {
"$@"
}
else
redirect_out () {
"$@" >/dev/null
}
fi
}
pre_print_configuration () { pre_print_configuration () {
if [ $QUIET -eq 1 ]; then
return
fi
msg "info: $0 configuration" msg "info: $0 configuration"
echo "MEMORY: $MEMORY" echo "MEMORY: $MEMORY"
echo "FORCE: $FORCE" echo "FORCE: $FORCE"
@ -593,6 +618,11 @@ pre_check_tools () {
"$ARMC6_CC" "$ARMC6_AR" "$ARMC6_FROMELF";; "$ARMC6_CC" "$ARMC6_AR" "$ARMC6_FROMELF";;
esac esac
# past this point, no call to check_tool, only printing output
if [ $QUIET -eq 1 ]; then
return
fi
msg "info: output_env.sh" msg "info: output_env.sh"
case $RUN_COMPONENTS in case $RUN_COMPONENTS in
*_armcc*|*_yotta*) *_armcc*|*_yotta*)
@ -1384,8 +1414,17 @@ run_component () {
# The cleanup function will restore it. # The cleanup function will restore it.
cp -p "$CONFIG_H" "$CONFIG_BAK" cp -p "$CONFIG_H" "$CONFIG_BAK"
current_component="$1" current_component="$1"
"$@"
# Run the component code.
if [ $QUIET -eq 1 ]; then
# msg() is silenced, so just print the component name here
echo "${current_component#component_}"
fi
redirect_out "$@"
# Restore the build tree to a clean state.
cleanup cleanup
unset current_component
} }
# Preliminary setup # Preliminary setup
@ -1402,6 +1441,7 @@ else
"$@" "$@"
} }
fi fi
pre_setup_quiet_redirect
pre_print_configuration pre_print_configuration
pre_check_tools pre_check_tools
cleanup cleanup