Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
feat(travis): Also check for dart2js sizes that are unexpectedly small
Browse files Browse the repository at this point in the history
Closes #1427
  • Loading branch information
jbdeboer authored and vsavkin committed Sep 14, 2014
1 parent a199df8 commit e90fa60
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ echo '==========='
echo '== BUILD =='
echo '==========='

SIZE_TOO_BIG_COUNT=0
SIZE_UNEXPECTED_COUNT=0

export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`

function checkSize() {
file=$1
if [[ ! -e $file ]]; then
echo Could not find file: $file
SIZE_TOO_BIG_COUNT=$((SIZE_TOO_BIG_COUNT + 1));
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
else
expected=$2
actual=`cat $file | gzip | wc -c`
if (( 100 * $actual >= 105 * $expected )); then
echo ${file} is too large expecting ${expected} was ${actual}.
SIZE_TOO_BIG_COUNT=$((SIZE_TOO_BIG_COUNT + 1));
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
fi
if (( 100 * $actual <= 95 * $expected )); then
echo ${file} is too small expecting ${expected} was ${actual}.
echo Please update scripts/travis/build.sh with the correct value.
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
fi
fi
}
Expand All @@ -35,7 +40,7 @@ function checkAllSizes() {(
checkSize build/web/bouncing_balls.dart.js 223927
checkSize build/web/hello_world.dart.js 221838
checkSize build/web/todo.dart.js 224414
if ((SIZE_TOO_BIG_COUNT > 0)); then
if ((SIZE_UNEXPECTED_COUNT > 0)); then
exit 1
else
echo Generated JavaScript file size check OK.
Expand Down

0 comments on commit e90fa60

Please sign in to comment.