build_all_examples -c -s, silent mftest

This commit is contained in:
Scott Lahteine 2021-03-01 05:39:31 -06:00 committed by Scott Lahteine
parent b71f1e1edd
commit ef57a3e585
3 changed files with 32 additions and 12 deletions

View File

@ -30,24 +30,37 @@ echo "This script downloads all Configurations and builds Marlin with each one."
echo "On failure the last-built configs will be left in your working copy." echo "On failure the last-built configs will be left in your working copy."
echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'." echo "Restore your configs with 'git checkout -f' or 'git reset --hard HEAD'."
unset BRANCH
unset FIRST_CONF
if [[ -f "$STAT_FILE" ]]; then
IFS='*' read BRANCH FIRST_CONF <"$STAT_FILE"
fi
# If -c is given start from the last attempted build # If -c is given start from the last attempted build
if [[ $1 == '-c' ]]; then if [[ $1 == '-c' ]]; then
if [[ -f "$STAT_FILE" ]]; then if [[ -z $BRANCH || -z $FIRST_CONF ]]; then
read BRANCH FIRST_CONF <"$STAT_FILE"
else
echo "Nothing to continue" echo "Nothing to continue"
exit exit
fi fi
elif [[ $1 == '-s' ]]; then
if [[ -n $BRANCH && -n $FIRST_CONF ]]; then
SKIP_CONF=1
else
echo "Nothing to skip"
exit
fi
else else
BRANCH=${1:-"import-2.0.x"} BRANCH=${1:-"import-2.0.x"}
FIRST_CONF=$2 FIRST_CONF=$2
fi fi
# Check if the current repository has unmerged changes # Check if the current repository has unmerged changes
if [[ -z "$FIRST_CONF" ]]; then if [[ $SKIP_CONF ]]; then
git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; } echo "Skipping $FIRST_CONF"
else elif [[ $FIRST_CONF ]]; then
echo "Resuming from $FIRST_CONF" echo "Resuming from $FIRST_CONF"
else
git diff --quiet || { echo "The working copy is modified. Commit or stash changes before proceeding."; exit ; }
fi fi
# Create a temporary folder inside .pio # Create a temporary folder inside .pio
@ -67,12 +80,19 @@ shopt -s nullglob
IFS=' IFS='
' '
CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" ) CONF_TREE=$( ls -d "$TMP"/config/examples/*/ "$TMP"/config/examples/*/*/ "$TMP"/config/examples/*/*/*/ "$TMP"/config/examples/*/*/*/*/ | grep -vE ".+\.(\w+)$" )
DOSKIP=0
for CONF in $CONF_TREE ; do for CONF in $CONF_TREE ; do
# Get a config's directory name
DIR=$( echo $CONF | sed "s|$TMP/config/examples/||" ) DIR=$( echo $CONF | sed "s|$TMP/config/examples/||" )
[[ ! -z $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue # If looking for a config, skip others
[[ $FIRST_CONF ]] && [[ $FIRST_CONF != $DIR && "$FIRST_CONF/" != $DIR ]] && continue
# Once found, stop looking
unset FIRST_CONF unset FIRST_CONF
# If skipping, don't build the found one
[[ $SKIP_CONF ]] && { unset SKIP_CONF ; continue ; }
# ...if skipping, don't build this one
compgen -G "${CONF}Con*.h" > /dev/null || continue compgen -G "${CONF}Con*.h" > /dev/null || continue
echo -e "$BRANCH\n$DIR" >"$STAT_FILE" echo "${BRANCH}*${DIR}" >"$STAT_FILE"
"$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; } "$HERE/build_example" "internal" "$TMP" "$DIR" || { echo "Failed to build $DIR"; exit ; }
done done

View File

@ -24,6 +24,6 @@ cp "$SUB"/_Statusscreen.h Marlin/ 2>/dev/null
echo "Building the firmware now..." echo "Building the firmware now..."
HERE=`dirname "$0"` HERE=`dirname "$0"`
$HERE/mftest -a || { echo "Failed"; exit 1; } $HERE/mftest -a -n1 || { echo "Failed"; exit 1; }
echo "Success" echo "Success"

View File

@ -105,7 +105,7 @@ if ((REBUILD)); then
# Build with the last-built env # Build with the last-built env
[[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; } [[ -f "$STATE_FILE" ]] || { errout "No previous (-r) build state found." ; exit 1 ; }
read TESTENV <"$STATE_FILE" read TESTENV <"$STATE_FILE"
pio run -d . -e $TESTENV pio run -s -d . -e $TESTENV
exit exit
fi fi
@ -192,7 +192,7 @@ if ((AUTO_BUILD)); then
pio run -t upload -e $TARGET pio run -t upload -e $TARGET
else else
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo
pio run -e $TARGET pio run -s -e $TARGET
fi fi
exit exit
fi fi
@ -307,6 +307,6 @@ fi
[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && { [[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && {
((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE ((USE_MAKE)) && make tests-single-local TEST_TARGET=$TESTENV ONLY_TEST=$CHOICE
((USE_MAKE)) || pio run -d . -e $TESTENV ((USE_MAKE)) || pio run -s -d . -e $TESTENV
echo "$TESTENV" >"$STATE_FILE" echo "$TESTENV" >"$STATE_FILE"
} }