OSDN Git Service

599aafafe0658c457fad30d024c3bc1391a050d4
[android-x86/build.git] / tools / check_builds.sh
1 # 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
34 TEST_BUILD_DIR=test-builds
35
36 function do_builds
37 {
38     PREFIX=$1
39     shift
40     while [ -n "$1" ]
41     do
42         rm -rf $TEST_BUILD_DIR/$PREFIX-$1
43         make -j6 PRODUCT-$1 dist DIST_DIR=$TEST_BUILD_DIR/$PREFIX-$1
44         if [ $? -ne 0 ] ; then
45             echo FAILED
46             return
47         fi
48         shift
49     done
50 }
51
52 function golden_builds
53 {
54     rm -rf $TEST_BUILD_DIR/golden-* $TEST_BUILD_DIR/dist-*
55     do_builds golden "$@"
56 }
57
58 function compare_builds
59 {
60     local inputs=
61     while [ -n "$1" ]
62     do
63         inputs="$inputs $TEST_BUILD_DIR/golden-$1/installed-files.txt"
64         inputs="$inputs $TEST_BUILD_DIR/dist-$1/installed-files.txt"
65         shift
66     done
67     build/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html
68 }
69
70 function check_builds
71 {
72     rm -rf $TEST_BUILD_DIR/dist-*
73     do_builds dist "$@"
74     compare_builds "$@"
75 }
76