Allow mftest -t to select by number

This commit is contained in:
Scott Lahteine 2021-02-13 19:06:55 -06:00
parent 00985cffea
commit 98a27bff0d

View file

@ -111,27 +111,28 @@ if ((REBUILD)); then
fi fi
case $TESTENV in case $TESTENV in
tree) pio run -d . -e include_tree ; exit 1 ;; tree) pio run -d . -e include_tree ; exit 1 ;;
due) TESTENV='DUE' ;; due) TESTENV='DUE' ;;
esp) TESTENV='esp32' ;; esp) TESTENV='esp32' ;;
lin*) TESTENV='linux_native' ;; lin*) TESTENV='linux_native' ;;
lpc?(8)) TESTENV='LPC1768' ;; lp8|lpc8) TESTENV='LPC1768' ;;
lpc9) TESTENV='LPC1769' ;; lp9|lpc9) TESTENV='LPC1769' ;;
m128) TESTENV='mega1280' ;; m128) TESTENV='mega1280' ;;
m256) TESTENV='mega2560' ;; m256) TESTENV='mega2560' ;;
mega) TESTENV='mega2560' ;; mega) TESTENV='mega2560' ;;
stm) TESTENV='STM32F103RE' ;; stm) TESTENV='STM32F103RE' ;;
f1) TESTENV='STM32F103RE' ;; f1) TESTENV='STM32F103RE' ;;
f4) TESTENV='STM32F4' ;; f4) TESTENV='STM32F4' ;;
f7) TESTENV='STM32F7' ;; f7) TESTENV='STM32F7' ;;
s6) TESTENV='FYSETC_S6' ;; s6) TESTENV='FYSETC_S6' ;;
teensy) TESTENV='teensy31' ;; teensy) TESTENV='teensy31' ;;
t31) TESTENV='teensy31' ;; t31) TESTENV='teensy31' ;;
t32) TESTENV='teensy31' ;; t32) TESTENV='teensy31' ;;
t35) TESTENV='teensy35' ;; t35) TESTENV='teensy35' ;;
t36) TESTENV='teensy35' ;; t36) TESTENV='teensy35' ;;
t40) TESTENV='teensy41' ;; t40) TESTENV='teensy41' ;;
t41) TESTENV='teensy41' ;; t41) TESTENV='teensy41' ;;
[1-9][1-9]|[1-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
esac esac
if ((AUTO_BUILD)); then if ((AUTO_BUILD)); then
@ -217,8 +218,14 @@ if [[ $TESTENV == '-' ]]; then
echo echo
for (( ; ; )) for (( ; ; ))
do do
read -p "Select a test to apply (1-$IND) : " NAMEIND if [[ $TESTNUM -gt 0 ]]; then
[[ -z "$NAMEIND" ]] && { errout "(canceled)" ; exit 1 ; } 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='' ; }
[[ $NAMEIND =~ $ISNUM ]] && ((NAMEIND >= 1 && NAMEIND <= IND)) && { TESTENV=${NAMES[$NAMEIND-1]} ; echo ; break ; } [[ $NAMEIND =~ $ISNUM ]] && ((NAMEIND >= 1 && NAMEIND <= IND)) && { TESTENV=${NAMES[$NAMEIND-1]} ; echo ; break ; }
errout "Invalid selection." errout "Invalid selection."
done done