| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """MB - the Meta-Build wrapper around GYP and GN | 6 """MB - the Meta-Build wrapper around GYP and GN |
| 7 | 7 |
| 8 MB is a wrapper script for GYP and GN that can be used to generate build files | 8 MB is a wrapper script for GYP and GN that can be used to generate build files |
| 9 for sets of canned configurations and analyze them. | 9 for sets of canned configurations and analyze them. |
| 10 """ | 10 """ |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 # "_apk" targets may be either android_apk or executable. The former | 538 # "_apk" targets may be either android_apk or executable. The former |
| 539 # will result in runtime_deps associated with the stamp file, while the | 539 # will result in runtime_deps associated with the stamp file, while the |
| 540 # latter will result in runtime_deps associated with the executable. | 540 # latter will result in runtime_deps associated with the executable. |
| 541 target_name = self.GNTargetName(target) | 541 target_name = self.GNTargetName(target) |
| 542 label = gn_isolate_map[target_name]['label'] | 542 label = gn_isolate_map[target_name]['label'] |
| 543 runtime_deps_targets = [ | 543 runtime_deps_targets = [ |
| 544 target_name, | 544 target_name, |
| 545 'obj/%s.stamp' % label.replace(':', '/')] | 545 'obj/%s.stamp' % label.replace(':', '/')] |
| 546 elif gn_isolate_map[target]['type'] == 'gpu_browser_test': | 546 elif gn_isolate_map[target]['type'] == 'gpu_browser_test': |
| 547 runtime_deps_targets = ['browser_tests'] | 547 runtime_deps_targets = ['browser_tests'] |
| 548 elif gn_isolate_map[target]['type'] == 'script': | 548 elif (gn_isolate_map[target]['type'] == 'script' or |
| 549 gn_isolate_map[target].get('label_type') == 'group'): |
| 549 # For script targets, the build target is usually a group, | 550 # For script targets, the build target is usually a group, |
| 550 # for which gn generates the runtime_deps next to the stamp file | 551 # for which gn generates the runtime_deps next to the stamp file |
| 551 # for the label, which lives under the obj/ directory. | 552 # for the label, which lives under the obj/ directory. |
| 552 label = gn_isolate_map[target]['label'] | 553 label = gn_isolate_map[target]['label'] |
| 553 runtime_deps_targets = ['obj/%s.stamp' % label.replace(':', '/')] | 554 runtime_deps_targets = ['obj/%s.stamp' % label.replace(':', '/')] |
| 554 else: | 555 else: |
| 555 runtime_deps_targets = [target] | 556 runtime_deps_targets = [target] |
| 556 | 557 |
| 557 if self.platform == 'win32': | 558 if self.platform == 'win32': |
| 558 deps_paths = [ | 559 deps_paths = [ |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 # use_x11 = is_linux && !use_ozone. | 693 # use_x11 = is_linux && !use_ozone. |
| 693 # TODO(dpranke): Figure out how to keep this in sync better. | 694 # TODO(dpranke): Figure out how to keep this in sync better. |
| 694 use_x11 = (self.platform == 'linux2' and | 695 use_x11 = (self.platform == 'linux2' and |
| 695 not android and | 696 not android and |
| 696 not 'use_ozone=true' in vals['gn_args']) | 697 not 'use_ozone=true' in vals['gn_args']) |
| 697 | 698 |
| 698 asan = 'is_asan=true' in vals['gn_args'] | 699 asan = 'is_asan=true' in vals['gn_args'] |
| 699 msan = 'is_msan=true' in vals['gn_args'] | 700 msan = 'is_msan=true' in vals['gn_args'] |
| 700 tsan = 'is_tsan=true' in vals['gn_args'] | 701 tsan = 'is_tsan=true' in vals['gn_args'] |
| 701 | 702 |
| 703 target_name = self.GNTargetName(target) |
| 704 test_type = gn_isolate_map[target_name]['type'] |
| 705 |
| 706 executable = gn_isolate_map[target_name].get('executable', target_name) |
| 702 executable_suffix = '.exe' if self.platform == 'win32' else '' | 707 executable_suffix = '.exe' if self.platform == 'win32' else '' |
| 703 | 708 |
| 704 target_name = self.GNTargetName(target) | |
| 705 test_type = gn_isolate_map[target_name]['type'] | |
| 706 cmdline = [] | 709 cmdline = [] |
| 707 extra_files = [] | 710 extra_files = [] |
| 708 | 711 |
| 709 if android: | 712 if android: |
| 710 # TODO(jbudorick): This won't work with instrumentation test targets. | 713 # TODO(jbudorick): This won't work with instrumentation test targets. |
| 711 # Revisit this logic when those are added to gn_isolate_map.pyl. | 714 # Revisit this logic when those are added to gn_isolate_map.pyl. |
| 712 cmdline = [self.PathJoin('bin', 'run_%s' % target_name)] | 715 cmdline = [self.PathJoin('bin', 'run_%s' % target_name)] |
| 713 elif use_x11 and test_type == 'windowed_test_launcher': | 716 elif use_x11 and test_type == 'windowed_test_launcher': |
| 714 extra_files = [ | 717 extra_files = [ |
| 715 'xdisplaycheck', | 718 'xdisplaycheck', |
| 716 '../../testing/test_env.py', | 719 '../../testing/test_env.py', |
| 717 '../../testing/xvfb.py', | 720 '../../testing/xvfb.py', |
| 718 ] | 721 ] |
| 719 cmdline = [ | 722 cmdline = [ |
| 720 '../../testing/xvfb.py', | 723 '../../testing/xvfb.py', |
| 721 '.', | 724 '.', |
| 722 './' + str(target), | 725 './' + str(executable) + executable_suffix, |
| 723 '--brave-new-test-launcher', | 726 '--brave-new-test-launcher', |
| 724 '--test-launcher-bot-mode', | 727 '--test-launcher-bot-mode', |
| 725 '--asan=%d' % asan, | 728 '--asan=%d' % asan, |
| 726 '--msan=%d' % msan, | 729 '--msan=%d' % msan, |
| 727 '--tsan=%d' % tsan, | 730 '--tsan=%d' % tsan, |
| 728 ] | 731 ] |
| 729 elif test_type in ('windowed_test_launcher', 'console_test_launcher'): | 732 elif test_type in ('windowed_test_launcher', 'console_test_launcher'): |
| 730 extra_files = [ | 733 extra_files = [ |
| 731 '../../testing/test_env.py' | 734 '../../testing/test_env.py' |
| 732 ] | 735 ] |
| 733 cmdline = [ | 736 cmdline = [ |
| 734 '../../testing/test_env.py', | 737 '../../testing/test_env.py', |
| 735 './' + str(target) + executable_suffix, | 738 './' + str(executable) + executable_suffix, |
| 736 '--brave-new-test-launcher', | 739 '--brave-new-test-launcher', |
| 737 '--test-launcher-bot-mode', | 740 '--test-launcher-bot-mode', |
| 738 '--asan=%d' % asan, | 741 '--asan=%d' % asan, |
| 739 '--msan=%d' % msan, | 742 '--msan=%d' % msan, |
| 740 '--tsan=%d' % tsan, | 743 '--tsan=%d' % tsan, |
| 741 ] | 744 ] |
| 742 elif test_type == 'gpu_browser_test': | 745 elif test_type == 'gpu_browser_test': |
| 743 extra_files = [ | 746 extra_files = [ |
| 744 '../../testing/test_env.py' | 747 '../../testing/test_env.py' |
| 745 ] | 748 ] |
| 746 gtest_filter = gn_isolate_map[target]['gtest_filter'] | 749 gtest_filter = gn_isolate_map[target]['gtest_filter'] |
| 747 cmdline = [ | 750 cmdline = [ |
| 748 '../../testing/test_env.py', | 751 '../../testing/test_env.py', |
| 749 './browser_tests' + executable_suffix, | 752 './browser_tests' + executable_suffix, |
| 750 '--test-launcher-bot-mode', | 753 '--test-launcher-bot-mode', |
| 751 '--enable-gpu', | 754 '--enable-gpu', |
| 752 '--test-launcher-jobs=1', | 755 '--test-launcher-jobs=1', |
| 753 '--gtest_filter=%s' % gtest_filter, | 756 '--gtest_filter=%s' % gtest_filter, |
| 754 ] | 757 ] |
| 755 elif test_type == 'script': | 758 elif test_type == 'script': |
| 756 extra_files = [ | 759 extra_files = [ |
| 757 '../../testing/test_env.py' | 760 '../../testing/test_env.py' |
| 758 ] | 761 ] |
| 759 cmdline = [ | 762 cmdline = [ |
| 760 '../../testing/test_env.py', | 763 '../../testing/test_env.py', |
| 761 '../../' + self.ToSrcRelPath(gn_isolate_map[target]['script']) | 764 '../../' + self.ToSrcRelPath(gn_isolate_map[target]['script']) |
| 762 ] + gn_isolate_map[target].get('args', []) | 765 ] |
| 763 elif test_type in ('raw'): | 766 elif test_type in ('raw'): |
| 764 extra_files = [] | 767 extra_files = [] |
| 765 cmdline = [ | 768 cmdline = [ |
| 766 './' + str(target) + executable_suffix, | 769 './' + str(target) + executable_suffix, |
| 767 ] + gn_isolate_map[target].get('args') | 770 ] |
| 768 | 771 |
| 769 else: | 772 else: |
| 770 self.WriteFailureAndRaise('No command line for %s found (test type %s).' | 773 self.WriteFailureAndRaise('No command line for %s found (test type %s).' |
| 771 % (target, test_type), output_path=None) | 774 % (target, test_type), output_path=None) |
| 772 | 775 |
| 776 cmdline += gn_isolate_map[target].get('args', []) |
| 777 |
| 773 return cmdline, extra_files | 778 return cmdline, extra_files |
| 774 | 779 |
| 775 def ToAbsPath(self, build_path, *comps): | 780 def ToAbsPath(self, build_path, *comps): |
| 776 return self.PathJoin(self.chromium_src_dir, | 781 return self.PathJoin(self.chromium_src_dir, |
| 777 self.ToSrcRelPath(build_path), | 782 self.ToSrcRelPath(build_path), |
| 778 *comps) | 783 *comps) |
| 779 | 784 |
| 780 def ToSrcRelPath(self, path): | 785 def ToSrcRelPath(self, path): |
| 781 """Returns a relative path from the top of the repo.""" | 786 """Returns a relative path from the top of the repo.""" |
| 782 # TODO: Support normal paths in addition to source-absolute paths. | 787 # TODO: Support normal paths in addition to source-absolute paths. |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 | 1120 |
| 1116 if __name__ == '__main__': | 1121 if __name__ == '__main__': |
| 1117 try: | 1122 try: |
| 1118 sys.exit(main(sys.argv[1:])) | 1123 sys.exit(main(sys.argv[1:])) |
| 1119 except MBErr as e: | 1124 except MBErr as e: |
| 1120 print(e) | 1125 print(e) |
| 1121 sys.exit(1) | 1126 sys.exit(1) |
| 1122 except KeyboardInterrupt: | 1127 except KeyboardInterrupt: |
| 1123 print("interrupted, exiting", stream=sys.stderr) | 1128 print("interrupted, exiting", stream=sys.stderr) |
| 1124 sys.exit(130) | 1129 sys.exit(130) |
| OLD | NEW |