Allow mftest -t to select by number

This commit is contained in:
Scott Lahteine 2021-02-13 19:06:55 -06:00 committed by Scott Lahteine
parent b95e60dbbd
commit 69fcd9210f

View File

@ -115,8 +115,8 @@ case $TESTENV in
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' ;;
@ -132,6 +132,7 @@ lpc?(8)) TESTENV='LPC1768' ;;
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
if [[ $TESTNUM -gt 0 ]]; then
NAMEIND=$TESTNUM
else
read -p "Select a test to apply (1-$IND) : " NAMEIND read -p "Select a test to apply (1-$IND) : " NAMEIND
[[ -z "$NAMEIND" ]] && { errout "(canceled)" ; exit 1 ; } 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