Bump to head
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mfhelp
|
||||
#
|
||||
|
||||
cat <<THIS
|
||||
Marlin Firmware Commands:
|
||||
|
||||
firstpush ... Push and set-upstream the current branch to 'origin'
|
||||
ghpc ........ Push the current branch to its upstream branch
|
||||
ghtp ........ Set the transfer protolcol for all your remotes
|
||||
mfadd ....... Fetch a remote branch from any Marlin fork
|
||||
mfclean ..... Attempt to clean up merged and deleted branches
|
||||
mfdoc ....... Build the website, serve locally, and browse
|
||||
mffp ........ Push new commits directly to MarlinFirmware
|
||||
mfinfo ...... Provide branch information (for the other scripts)
|
||||
mfinit ...... Create an 'upstream' remote for 'MarlinFirmare'
|
||||
mfnew ....... Create a new branch based on 'bugfix-...'
|
||||
mfpr ........ Push the current branch and open the PR form
|
||||
mfpub ....... Build and publish the marlinfw.org website
|
||||
mfqp ........ Commit changes, do an interactive rebase, and push
|
||||
mfrb ........ Interactively rebase the current branch on 'bugfix-...'
|
||||
mftest ...... Run a platform test locally with PlatformIO
|
||||
mfup ........ Fetch the latest 'upstream' and rebase on it
|
||||
|
||||
Enter [command] --help for more information.
|
||||
|
||||
THIS
|
||||
@@ -32,7 +32,7 @@ while [[ $# -gt 0 ]]; do
|
||||
opt="$1" ; shift ; val="$1"
|
||||
|
||||
IFS='=' read -a PARTS <<<"$opt"
|
||||
[[ "${PARTS[1]}" != "" ]] && { HAS_EQUALS=1 ; opt="${PARTS[0]}" ; val="${PARTS[1]}" ; }
|
||||
[[ "${PARTS[1]}" != "" ]] && { EQUALS=1 ; opt="${PARTS[0]}" ; val="${PARTS[1]}" ; }
|
||||
|
||||
GOODVAL=1
|
||||
if [[ "$val" =~ ^-{1,2}.* || ! "$opt" =~ ^-{1,2}.* ]]; then
|
||||
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
|
||||
fi
|
||||
|
||||
case "$opt" in
|
||||
-*|--*) MORE="$MORE$opt " ; [[ $HAS_EQUALS ]] && MORE="$MORE=$val" ;;
|
||||
-*|--*) MORE="$MORE$opt " ; [[ $EQUALS == 1 ]] && MORE="$MORE=$val" ;;
|
||||
1|2) INDEX=$opt ;;
|
||||
*) BRANCH="$opt" ;;
|
||||
esac
|
||||
@@ -55,6 +55,6 @@ esac
|
||||
|
||||
[[ $BRANCH =~ ^[0-9]$ ]] && USAGE=1
|
||||
|
||||
[[ $USAGE ]] && { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1 ; }
|
||||
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1 ; }
|
||||
|
||||
echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE"
|
||||
|
||||
@@ -24,7 +24,7 @@ done
|
||||
|
||||
[[ ${INFO[4]} =~ [0-9] ]] && USAGE=1
|
||||
|
||||
[[ $USAGE ]] && { echo "usage: `basename $0` [-hq] [1|2]" 1>&2 ; exit 1 ; }
|
||||
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [-hq] [1|2]" 1>&2 ; exit 1 ; }
|
||||
|
||||
git add .
|
||||
git commit -m "patch"
|
||||
|
||||
@@ -21,7 +21,7 @@ while [ $IND -lt ${#INFO[@]} ]; do
|
||||
let IND+=1
|
||||
done
|
||||
|
||||
[[ $USAGE ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; }
|
||||
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; }
|
||||
|
||||
# If the branch isn't currently the PR target
|
||||
if [[ $TARG != $CURR ]]; then
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# mftest [name] [index]
|
||||
#
|
||||
# Set configuration options based on a test
|
||||
# By default it will do megaatmega2560
|
||||
# Use 'mftest -' to pick from the list.
|
||||
#
|
||||
|
||||
MFINFO=$(mfinfo) || exit 1
|
||||
[[ -d Marlin/src ]] || { echo "Please 'cd' up to repo root." ; exit 1 ; }
|
||||
|
||||
TESTPATH=buildroot/share/tests
|
||||
|
||||
shopt -s extglob nocasematch
|
||||
|
||||
# Get test
|
||||
TESTENV=${1:-'-'}
|
||||
|
||||
# Allow shorthand for test name
|
||||
case $TESTENV in
|
||||
due) TESTENV='DUE' ;;
|
||||
esp) TESTENV='esp32' ;;
|
||||
lin*) TESTENV='linux_native' ;;
|
||||
lpc?(8)) TESTENV='LPC1768' ;;
|
||||
lpc9) TESTENV='LPC1769' ;;
|
||||
mega) TESTENV='megaatmega2560' ;;
|
||||
stm) TESTENV='STM32F1' ;;
|
||||
teensy) TESTENV='teensy31' ;;
|
||||
t31) TESTENV='teensy31' ;;
|
||||
t32) TESTENV='teensy31' ;;
|
||||
t35) TESTENV='teensy35' ;;
|
||||
t36) TESTENV='teensy35' ;;
|
||||
-) ;;
|
||||
esac
|
||||
|
||||
# Matching patterns
|
||||
ISNUM='^[0-9]+$'
|
||||
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
||||
ISEXEC='^exec_'
|
||||
ISCONT='\\ *$'
|
||||
|
||||
# List available tests and ask for selection
|
||||
if [[ $TESTENV == '-' ]]; then
|
||||
IND=0
|
||||
NAMES=()
|
||||
for FILE in $( ls -1 $TESTPATH/*-tests )
|
||||
do
|
||||
let IND++
|
||||
TNAME=${FILE/-tests/}
|
||||
TNAME=${TNAME/$TESTPATH\//}
|
||||
NAMES+=($TNAME)
|
||||
(( IND < 10 )) && echo -n " "
|
||||
echo " $IND) $TNAME"
|
||||
done
|
||||
|
||||
echo
|
||||
for (( ; ; ))
|
||||
do
|
||||
read -p "Select a test to apply (1-$IND) : " NAMEIND
|
||||
[[ -z "$NAMEIND" ]] && { echo '(canceled)' ; exit 1 ; }
|
||||
[[ $NAMEIND =~ $ISNUM ]] && ((NAMEIND >= 1 && NAMEIND <= IND)) && { TESTENV=${NAMES[$NAMEIND-1]} ; echo ; break ; }
|
||||
echo "Invalid selection."
|
||||
done
|
||||
fi
|
||||
|
||||
# Get the contents of the test file
|
||||
OUT=$( cat $TESTPATH/$TESTENV-tests 2>/dev/null ) || { echo "Can't find test '$TESTENV'." ; exit 1 ; }
|
||||
|
||||
# Count up the number of tests
|
||||
# TODO: List test descriptions with numbers
|
||||
TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
|
||||
|
||||
# Get the entered or interactive test index
|
||||
CHOICE=${2:-0}
|
||||
|
||||
# User entered a number?
|
||||
(( CHOICE && CHOICE > TESTCOUNT )) && { echo "Invalid test index '$CHOICE' (1-$TESTCOUNT)." ; exit 1 ; }
|
||||
|
||||
if [[ $CHOICE == 0 ]]; then
|
||||
# List test descriptions with numbers
|
||||
echo "Available '$TESTENV' tests:" ; echo "$OUT" | {
|
||||
IND=0
|
||||
SED=$(which gsed || which sed)
|
||||
while IFS= read -r LINE
|
||||
do
|
||||
if [[ $LINE =~ $ISEXEC ]]; then
|
||||
DESC=$( "$SED" -E 's/^.+"(.*)".*$/\1/g' <<<"$LINE" )
|
||||
(( ++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
|
||||
[[ -z "$CHOICE" ]] && { echo '(canceled)' ; exit 1 ; }
|
||||
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= TESTCOUNT)) && break
|
||||
echo ">>> Invalid test index '$CHOICE'."
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Finally, run the specified test lines
|
||||
echo "$OUT" | {
|
||||
IND=0
|
||||
GOTX=0
|
||||
CMD=""
|
||||
while IFS= read -r LINE
|
||||
do
|
||||
if [[ $LINE =~ $ISCMD || $GOTX == 1 ]]; then
|
||||
((!IND)) && let IND++
|
||||
if [[ $LINE =~ $ISEXEC ]]; then
|
||||
((IND++ > CHOICE)) && break
|
||||
else
|
||||
((!HEADER)) && {
|
||||
HEADER=1
|
||||
echo -e "\n#\n# Test $TESTENV ($CHOICE) $DESC\n#"
|
||||
}
|
||||
((IND == CHOICE)) && {
|
||||
GOTX=1
|
||||
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | sed -e 's/\\//g' )
|
||||
[[ $LINE =~ $ISCONT ]] || { echo $CMD ; eval "$CMD" ; CMD="" ; }
|
||||
}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Build the test too?
|
||||
echo ; read -p "Build $TESTENV test #$CHOICE (y/N) ? " BUILD_YES
|
||||
[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && platformio run --project-dir . -e $TESTENV
|
||||
Reference in New Issue
Block a user