blob: c255bf00d61d9ae371f1fcc0a0dd59d09449867a [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Copyright (C) 2009 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the 'License');
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an 'AS IS' BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# Usage:
17#
18# Source this file into your environment. Then:
19#
20# $ golden_builds sdk-sdk generic-eng generic-userdebug dream-eng
21#
22# will build a set of combos. This might take a while. Then you can
23# go make changes, and run:
24#
25# $ check_builds sdk-sdk generic-eng generic-userdebug dream-eng
26#
27# Go get dinner, and when you get back, there will be a file
28# test-builds/sizes.html that has a pretty chart of which files are
29# in which tree, and how big they are. In that chart, cells for files
30# that are missing are red, and rows where the file sizes are not all
31# the same will be blue.
32#
33
34TEST_BUILD_DIR=test-builds
35
36function do_builds
37{
38 PREFIX=$1
39 shift
40 while [ -n "$1" ]
41 do
42 rm -rf $TEST_BUILD_DIR/$PREFIX-$1
Joe Onorato7ee52de2009-04-18 22:36:21 -070043 make PRODUCT-$(echo $1 | sed "s/-.*//" )-installclean
Joe Onoratob5318d12012-05-07 19:21:51 -070044 make -j16 PRODUCT-$1 dist DIST_DIR=$TEST_BUILD_DIR/$PREFIX-$1
The Android Open Source Project88b60792009-03-03 19:28:42 -080045 if [ $? -ne 0 ] ; then
46 echo FAILED
47 return
48 fi
49 shift
50 done
51}
52
53function golden_builds
54{
55 rm -rf $TEST_BUILD_DIR/golden-* $TEST_BUILD_DIR/dist-*
56 do_builds golden "$@"
57}
58
The Android Open Source Project2f312932009-03-09 11:52:11 -070059function compare_builds
60{
61 local inputs=
62 while [ -n "$1" ]
63 do
64 inputs="$inputs $TEST_BUILD_DIR/golden-$1/installed-files.txt"
65 inputs="$inputs $TEST_BUILD_DIR/dist-$1/installed-files.txt"
66 shift
67 done
68 build/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html
69}
70
The Android Open Source Project88b60792009-03-03 19:28:42 -080071function check_builds
72{
73 rm -rf $TEST_BUILD_DIR/dist-*
74 do_builds dist "$@"
The Android Open Source Project2f312932009-03-09 11:52:11 -070075 compare_builds "$@"
The Android Open Source Project88b60792009-03-03 19:28:42 -080076}
77
Joe Onorato7ee52de2009-04-18 22:36:21 -070078function diff_builds
79{
80 local inputs=
81 while [ -n "$1" ]
82 do
83 diff $TEST_BUILD_DIR/golden-$1/installed-files.txt $TEST_BUILD_DIR/dist-$1/installed-files.txt &> /dev/null
84 if [ $? != 0 ]; then
85 echo =========== $1 ===========
86 diff $TEST_BUILD_DIR/golden-$1/installed-files.txt $TEST_BUILD_DIR/dist-$1/installed-files.txt
87 fi
88 shift
89 done
90 build/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html
91}
92