From e90fa606358a106ecba23657702d25b05c7c80d2 Mon Sep 17 00:00:00 2001 From: James deBoer Date: Thu, 4 Sep 2014 17:04:11 -0700 Subject: [PATCH] feat(travis): Also check for dart2js sizes that are unexpectedly small Closes #1427 --- scripts/travis/build.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/travis/build.sh b/scripts/travis/build.sh index de4bca13e..7ac5cc3ba 100755 --- a/scripts/travis/build.sh +++ b/scripts/travis/build.sh @@ -7,7 +7,7 @@ echo '===========' echo '== BUILD ==' echo '===========' -SIZE_TOO_BIG_COUNT=0 +SIZE_UNEXPECTED_COUNT=0 export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev` @@ -15,13 +15,18 @@ 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 } @@ -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.