Tweak tests, consolidate pins target validation (#21254)
This commit is contained in:
@ -21,7 +21,7 @@ Usage: mftest [-t|--env=<env>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
|
||||
|
||||
OPTIONS
|
||||
-t --env The environment of the test to apply / run. (As named in platformio.ini.)
|
||||
-n --num The index of the test to run. (In *-tests file order.)
|
||||
-n --num The index of the test to run. (In file order.)
|
||||
-m --make Use the make / Docker method for the build.
|
||||
-y --build Skip 'Do you want to build this test?' and assume YES.
|
||||
-h --help Print this help.
|
||||
@ -204,11 +204,10 @@ fi
|
||||
if [[ $TESTENV == '-' ]]; then
|
||||
IND=0
|
||||
NAMES=()
|
||||
for FILE in $( ls -1 $TESTPATH/*-tests )
|
||||
for FILE in $( ls -1 $TESTPATH/* )
|
||||
do
|
||||
let IND++
|
||||
TNAME=${FILE/-tests/}
|
||||
TNAME=${TNAME/$TESTPATH\//}
|
||||
TNAME=${FILE/$TESTPATH\//}
|
||||
NAMES+=($TNAME)
|
||||
(( IND < 10 )) && echo -n " "
|
||||
echo " $IND) $TNAME"
|
||||
@ -231,7 +230,7 @@ if [[ $TESTENV == '-' ]]; then
|
||||
fi
|
||||
|
||||
# Get the contents of the test file
|
||||
OUT=$( cat $TESTPATH/$TESTENV-tests 2>/dev/null ) || { errout "Can't find test '$TESTENV'." ; exit 1 ; }
|
||||
OUT=$( cat $TESTPATH/$TESTENV 2>/dev/null ) || { errout "Can't find test '$TESTENV'." ; exit 1 ; }
|
||||
|
||||
# Count up the number of tests
|
||||
TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
|
||||
@ -297,7 +296,7 @@ echo "$OUT" | {
|
||||
echo -ne "\033[0m"
|
||||
|
||||
# Make clear it's a TEST
|
||||
opt_set CUSTOM_MACHINE_NAME "\"$TESTENV-tests ($CHOICE)\""
|
||||
opt_set CUSTOM_MACHINE_NAME "\"Test $TESTENV ($CHOICE)\""
|
||||
|
||||
# Build the test too?
|
||||
if [[ -z "$BUILD_YES" ]]; then
|
||||
|
@ -2,8 +2,9 @@
|
||||
#
|
||||
# run_tests
|
||||
#
|
||||
export PATH="$PATH:$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )"
|
||||
export PATH="$PATH:./buildroot/bin"
|
||||
HERE="$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )"
|
||||
TESTS="$HERE/../tests"
|
||||
export PATH="$HERE:$TESTS:$PATH"
|
||||
|
||||
# exit on first failure
|
||||
set -e
|
||||
@ -40,10 +41,9 @@ export -f exec_test
|
||||
printf "Running \033[0;32m$2\033[0m Tests\n"
|
||||
|
||||
if [[ $2 = "ALL" ]]; then
|
||||
dir_list=("$(dirname "${BASH_SOURCE[0]}")"/*)
|
||||
declare -a tests=(${dir_list[@]/*run_tests/})
|
||||
tests=("$TESTS"/*)
|
||||
for f in "${tests[@]}"; do
|
||||
testenv=$(basename $f | cut -d"-" -f1)
|
||||
testenv=$(basename $f)
|
||||
printf "Running \033[0;32m$f\033[0m Tests\n"
|
||||
exec_test $1 "$testenv --target clean" "Setup Build Environment"
|
||||
if [[ $GIT_RESET_HARD == "true" ]]; then
|
||||
@ -58,16 +58,16 @@ else
|
||||
# If the test name is 1 or 2 digits, treat it as an index
|
||||
if [[ "$test_name" =~ ^[0-9][0-9]?$ ]] ; then
|
||||
# Find the test name that corresponds to that index
|
||||
test_name="$(cat buildroot/tests/$2-tests | grep -e '^exec_test' | sed -n "$3p" | sed "s/.*\$1 \$2 \"\([^\"]*\).*/\1/g")"
|
||||
test_name="$(cat $TESTS/$2 | grep -e '^exec_test' | sed -n "$3p" | sed "s/.*\$1 \$2 \"\([^\"]*\).*/\1/g")"
|
||||
if [[ -z "$test_name" ]] ; then
|
||||
# Fail if none matches
|
||||
printf "\033[0;31mCould not find test \033[0m#$3\033[0;31m in \033[0mbuildroot/tests/$2-tests\n"
|
||||
printf "\033[0;31mCould not find test \033[0m#$3\033[0;31m in \033[0mbuildroot/tests/$2\n"
|
||||
exit 1
|
||||
else
|
||||
printf "\033[0;32mMatching test \033[0m#$3\033[0;32m: '\033[0m$test_name\033[0;32m'\n"
|
||||
fi
|
||||
fi
|
||||
$2-tests $1 $2 "$test_name"
|
||||
$TESTS/$2 $1 $2 "$test_name"
|
||||
if [[ $GIT_RESET_HARD == "true" ]]; then
|
||||
git reset --hard HEAD
|
||||
else
|
@ -1,16 +0,0 @@
|
||||
#
|
||||
# common-dependencies-post.py
|
||||
# Convenience script to add build flags for Marlin Enabled Features
|
||||
#
|
||||
|
||||
Import("env")
|
||||
Import("projenv")
|
||||
|
||||
def apply_board_build_flags():
|
||||
if not 'BOARD_CUSTOM_BUILD_FLAGS' in env['MARLIN_FEATURES']:
|
||||
return
|
||||
projenv.Append(CCFLAGS=env['MARLIN_FEATURES']['BOARD_CUSTOM_BUILD_FLAGS'].split())
|
||||
|
||||
# We need to add the board build flags in a post script
|
||||
# so the platform build script doesn't overwrite the custom CCFLAGS
|
||||
apply_board_build_flags()
|
@ -49,8 +49,7 @@ config = env.GetProjectConfig()
|
||||
result = check_envs("env:"+build_env, base_envs, config)
|
||||
|
||||
if not result:
|
||||
err = "Error: your selected build environment '%s' is not compatible with MOTHERBOARD=%s in Configuration.h. " \
|
||||
"Please use one of compatible build environments for this board: %s" % \
|
||||
err = "Error: Build environment '%s' is incompatible with %s. Use one of these: %s" % \
|
||||
(build_env, motherboard, ",".join([e[4:] for e in base_envs if e.startswith("env:")]))
|
||||
raise SystemExit(err)
|
||||
|
||||
|
Reference in New Issue
Block a user