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

Commit c433521

Browse files
committed
feat(travis): Also check for dart2js sizes that are unexpectedly small
1 parent fb7a3aa commit c433521

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/travis/build.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ echo '==========='
77
echo '== BUILD =='
88
echo '==========='
99

10-
SIZE_TOO_BIG_COUNT=0
10+
SIZE_UNEXPECTED_COUNT=0
1111

1212
export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
1313

1414
function checkSize() {
1515
file=$1
1616
if [[ ! -e $file ]]; then
1717
echo Could not find file: $file
18-
SIZE_TOO_BIG_COUNT=$((SIZE_TOO_BIG_COUNT + 1));
18+
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
1919
else
2020
expected=$2
2121
actual=`cat $file | gzip | wc -c`
2222
if (( 100 * $actual >= 105 * $expected )); then
2323
echo ${file} is too large expecting ${expected} was ${actual}.
24-
SIZE_TOO_BIG_COUNT=$((SIZE_TOO_BIG_COUNT + 1));
24+
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
25+
fi
26+
if (( 100 * $actual <= 95 * $expected )); then
27+
echo ${file} is too small expecting ${expected} was ${actual}.
28+
echo Please update scripts/travis/build.sh with the correct value.
29+
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
2530
fi
2631
fi
2732
}
@@ -59,7 +64,7 @@ if [[ $TESTS == "dart2js" ]]; then
5964
checkSize build/web/bouncing_balls.dart.js 202325
6065
checkSize build/web/hello_world.dart.js 210000
6166
checkSize build/web/todo.dart.js 203121
62-
if ((SIZE_TOO_BIG_COUNT > 0)); then
67+
if ((SIZE_UNEXPECTED_COUNT > 0)); then
6368
exit 1
6469
else
6570
echo Generated JavaScript file size check OK.

0 commit comments

Comments
 (0)