OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Provides test coverage for common recipe configurations. | 6 """Provides test coverage for common recipe configurations. |
7 | 7 |
8 recipe config expectations are located in ../recipe_configs_test/*.expected | 8 recipe config expectations are located in ../recipe_configs_test/*.expected |
9 | 9 |
10 In training mode, this will loop over every config item in ../recipe_configs.py | 10 In training mode, this will loop over every config item in ../recipe_configs.py |
11 crossed with every platform, and spit out the as_json() representation to | 11 crossed with every platform, and spit out the as_json() representation to |
12 ../recipe_configs_test | 12 ../recipe_configs_test |
13 | 13 |
14 You must have 100% coverage of ../recipe_configs.py for this test to pass. | 14 You must have 100% coverage of ../recipe_configs.py for this test to pass. |
15 """ | 15 """ |
16 | 16 |
17 import argparse | 17 import argparse |
18 import multiprocessing | 18 import multiprocessing |
19 import os | 19 import os |
20 import sys | 20 import sys |
21 from itertools import product, imap | 21 from itertools import product, imap |
22 | 22 |
23 import test_env # "relative import" pylint: disable=W0403 | 23 import test_env # "relative import" pylint: disable=W0403,W0611 |
24 | 24 |
25 from slave import recipe_loader | 25 from slave import recipe_loader |
26 from slave import recipe_util | 26 from slave import recipe_util |
27 | 27 |
28 import coverage | 28 import coverage |
29 | 29 |
30 SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) | 30 SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) |
31 SLAVE_DIR = os.path.abspath(os.path.join(SCRIPT_PATH, os.pardir)) | 31 SLAVE_DIR = os.path.abspath(os.path.join(SCRIPT_PATH, os.pardir)) |
32 | 32 |
33 COVERAGE = (lambda: coverage.coverage( | 33 COVERAGE = (lambda: coverage.coverage( |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 coverage_parallel_map(evaluate_configurations) | 139 coverage_parallel_map(evaluate_configurations) |
140 | 140 |
141 retcode = 0 | 141 retcode = 0 |
142 | 142 |
143 COVERAGE.combine() | 143 COVERAGE.combine() |
144 total_covered = COVERAGE.report() | 144 total_covered = COVERAGE.report() |
145 if total_covered != 100.0: | 145 if total_covered != 100.0: |
146 print 'FATAL: Recipes configs are not at 100% coverage.' | 146 print 'FATAL: Recipes configs are not at 100% coverage.' |
147 retcode = 2 | 147 retcode = 2 |
148 | 148 |
149 test_env.print_coverage_warning() | |
150 | |
151 return retcode | 149 return retcode |
152 | 150 |
153 | 151 |
154 if __name__ == '__main__': | 152 if __name__ == '__main__': |
155 sys.exit(main(sys.argv)) | 153 sys.exit(main(sys.argv)) |
OLD | NEW |