check_code_size.sh 697 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. #
  3. # This script check that changes don't lead to code size regressions.
  4. # (Size of the language core (== minimal port should not grow)).
  5. #
  6. REFERENCE=$HOME/persist/firmware.bin
  7. #REFERENCE=/tmp/micropython
  8. #TRAVIS_PULL_REQUEST=false
  9. if [ -f $REFERENCE ]; then
  10. size_old=$(stat -c%s $REFERENCE)
  11. size_new=$(stat -c%s ports/minimal/build/firmware.bin)
  12. echo "Old size: $size_old new size: $size_new"
  13. if [ $size_new -gt $size_old ]; then
  14. echo "Validation failure: Core code size increased"
  15. if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
  16. exit 1
  17. fi
  18. fi
  19. else
  20. echo "Warning: reference file doesn't exist, code size check didn't run"
  21. fi