|
@@ -11,11 +11,13 @@ MFINFO=$(mfinfo) || exit 1
|
11
|
11
|
[[ -d Marlin/src ]] || { echo "Please 'cd' up to repo root." ; exit 1 ; }
|
12
|
12
|
|
13
|
13
|
TESTPATH=buildroot/share/tests
|
|
14
|
+STATE_FILE=$( echo ./.pio/.mftestrc )
|
14
|
15
|
|
15
|
16
|
shopt -s extglob nocasematch
|
16
|
17
|
|
17
|
|
-# Get test
|
|
18
|
+# Get the environment and test number from the command
|
18
|
19
|
TESTENV=${1:-'-'}
|
|
20
|
+CHOICE=${2:-0}
|
19
|
21
|
|
20
|
22
|
# Allow shorthand for test name
|
21
|
23
|
case $TESTENV in
|
|
@@ -37,6 +39,15 @@ case $TESTENV in
|
37
|
39
|
t32) TESTENV='teensy31' ;;
|
38
|
40
|
t35) TESTENV='teensy35' ;;
|
39
|
41
|
t36) TESTENV='teensy35' ;;
|
|
42
|
+ # Build with the last-built env
|
|
43
|
+ -r) [[ -f "$STATE_FILE" ]] || { echo "No previous (-r) build state found." ; exit 1 ; }
|
|
44
|
+ read TESTENV <"$STATE_FILE"
|
|
45
|
+ platformio run --project-dir . -e $TESTENV
|
|
46
|
+ exit
|
|
47
|
+ ;;
|
|
48
|
+ # A -y may come first
|
|
49
|
+ -y) TESTENV=${2:-'-'} ; CHOICE=${3:-0} ;;
|
|
50
|
+ -[a-z]) echo "Unknown flag $TESTENV" ; exit 1 ;;
|
40
|
51
|
-) ;;
|
41
|
52
|
esac
|
42
|
53
|
|
|
@@ -77,9 +88,6 @@ OUT=$( cat $TESTPATH/$TESTENV-tests 2>/dev/null ) || { echo "Can't find test '$T
|
77
|
88
|
# TODO: List test descriptions with numbers
|
78
|
89
|
TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
|
79
|
90
|
|
80
|
|
-# Get the entered or interactive test index
|
81
|
|
-CHOICE=${2:-0}
|
82
|
|
-
|
83
|
91
|
# User entered a number?
|
84
|
92
|
(( CHOICE && CHOICE > TESTCOUNT )) && { echo "Invalid test index '$CHOICE' (1-$TESTCOUNT)." ; exit 1 ; }
|
85
|
93
|
|
|
@@ -135,6 +143,16 @@ echo "$OUT" | {
|
135
|
143
|
done
|
136
|
144
|
}
|
137
|
145
|
|
|
146
|
+# Get a -y parameter the lazy way
|
|
147
|
+[[ "$2" == "-y" || "$3" == "-y" ]] && BUILD_YES='Y'
|
|
148
|
+
|
138
|
149
|
# Build the test too?
|
139
|
|
-echo ; read -p "Build $TESTENV test #$CHOICE (y/N) ? " BUILD_YES
|
140
|
|
-[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && platformio run --project-dir . -e $TESTENV
|
|
150
|
+if [[ $BUILD_YES != 'Y' ]]; then
|
|
151
|
+ echo
|
|
152
|
+ read -p "Build $TESTENV test #$CHOICE (y/N) ? " BUILD_YES
|
|
153
|
+fi
|
|
154
|
+
|
|
155
|
+[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && {
|
|
156
|
+ platformio run --project-dir . -e $TESTENV
|
|
157
|
+ echo "$TESTENV" >"$STATE_FILE"
|
|
158
|
+}
|