diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-10-25 11:07:29 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-10-25 11:43:55 +0300 |
commit | f7aa692093f1f6b34fbf2e4ad0f8178b1c4ebedb (patch) | |
tree | becafa3ac5c4a518877d5ea60a47508d2bfd7fef | |
parent | 984a867341970f311a143906d62c74fa1bfb93fb (diff) |
tools/check_code_size.sh: Code size validation script for CI.
-rwxr-xr-x | tools/check_code_size.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/check_code_size.sh b/tools/check_code_size.sh new file mode 100755 index 000000000..c5f0c6ffd --- /dev/null +++ b/tools/check_code_size.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +# This script check that changes don't lead to code size regressions. +# (Size of the language core (== minimal port should not grow)). +# + +REFERENCE=$HOME/persist/firmware.bin +#REFERENCE=/tmp/micropython +#TRAVIS_PULL_REQUEST=false + +if [ -f $REFERENCE ]; then + size_old=$(stat -c%s $REFERENCE) + size_new=$(stat -c%s minimal/build/firmware.bin) + echo "Old size: $size_old new size: $size_new" + if [ $size_new -gt $size_old ]; then + echo "Validation failure: Core code size increased" + if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + exit 1 + fi + fi +else + echo "Warning: reference file doesn't exist, code size check didn't run" +fi |