Skip to content

Commit f7aa692

Browse files
committed
tools/check_code_size.sh: Code size validation script for CI.
1 parent 984a867 commit f7aa692

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tools/check_code_size.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
7+
REFERENCE=$HOME/persist/firmware.bin
8+
#REFERENCE=/tmp/micropython
9+
#TRAVIS_PULL_REQUEST=false
10+
11+
if [ -f $REFERENCE ]; then
12+
size_old=$(stat -c%s $REFERENCE)
13+
size_new=$(stat -c%s minimal/build/firmware.bin)
14+
echo "Old size: $size_old new size: $size_new"
15+
if [ $size_new -gt $size_old ]; then
16+
echo "Validation failure: Core code size increased"
17+
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
18+
exit 1
19+
fi
20+
fi
21+
else
22+
echo "Warning: reference file doesn't exist, code size check didn't run"
23+
fi

0 commit comments

Comments
 (0)