1
0
Fork 0

Misc size regression script improvements. (#16268)

* Misc size regression script improvements.

- Sets environment variable SIZE_REGRESSION_EXECUTING during execution
  so hook scripts like `post-checkout` may skip processing.
- Forces checkout of the target branch, including removal of all
  temporary object files in the process.
- Prints out a warning on exit stating that the git repository is in an
  indeterminate state, and the user needs to swap back to whatever
  intended branch they were working with originally.

* Remove `git clean`
This commit is contained in:
Nick Brassel 2022-02-09 03:25:55 +11:00 committed by GitHub
parent 87e6c2b06b
commit a239051c4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,8 @@ dest_ref="develop"
ignore_ref="master" ignore_ref="master"
unset skip_zero unset skip_zero
export SIZE_REGRESSION_EXECUTING=1
function usage() { function usage() {
echo "Usage: $(basename "$0") [-h] [-j <jobs>] [-s <source>] [-d <dest>] [-n] planck/rev6:default" echo "Usage: $(basename "$0") [-h] [-j <jobs>] [-s <source>] [-d <dest>] [-n] planck/rev6:default"
echo " -h : Shows this usage page." echo " -h : Shows this usage page."
@ -24,8 +26,23 @@ function usage() {
if [[ ${#} -eq 0 ]]; then if [[ ${#} -eq 0 ]]; then
usage usage
exit 0
fi fi
unset cleanup_completed
_internal_cleanup() {
if [[ -z "${cleanup_completed:-}" ]] ; then
echo
echo
echo 'Your git repository is in an indeterminate state!' >&2
echo 'Make sure you swap to your intended branch.' >&2
echo
unset SIZE_REGRESSION_EXECUTING
fi
cleanup_completed=1
}
trap _internal_cleanup EXIT HUP INT
while getopts "hj:s:d:i:n" opt "$@" ; do while getopts "hj:s:d:i:n" opt "$@" ; do
case "$opt" in case "$opt" in
h) usage; exit 0;; h) usage; exit 0;;
@ -49,7 +66,8 @@ function build_executor() {
revision=$(echo $line | cut -d' ' -f1) revision=$(echo $line | cut -d' ' -f1)
make distclean >/dev/null 2>&1 make distclean >/dev/null 2>&1
git checkout $revision >/dev/null 2>&1 || { echo "Failed to check out revision ${revision}" >&2 ; exit 1 ; }
git checkout -f $revision >/dev/null 2>&1 || { echo "Failed to check out revision ${revision}" >&2 ; exit 1 ; }
make -j${job_count} $keyboard_target >/dev/null 2>&1 || true make -j${job_count} $keyboard_target >/dev/null 2>&1 || true
file_size=$(arm-none-eabi-size .build/*.elf 2>/dev/null | awk '/elf/ {print $1}' 2>/dev/null || true) file_size=$(arm-none-eabi-size .build/*.elf 2>/dev/null | awk '/elf/ {print $1}' 2>/dev/null || true)