diff options
| author | Nick Brassel <nick@tzarc.org> | 2022-02-09 03:25:55 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-08 16:25:55 +0000 |
| commit | a239051c4a4779767059140892144dedea09aaf2 (patch) | |
| tree | e3e08e76a09ec11838a65525231ddb2765b54b88 /util | |
| parent | 87e6c2b06ba08806cc20e2b16f1ff18a88e83e67 (diff) | |
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`
Diffstat (limited to 'util')
| -rwxr-xr-x | util/size_regression.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/util/size_regression.sh b/util/size_regression.sh index 988d1d9b5b..d474d8d0d5 100755 --- a/util/size_regression.sh +++ b/util/size_regression.sh | |||
| @@ -11,6 +11,8 @@ dest_ref="develop" | |||
| 11 | ignore_ref="master" | 11 | ignore_ref="master" |
| 12 | unset skip_zero | 12 | unset skip_zero |
| 13 | 13 | ||
| 14 | export SIZE_REGRESSION_EXECUTING=1 | ||
| 15 | |||
| 14 | function usage() { | 16 | function usage() { |
| 15 | echo "Usage: $(basename "$0") [-h] [-j <jobs>] [-s <source>] [-d <dest>] [-n] planck/rev6:default" | 17 | echo "Usage: $(basename "$0") [-h] [-j <jobs>] [-s <source>] [-d <dest>] [-n] planck/rev6:default" |
| 16 | echo " -h : Shows this usage page." | 18 | echo " -h : Shows this usage page." |
| @@ -23,9 +25,24 @@ function usage() { | |||
| 23 | } | 25 | } |
| 24 | 26 | ||
| 25 | if [[ ${#} -eq 0 ]]; then | 27 | if [[ ${#} -eq 0 ]]; then |
| 26 | usage | 28 | usage |
| 29 | exit 0 | ||
| 27 | fi | 30 | fi |
| 28 | 31 | ||
| 32 | unset cleanup_completed | ||
| 33 | _internal_cleanup() { | ||
| 34 | if [[ -z "${cleanup_completed:-}" ]] ; then | ||
| 35 | echo | ||
| 36 | echo | ||
| 37 | echo 'Your git repository is in an indeterminate state!' >&2 | ||
| 38 | echo 'Make sure you swap to your intended branch.' >&2 | ||
| 39 | echo | ||
| 40 | unset SIZE_REGRESSION_EXECUTING | ||
| 41 | fi | ||
| 42 | cleanup_completed=1 | ||
| 43 | } | ||
| 44 | trap _internal_cleanup EXIT HUP INT | ||
| 45 | |||
| 29 | while getopts "hj:s:d:i:n" opt "$@" ; do | 46 | while getopts "hj:s:d:i:n" opt "$@" ; do |
| 30 | case "$opt" in | 47 | case "$opt" in |
| 31 | h) usage; exit 0;; | 48 | h) usage; exit 0;; |
| @@ -49,7 +66,8 @@ function build_executor() { | |||
| 49 | revision=$(echo $line | cut -d' ' -f1) | 66 | revision=$(echo $line | cut -d' ' -f1) |
| 50 | 67 | ||
| 51 | make distclean >/dev/null 2>&1 | 68 | make distclean >/dev/null 2>&1 |
| 52 | git checkout $revision >/dev/null 2>&1 || { echo "Failed to check out revision ${revision}" >&2 ; exit 1 ; } | 69 | |
| 70 | git checkout -f $revision >/dev/null 2>&1 || { echo "Failed to check out revision ${revision}" >&2 ; exit 1 ; } | ||
| 53 | make -j${job_count} $keyboard_target >/dev/null 2>&1 || true | 71 | make -j${job_count} $keyboard_target >/dev/null 2>&1 || true |
| 54 | file_size=$(arm-none-eabi-size .build/*.elf 2>/dev/null | awk '/elf/ {print $1}' 2>/dev/null || true) | 72 | file_size=$(arm-none-eabi-size .build/*.elf 2>/dev/null | awk '/elf/ {print $1}' 2>/dev/null || true) |
| 55 | 73 | ||
