OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Generate and process code coverage. | 6 """Generate and process code coverage. |
7 | 7 |
8 TODO(jrg): rename this from coverage_posix.py to coverage_all.py! | 8 TODO(jrg): rename this from coverage_posix.py to coverage_all.py! |
9 | 9 |
10 Written for and tested on Mac, Linux, and Windows. To use this script | 10 Written for and tested on Mac, Linux, and Windows. To use this script |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 '*OldDetachedPanelBrowserTest.*', | 237 '*OldDetachedPanelBrowserTest.*', |
238 'PanelDragBrowserTest.AttachWithSqueeze', | 238 'PanelDragBrowserTest.AttachWithSqueeze', |
239 '*PanelBrowserTest.*', | 239 '*PanelBrowserTest.*', |
240 '*DockedPanelBrowserTest.*', | 240 '*DockedPanelBrowserTest.*', |
241 '*DetachedPanelBrowserTest.*',), | 241 '*DetachedPanelBrowserTest.*',), |
242 'automated_ui_tests': | 242 'automated_ui_tests': |
243 ('AutomatedUITest.TheOneAndOnlyTest', | 243 ('AutomatedUITest.TheOneAndOnlyTest', |
244 'AutomatedUITestBase.DragOut',), }, | 244 'AutomatedUITestBase.DragOut',), }, |
245 } | 245 } |
246 | 246 |
| 247 """Since random tests are failing/hanging on coverage bot, we are enabling |
| 248 tests feature by feature. crbug.com/159748 |
| 249 Below are the downloads related tests enabled. |
| 250 SavePageBrowserTest.* |
| 251 SavePageAsMHTMLBrowserTest.* |
| 252 DownloadQueryTest.* |
| 253 DownloadDangerPromptTest.* |
| 254 DownloadTest.* |
| 255 """ |
| 256 gTestInclusions = { |
| 257 'linux2': { |
| 258 'browser_tests': |
| 259 ('SavePageBrowserTest.*', |
| 260 'SavePageAsMHTMLBrowserTest.*', |
| 261 'DownloadQueryTest.*', |
| 262 'DownloadDangerPromptTest.*', |
| 263 'DownloadTest.*',), |
| 264 }, |
| 265 } |
| 266 |
247 | 267 |
248 def TerminateSignalHandler(sig, stack): | 268 def TerminateSignalHandler(sig, stack): |
249 """When killed, try and kill our child processes.""" | 269 """When killed, try and kill our child processes.""" |
250 signal.signal(sig, signal.SIG_DFL) | 270 signal.signal(sig, signal.SIG_DFL) |
251 for pid in gChildPIDs: | 271 for pid in gChildPIDs: |
252 if 'kill' in os.__all__: # POSIX | 272 if 'kill' in os.__all__: # POSIX |
253 os.kill(pid, sig) | 273 os.kill(pid, sig) |
254 else: | 274 else: |
255 subprocess.call(['taskkill.exe', '/PID', str(pid)]) | 275 subprocess.call(['taskkill.exe', '/PID', str(pid)]) |
256 sys.exit(0) | 276 sys.exit(0) |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 796 |
777 if not self.options.no_exclusions: | 797 if not self.options.no_exclusions: |
778 exclusions = excl or gTestExclusions | 798 exclusions = excl or gTestExclusions |
779 excldict = exclusions.get(sys.platform) | 799 excldict = exclusions.get(sys.platform) |
780 if excldict: | 800 if excldict: |
781 for test in excldict.keys(): | 801 for test in excldict.keys(): |
782 # example: if base_unittests in ../blah/blah/base_unittests.exe | 802 # example: if base_unittests in ../blah/blah/base_unittests.exe |
783 if test in fulltest: | 803 if test in fulltest: |
784 negative_gfilter_list += excldict[test] | 804 negative_gfilter_list += excldict[test] |
785 | 805 |
| 806 inclusions = gTestInclusions |
| 807 include_dict = inclusions.get(sys.platform) |
| 808 if include_dict: |
| 809 for test in include_dict.keys(): |
| 810 if test in fulltest: |
| 811 positive_gfilter_list += include_dict[test] |
| 812 |
786 fulltest_basename = os.path.basename(fulltest) | 813 fulltest_basename = os.path.basename(fulltest) |
787 if fulltest_basename in self.test_filters: | 814 if fulltest_basename in self.test_filters: |
788 specific_test_filters = self.test_filters[fulltest_basename].split('-') | 815 specific_test_filters = self.test_filters[fulltest_basename].split('-') |
789 if len(specific_test_filters) > 2: | 816 if len(specific_test_filters) > 2: |
790 logging.error('Multiple "-" symbols in filter list: %s' % | 817 logging.error('Multiple "-" symbols in filter list: %s' % |
791 self.test_filters[fulltest_basename]) | 818 self.test_filters[fulltest_basename]) |
792 raise BadUserInput() | 819 raise BadUserInput() |
793 if len(specific_test_filters) == 2: | 820 if len(specific_test_filters) == 2: |
794 # Remove trailing ':' | 821 # Remove trailing ':' |
795 specific_test_filters[0] = specific_test_filters[0][:-1] | 822 specific_test_filters[0] = specific_test_filters[0][:-1] |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 if options.trim: | 1167 if options.trim: |
1141 coverage.TrimTests() | 1168 coverage.TrimTests() |
1142 coverage.RunTests() | 1169 coverage.RunTests() |
1143 if options.genhtml: | 1170 if options.genhtml: |
1144 coverage.GenerateHtml() | 1171 coverage.GenerateHtml() |
1145 return 0 | 1172 return 0 |
1146 | 1173 |
1147 | 1174 |
1148 if __name__ == '__main__': | 1175 if __name__ == '__main__': |
1149 sys.exit(main()) | 1176 sys.exit(main()) |
OLD | NEW |