2019-07-07 06:04:49 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2020-02-09 20:48:03 -06:00
|
|
|
# mftest Select a test to apply and build
|
2020-02-15 01:23:36 -06:00
|
|
|
# mftest -b [#] Build the auto-detected environment
|
|
|
|
# mftest -u [#] Upload the auto-detected environment
|
2020-02-09 20:48:03 -06:00
|
|
|
# mftest [name] [index] [-y] Set config options and optionally build a test
|
2019-07-07 06:04:49 -05:00
|
|
|
#
|
|
|
|
|
2020-11-17 20:04:28 -06:00
|
|
|
[[ -d Marlin/src ]] || { echo "Please 'cd' to the Marlin repo root." ; exit 1 ; }
|
|
|
|
|
|
|
|
perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; }
|
|
|
|
errout() { echo -e "\033[0;31m$1\033[0m" ; }
|
|
|
|
bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "
|
2021-04-18 19:01:51 -05:00
|
|
|
Usage: mftest [-t|--env=<env|index>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
|
2020-11-17 20:04:28 -06:00
|
|
|
mftest [-a|--autobuild]
|
|
|
|
mftest [-r|--rebuild]
|
2022-03-22 20:11:58 -05:00
|
|
|
mftest [-s|--silent]
|
2020-11-17 20:04:28 -06:00
|
|
|
mftest [-u|--autoupload] [-n|--num=<num>]
|
|
|
|
|
|
|
|
OPTIONS
|
2021-04-18 19:01:51 -05:00
|
|
|
-t --env The environment to apply / run, or the menu index number.
|
2021-03-05 04:30:52 -06:00
|
|
|
-n --num The index of the test to run. (In file order.)
|
2020-11-17 20:04:28 -06:00
|
|
|
-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.
|
|
|
|
-a --autobuild PIO Build using the MOTHERBOARD environment.
|
|
|
|
-u --autoupload PIO Upload using the MOTHERBOARD environment.
|
|
|
|
-v --verbose Extra output for debugging.
|
2021-03-23 23:58:53 -05:00
|
|
|
-s --silent Silence build output from PlatformIO.
|
2022-07-16 16:11:33 -05:00
|
|
|
-d --default Restore to defaults before applying configs.
|
2020-11-17 20:04:28 -06:00
|
|
|
|
2022-03-22 20:11:58 -05:00
|
|
|
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
2020-11-17 20:04:28 -06:00
|
|
|
"
|
|
|
|
}
|
2019-07-07 06:04:49 -05:00
|
|
|
|
2020-06-22 21:28:04 -05:00
|
|
|
TESTPATH=buildroot/tests
|
|
|
|
|
2021-02-16 18:41:00 -06:00
|
|
|
STATE_FILE="./.pio/.mftestrc"
|
2021-06-11 15:51:29 -05:00
|
|
|
SED=$(which gsed sed | head -n1)
|
2019-07-07 06:04:49 -05:00
|
|
|
|
|
|
|
shopt -s extglob nocasematch
|
|
|
|
|
2020-02-09 20:48:03 -06:00
|
|
|
# Matching patterns
|
|
|
|
ISNUM='^[0-9]+$'
|
2022-07-16 16:11:33 -05:00
|
|
|
ISRST='^(restore)_'
|
2020-02-09 20:48:03 -06:00
|
|
|
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
|
|
|
ISEXEC='^exec_'
|
|
|
|
ISCONT='\\ *$'
|
|
|
|
|
2020-11-17 20:04:28 -06:00
|
|
|
# Get environment, test number, etc. from the command
|
|
|
|
TESTENV='-'
|
|
|
|
CHOICE=0
|
|
|
|
DEBUG=0
|
|
|
|
|
2022-07-16 16:11:33 -05:00
|
|
|
while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
|
2020-11-17 20:04:28 -06:00
|
|
|
case "${OFLAG}" in
|
|
|
|
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
2022-07-16 16:11:33 -05:00
|
|
|
d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
h) EXIT_USAGE=1 ;;
|
|
|
|
m) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
|
|
|
n) case "$OPTARG" in
|
2021-03-17 02:39:26 -05:00
|
|
|
*[!0-9]*) perror "option requires a number" $OFLAG ; EXIT_USAGE=2 ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
*) CHOICE="$OPTARG" ; bugout "Got a number: $CHOICE" ;;
|
|
|
|
esac
|
|
|
|
;;
|
2021-03-17 02:39:26 -05:00
|
|
|
r) REBUILD=1 ; bugout "Rebuilding previous..." ;;
|
2021-03-23 23:58:53 -05:00
|
|
|
s) SILENT_FLAG="-s" ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
t) TESTENV="$OPTARG" ; bugout "Got a target: $TESTENV" ;;
|
2021-03-17 02:39:26 -05:00
|
|
|
u) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
v) DEBUG=1 ; bugout "Debug ON" ;;
|
2021-03-17 02:39:26 -05:00
|
|
|
y) BUILD_YES='Y' ; bugout "Build will initiate..." ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
-) IFS="=" read -r ONAM OVAL <<< "$OPTARG"
|
|
|
|
case "$ONAM" in
|
|
|
|
help) [[ -z "$OVAL" ]] || perror "option can't take value $OVAL" $ONAM ; EXIT_USAGE=1 ;;
|
|
|
|
autobuild) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
|
|
|
autoupload) AUTO_BUILD=2 ; bugout "Auto-Upload target..." ;;
|
|
|
|
env) case "$OVAL" in
|
2021-03-17 02:39:26 -05:00
|
|
|
'') perror "option requires a value" $ONAM ; EXIT_USAGE=2 ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
*) TESTENV="$OVAL" ; bugout "Got a target: $TESTENV" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
num) case "$OVAL" in
|
|
|
|
[0-9]+) CHOICE="$OVAL" ; bugout "Got a number: $CHOICE" ;;
|
2021-03-17 02:39:26 -05:00
|
|
|
*) perror "option requires a value" $ONAM ; EXIT_USAGE=2 ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
esac
|
|
|
|
;;
|
2021-03-17 02:39:26 -05:00
|
|
|
rebuild) REBUILD=1 ; bugout "Rebuilding previous..." ;;
|
2022-03-22 20:11:58 -05:00
|
|
|
silent) SILENT_FLAG="-s" ;;
|
2021-03-17 02:39:26 -05:00
|
|
|
make) USE_MAKE=1 ; bugout "Using make with Docker..." ;;
|
|
|
|
debug|verbose) DEBUG=1 ; bugout "Debug ON" ;;
|
2022-07-16 16:11:33 -05:00
|
|
|
default) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
build) case "$OVAL" in
|
|
|
|
''|y|yes) BUILD_YES='Y' ;;
|
|
|
|
n|no) BUILD_YES='N' ;;
|
2021-03-17 02:39:26 -05:00
|
|
|
*) perror "option value must be y, n, yes, or no" $ONAM ; EXIT_USAGE=2 ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
esac
|
|
|
|
bugout "Build will initiate? ($BUILD_YES)"
|
|
|
|
;;
|
2021-03-17 02:39:26 -05:00
|
|
|
*) perror "Unknown flag" "$OPTARG" ; EXIT_USAGE=2 ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
esac
|
|
|
|
;;
|
2021-03-17 02:39:26 -05:00
|
|
|
*) EXIT_USAGE=2 ;;
|
2020-11-17 20:04:28 -06:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-03-17 02:39:26 -05:00
|
|
|
((EXIT_USAGE)) && { usage ; let EXIT_USAGE-- ; exit $EXIT_USAGE ; }
|
2020-11-17 20:04:28 -06:00
|
|
|
|
|
|
|
if ((REBUILD)); then
|
|
|
|
bugout "Rebuilding previous..."
|
|
|
|
# Build with the last-built env
|
|
|
|
[[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; }
|
|
|
|
read TESTENV <"$STATE_FILE"
|
2021-03-23 23:58:53 -05:00
|
|
|
pio run $SILENT_FLAG -d . -e $TESTENV
|
|
|
|
exit 0
|
2020-11-17 20:04:28 -06:00
|
|
|
fi
|
2019-07-10 05:55:51 -05:00
|
|
|
|
2019-07-07 06:04:49 -05:00
|
|
|
case $TESTENV in
|
2021-02-13 19:06:55 -06:00
|
|
|
tree) pio run -d . -e include_tree ; exit 1 ;;
|
|
|
|
due) TESTENV='DUE' ;;
|
|
|
|
esp) TESTENV='esp32' ;;
|
|
|
|
lin*) TESTENV='linux_native' ;;
|
|
|
|
lp8|lpc8) TESTENV='LPC1768' ;;
|
|
|
|
lp9|lpc9) TESTENV='LPC1769' ;;
|
|
|
|
m128) TESTENV='mega1280' ;;
|
|
|
|
m256) TESTENV='mega2560' ;;
|
|
|
|
mega) TESTENV='mega2560' ;;
|
|
|
|
stm) TESTENV='STM32F103RE' ;;
|
|
|
|
f1) TESTENV='STM32F103RE' ;;
|
|
|
|
f4) TESTENV='STM32F4' ;;
|
|
|
|
f7) TESTENV='STM32F7' ;;
|
|
|
|
s6) TESTENV='FYSETC_S6' ;;
|
|
|
|
teensy) TESTENV='teensy31' ;;
|
|
|
|
t31) TESTENV='teensy31' ;;
|
|
|
|
t32) TESTENV='teensy31' ;;
|
|
|
|
t35) TESTENV='teensy35' ;;
|
|
|
|
t36) TESTENV='teensy35' ;;
|
|
|
|
t40) TESTENV='teensy41' ;;
|
|
|
|
t41) TESTENV='teensy41' ;;
|
2021-09-01 19:29:20 -05:00
|
|
|
[1-9]|[1-9][0-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
|
2019-07-07 06:04:49 -05:00
|
|
|
esac
|
|
|
|
|
2020-11-17 20:04:28 -06:00
|
|
|
if ((AUTO_BUILD)); then
|
|
|
|
#
|
|
|
|
# List environments that apply to the current MOTHERBOARD.
|
|
|
|
#
|
2021-01-17 15:44:45 -06:00
|
|
|
case $(uname | tr '[:upper:]' '[:lower:]') in
|
|
|
|
darwin) SYS='mac' ;;
|
|
|
|
*linux) SYS='lin' ;;
|
|
|
|
win*) SYS='win' ;;
|
|
|
|
msys*) SYS='win' ;;
|
|
|
|
cygwin*) SYS='win' ;;
|
|
|
|
mingw*) SYS='win' ;;
|
|
|
|
*) SYS='uni' ;;
|
|
|
|
esac
|
2020-11-17 20:04:28 -06:00
|
|
|
echo ; echo -n "Auto " ; ((AUTO_BUILD == 2)) && echo "Upload..." || echo "Build..."
|
2022-01-05 01:48:18 -06:00
|
|
|
MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//;s/\r//' )
|
2020-11-17 20:04:28 -06:00
|
|
|
[[ -z $MB ]] && { echo "Error - Can't read MOTHERBOARD setting." ; exit 1 ; }
|
|
|
|
BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h )
|
|
|
|
BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" )
|
|
|
|
BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" )
|
2021-10-17 19:26:31 -05:00
|
|
|
[[ -z $BNUM ]] && { echo "Error - Can't find BOARD_$MB in core/boards.h." ; exit 1 ; }
|
2021-01-17 15:44:45 -06:00
|
|
|
ENVS=( $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E "#include.+//.+(env|$SYS):[^ ]+" | grep -oE "(env|$SYS):[^ ]+" | $SED -E "s/(env|$SYS)://" ) )
|
2020-11-17 20:04:28 -06:00
|
|
|
[[ -z $ENVS ]] && { errout "Error - Can't find target(s) for $MB ($BNUM)." ; exit 1 ; }
|
|
|
|
ECOUNT=${#ENVS[*]}
|
|
|
|
|
|
|
|
if [[ $ECOUNT == 1 ]]; then
|
|
|
|
TARGET=$ENVS
|
|
|
|
else
|
|
|
|
if [[ $CHOICE == 0 ]]; then
|
|
|
|
# List env names and numbers. Get selection.
|
|
|
|
echo "Available targets for \"$BDESC\" | $MB ($BNUM):"
|
|
|
|
|
|
|
|
IND=0 ; for ENV in "${ENVS[@]}"; do let IND++ ; echo " $IND) $ENV" ; done
|
|
|
|
|
|
|
|
if [[ $ECOUNT > 1 ]]; then
|
|
|
|
for (( ; ; ))
|
|
|
|
do
|
|
|
|
read -p "Select a target for '$MB' (1-$ECOUNT) : " CHOICE
|
|
|
|
[[ -z "$CHOICE" ]] && { echo '(canceled)' ; exit 1 ; }
|
|
|
|
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= ECOUNT)) && break
|
|
|
|
errout ">>> Invalid environment choice '$CHOICE'."
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Detected \"$BDESC\" | $MB ($BNUM)."
|
|
|
|
[[ $CHOICE > $ECOUNT ]] && { echo "Environment selection out of range." ; exit 1 ; }
|
|
|
|
fi
|
|
|
|
TARGET="${ENVS[$CHOICE-1]}"
|
|
|
|
echo "Selected $TARGET"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$TARGET" >"$STATE_FILE"
|
|
|
|
|
|
|
|
if ((AUTO_BUILD == 2)); then
|
|
|
|
echo "Uploading environment $TARGET for board $MB ($BNUM)..." ; echo
|
2021-03-23 23:58:53 -05:00
|
|
|
pio run $SILENT_FLAG -t upload -e $TARGET
|
2020-11-17 20:04:28 -06:00
|
|
|
else
|
|
|
|
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo
|
2021-03-23 23:58:53 -05:00
|
|
|
pio run $SILENT_FLAG -e $TARGET
|
2020-11-17 20:04:28 -06:00
|
|
|
fi
|
2021-03-23 23:58:53 -05:00
|
|
|
exit 0
|
2020-11-17 20:04:28 -06:00
|
|
|
fi
|
|
|
|
|
2020-02-09 20:48:03 -06:00
|
|
|
#
|
2019-07-07 06:04:49 -05:00
|
|
|
# List available tests and ask for selection
|
2020-02-09 20:48:03 -06:00
|
|
|
#
|
|
|
|
|
2019-07-10 05:55:51 -05:00
|
|
|
if [[ $TESTENV == '-' ]]; then
|
2019-07-07 06:04:49 -05:00
|
|
|
IND=0
|
|
|
|
NAMES=()
|
2021-08-29 20:04:14 -05:00
|
|
|
MENU=()
|
|
|
|
BIGLEN=0
|
2021-09-19 18:58:12 -05:00
|
|
|
for FILE in $( ls -1 $TESTPATH/* | sort -f )
|
2019-07-07 06:04:49 -05:00
|
|
|
do
|
|
|
|
let IND++
|
2021-03-05 04:30:52 -06:00
|
|
|
TNAME=${FILE/$TESTPATH\//}
|
2019-07-07 06:04:49 -05:00
|
|
|
NAMES+=($TNAME)
|
2021-08-29 20:04:14 -05:00
|
|
|
IFS=""
|
|
|
|
ITEM=$( printf "%2i) %s" $IND $TNAME )
|
|
|
|
MENU+=($ITEM)
|
|
|
|
[[ ${#ITEM} -gt $BIGLEN ]] && BIGLEN=${#ITEM}
|
|
|
|
done
|
|
|
|
|
|
|
|
(( BIGLEN += 2 ))
|
|
|
|
THIRD=$(( (${#MENU[@]} + 2) / 3 ))
|
|
|
|
for ((i = 0; i < $THIRD; i++))
|
|
|
|
do
|
|
|
|
COL1=$i ; COL2=$(( $i + $THIRD )) ; COL3=$(( $i + 2 * $THIRD ))
|
|
|
|
FMT="%-${BIGLEN}s"
|
|
|
|
printf "${FMT}${FMT}${FMT}\n" ${MENU[$COL1]} ${MENU[$COL2]} ${MENU[$COL3]}
|
2019-07-07 06:04:49 -05:00
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
for (( ; ; ))
|
|
|
|
do
|
2021-02-13 19:06:55 -06:00
|
|
|
if [[ $TESTNUM -gt 0 ]]; then
|
|
|
|
NAMEIND=$TESTNUM
|
|
|
|
else
|
|
|
|
read -p "Select a test to apply (1-$IND) : " NAMEIND
|
|
|
|
fi
|
|
|
|
[[ -z $NAMEIND ]] && { errout "(canceled)" ; exit 1 ; }
|
|
|
|
TESTENV=${NAMES[$NAMEIND-1]}
|
|
|
|
[[ $TESTNUM -gt 0 ]] && { echo "Preselected test $TESTNUM ... ($TESTENV)" ; TESTNUM='' ; }
|
2019-07-10 05:55:51 -05:00
|
|
|
[[ $NAMEIND =~ $ISNUM ]] && ((NAMEIND >= 1 && NAMEIND <= IND)) && { TESTENV=${NAMES[$NAMEIND-1]} ; echo ; break ; }
|
2020-11-17 20:04:28 -06:00
|
|
|
errout "Invalid selection."
|
2019-07-07 06:04:49 -05:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get the contents of the test file
|
2021-03-05 04:30:52 -06:00
|
|
|
OUT=$( cat $TESTPATH/$TESTENV 2>/dev/null ) || { errout "Can't find test '$TESTENV'." ; exit 1 ; }
|
2019-07-07 06:04:49 -05:00
|
|
|
|
|
|
|
# Count up the number of tests
|
|
|
|
TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
|
|
|
|
|
2019-07-10 05:55:51 -05:00
|
|
|
# User entered a number?
|
2020-11-17 20:04:28 -06:00
|
|
|
(( CHOICE && CHOICE > TESTCOUNT )) && { errout "Invalid test selection '$CHOICE' (1-$TESTCOUNT)." ; exit 1 ; }
|
2019-07-10 05:55:51 -05:00
|
|
|
|
|
|
|
if [[ $CHOICE == 0 ]]; then
|
2020-02-09 20:48:03 -06:00
|
|
|
#
|
|
|
|
# List test descriptions with numbers and get selection
|
|
|
|
#
|
2019-07-10 05:55:51 -05:00
|
|
|
echo "Available '$TESTENV' tests:" ; echo "$OUT" | {
|
|
|
|
IND=0
|
|
|
|
while IFS= read -r LINE
|
|
|
|
do
|
|
|
|
if [[ $LINE =~ $ISEXEC ]]; then
|
2020-11-17 20:04:28 -06:00
|
|
|
DESC=$( "$SED" -E 's/^exec_test \$1 \$2 "([^"]+)".*$/\1/g' <<<"$LINE" )
|
2019-07-10 05:55:51 -05:00
|
|
|
(( ++IND < 10 )) && echo -n " "
|
|
|
|
echo " $IND) $DESC"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
CHOICE=1
|
|
|
|
if [[ $TESTCOUNT > 1 ]]; then
|
|
|
|
for (( ; ; ))
|
|
|
|
do
|
|
|
|
read -p "Select a '$TESTENV' test (1-$TESTCOUNT) : " CHOICE
|
2020-11-17 20:04:28 -06:00
|
|
|
[[ -z "$CHOICE" ]] && { errout "(canceled)" ; exit 1 ; }
|
2019-07-10 05:55:51 -05:00
|
|
|
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= TESTCOUNT)) && break
|
2020-11-17 20:04:28 -06:00
|
|
|
errout ">>> Invalid test selection '$CHOICE'."
|
2019-07-10 05:55:51 -05:00
|
|
|
done
|
|
|
|
fi
|
2019-07-07 06:04:49 -05:00
|
|
|
fi
|
|
|
|
|
2022-07-16 16:11:33 -05:00
|
|
|
#
|
|
|
|
# Restore to defaults if requested
|
|
|
|
#
|
|
|
|
((DL_DEFAULTS)) && use_example_configs
|
|
|
|
|
2020-02-09 20:48:03 -06:00
|
|
|
#
|
|
|
|
# Run the specified test lines
|
|
|
|
#
|
2020-11-17 20:04:28 -06:00
|
|
|
echo -ne "\033[0;33m"
|
2019-07-07 06:04:49 -05:00
|
|
|
echo "$OUT" | {
|
|
|
|
IND=0
|
2019-07-14 11:36:44 -05:00
|
|
|
GOTX=0
|
|
|
|
CMD=""
|
2019-07-07 06:04:49 -05:00
|
|
|
while IFS= read -r LINE
|
|
|
|
do
|
2019-07-14 11:36:44 -05:00
|
|
|
if [[ $LINE =~ $ISCMD || $GOTX == 1 ]]; then
|
2019-07-07 06:04:49 -05:00
|
|
|
((!IND)) && let IND++
|
|
|
|
if [[ $LINE =~ $ISEXEC ]]; then
|
|
|
|
((IND++ > CHOICE)) && break
|
|
|
|
else
|
|
|
|
((!HEADER)) && {
|
|
|
|
HEADER=1
|
|
|
|
echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#"
|
|
|
|
}
|
2019-07-14 11:36:44 -05:00
|
|
|
((IND == CHOICE)) && {
|
|
|
|
GOTX=1
|
2022-07-16 16:11:33 -05:00
|
|
|
[[ -n $DL_DEFAULTS && $LINE =~ $ISRST ]] && LINE="use_example_configs"
|
2020-11-17 20:04:28 -06:00
|
|
|
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' | $SED -E 's/ +/ /g' )
|
|
|
|
[[ $LINE =~ $ISCONT ]] || { echo "$CMD" ; eval "$CMD" ; CMD="" ; }
|
2019-07-14 11:36:44 -05:00
|
|
|
}
|
2019-07-07 06:04:49 -05:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2020-11-17 20:04:28 -06:00
|
|
|
echo -ne "\033[0m"
|
2019-07-07 06:04:49 -05:00
|
|
|
|
2020-03-02 18:32:01 -06:00
|
|
|
# Make clear it's a TEST
|
2021-03-05 04:30:52 -06:00
|
|
|
opt_set CUSTOM_MACHINE_NAME "\"Test $TESTENV ($CHOICE)\""
|
2020-03-02 18:32:01 -06:00
|
|
|
|
2019-07-07 06:04:49 -05:00
|
|
|
# Build the test too?
|
2020-11-17 20:04:28 -06:00
|
|
|
if [[ -z "$BUILD_YES" ]]; then
|
2019-10-06 21:03:11 -05:00
|
|
|
echo
|
|
|
|
read -p "Build $TESTENV test #$CHOICE (y/N) ? " BUILD_YES
|
|
|
|
fi
|
|
|
|
|
|
|
|
[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && {
|
2020-11-17 20:04:28 -06:00
|
|
|
((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE
|
2021-03-23 23:58:53 -05:00
|
|
|
((USE_MAKE)) || pio run $SILENT_FLAG -d . -e $TESTENV
|
2019-10-06 21:03:11 -05:00
|
|
|
echo "$TESTENV" >"$STATE_FILE"
|
|
|
|
}
|