Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: tools/mb/mb.py

Issue 2510033004: Add rtc_use_memcheck flag, update MB and GN to handle it, and add gni files listing the runtime deps (Closed)
Patch Set: Fixed android and added unittest. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/mb/mb_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 """MB - the Meta-Build wrapper around GYP and GN 10 """MB - the Meta-Build wrapper around GYP and GN
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 if not ret and self.args.verbose: 1053 if not ret and self.args.verbose:
1054 outp = json.loads(self.ReadFile(self.args.output_path[0])) 1054 outp = json.loads(self.ReadFile(self.args.output_path[0]))
1055 self.Print() 1055 self.Print()
1056 self.Print('analyze output:') 1056 self.Print('analyze output:')
1057 self.PrintJSON(outp) 1057 self.PrintJSON(outp)
1058 self.Print() 1058 self.Print()
1059 1059
1060 return ret 1060 return ret
1061 1061
1062 def GetIsolateCommand(self, target, vals): 1062 def GetIsolateCommand(self, target, vals):
1063 android = 'target_os="android"' in vals['gn_args']
1064
1065 # This needs to mirror the settings in //build/config/ui.gni:
1066 # use_x11 = is_linux && !use_ozone.
1067 use_x11 = (self.platform == 'linux2' and
1068 not android and
1069 not 'use_ozone=true' in vals['gn_args'])
1070
1071 asan = 'is_asan=true' in vals['gn_args']
1072 msan = 'is_msan=true' in vals['gn_args']
1073 tsan = 'is_tsan=true' in vals['gn_args']
1074
1075 isolate_map = self.ReadIsolateMap() 1063 isolate_map = self.ReadIsolateMap()
1076 test_type = isolate_map[target]['type'] 1064 test_type = isolate_map[target]['type']
1077 1065
1078 executable = isolate_map[target].get('executable', target) 1066 android = 'target_os="android"' in vals['gn_args']
1079 executable_suffix = '.exe' if self.platform == 'win32' else '' 1067 is_linux = self.platform == 'linux2' and not android
1080 executable_prefix = '.\\' if self.platform == 'win32' else './'
1081
1082 cmdline = []
1083 extra_files = []
1084 common_cmdline = [
1085 executable_prefix + str(executable) + executable_suffix,
1086 '--',
1087 '--asan=%d' % asan,
1088 '--msan=%d' % msan,
1089 '--tsan=%d' % tsan,
1090 ]
1091 1068
1092 if test_type == 'nontest': 1069 if test_type == 'nontest':
1093 self.WriteFailureAndRaise('We should not be isolating %s.' % target, 1070 self.WriteFailureAndRaise('We should not be isolating %s.' % target,
1094 output_path=None) 1071 output_path=None)
1072 if test_type not in ('console_test_launcher', 'windowed_test_launcher',
1073 'non_parallel_console_test_launcher',
1074 'additional_compile_target', 'junit_test'):
1075 self.WriteFailureAndRaise('No command line for %s found (test type %s).'
1076 % (target, test_type), output_path=None)
1095 1077
1096 if android and test_type != "script": 1078 cmdline = []
1079 extra_files = []
1080
1081 if android:
1097 logdog_command = [ 1082 logdog_command = [
1098 '--logdog-bin-cmd', './../../bin/logdog_butler', 1083 '--logdog-bin-cmd', './../../bin/logdog_butler',
1099 '--project', 'chromium', 1084 '--project', 'chromium',
1100 '--service-account-json', 1085 '--service-account-json',
1101 '/creds/service_accounts/service-account-luci-logdog-publisher.json', 1086 '/creds/service_accounts/service-account-luci-logdog-publisher.json',
1102 '--prefix', 'android/swarming/logcats/${SWARMING_TASK_ID}', 1087 '--prefix', 'android/swarming/logcats/${SWARMING_TASK_ID}',
1103 '--source', '${ISOLATED_OUTDIR}/logcats', 1088 '--source', '${ISOLATED_OUTDIR}/logcats',
1104 '--name', 'unified_logcats', 1089 '--name', 'unified_logcats',
1105 ] 1090 ]
1106 test_cmdline = [ 1091 test_cmdline = [
1107 self.PathJoin('bin', 'run_%s' % target), 1092 self.PathJoin('bin', 'run_%s' % target),
1108 '--logcat-output-file', '${ISOLATED_OUTDIR}/logcats', 1093 '--logcat-output-file', '${ISOLATED_OUTDIR}/logcats',
1109 '--target-devices-file', '${SWARMING_BOT_FILE}', 1094 '--target-devices-file', '${SWARMING_BOT_FILE}',
1110 '-v' 1095 '-v',
1111 ] 1096 ]
1112 cmdline = (['./../../build/android/test_wrapper/logdog_wrapper.py'] 1097 cmdline = (['./../../build/android/test_wrapper/logdog_wrapper.py']
1113 + logdog_command + test_cmdline) 1098 + logdog_command + test_cmdline)
1114 elif use_x11 and test_type == 'windowed_test_launcher': 1099 else:
1115 extra_files = [ 1100 extra_files = ['../../testing/test_env.py']
1116 'xdisplaycheck', 1101
1117 '../../testing/test_env.py', 1102 # This needs to mirror the settings in //build/config/ui.gni:
1118 '../../testing/xvfb.py', 1103 # use_x11 = is_linux && !use_ozone.
1119 '../../third_party/gtest-parallel/gtest-parallel', 1104 use_x11 = is_linux and not 'use_ozone=true' in vals['gn_args']
1120 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', 1105
1106 xvfb = use_x11 and test_type == 'windowed_test_launcher'
1107 if xvfb:
1108 extra_files += [
1109 'xdisplaycheck',
1110 '../../testing/xvfb.py',
1111 ]
1112
1113 # Memcheck is only supported for linux. Ignore in other platforms.
1114 memcheck = is_linux and 'rtc_use_memcheck=true' in vals['gn_args']
1115 memcheck_cmdline = [
1116 'bash',
1117 '../../tools/valgrind-webrtc/webrtc_tests.sh',
1118 '--tool',
1119 'memcheck',
1120 '--target',
1121 'Release',
1122 '--build-dir',
1123 '..',
1124 '--test',
1121 ] 1125 ]
1122 cmdline = [ 1126
1123 '../../testing/xvfb.py', 1127 gtest_parallel = (test_type != 'non_parallel_console_test_launcher' and
1124 '.', 1128 not memcheck)
1125 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', 1129 gtest_parallel_wrapper = [
1126 ] + common_cmdline 1130 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py'
1127 elif test_type in ('windowed_test_launcher', 'console_test_launcher'):
1128 extra_files = [
1129 '../../testing/test_env.py',
1130 '../../third_party/gtest-parallel/gtest-parallel',
1131 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
1132 ] 1131 ]
1133 cmdline = [ 1132 if gtest_parallel:
1134 '../../testing/test_env.py', 1133 extra_files += [
1135 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', 1134 '../../third_party/gtest-parallel/gtest-parallel',
1136 ] + common_cmdline 1135 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py',
1137 elif test_type == 'non_parallel_console_test_launcher': 1136 ]
1138 extra_files = [ 1137
1139 '../../testing/test_env.py', 1138 asan = 'is_asan=true' in vals['gn_args']
1139 msan = 'is_msan=true' in vals['gn_args']
1140 tsan = 'is_tsan=true' in vals['gn_args']
1141
1142 executable_prefix = '.\\' if self.platform == 'win32' else './'
1143 executable_suffix = '.exe' if self.platform == 'win32' else ''
1144 executable = executable_prefix + target + executable_suffix
1145
1146 cmdline = (['../../testing/xvfb.py', '.'] if xvfb else
1147 ['../../testing/test_env.py'])
1148 if memcheck:
1149 cmdline += memcheck_cmdline
1150 elif gtest_parallel:
1151 cmdline += gtest_parallel_wrapper
1152 cmdline += [
1153 executable,
1154 '--',
1155 '--asan=%d' % asan,
1156 '--msan=%d' % msan,
1157 '--tsan=%d' % tsan,
1140 ] 1158 ]
1141 cmdline = [
1142 '../../testing/test_env.py',
1143 ] + common_cmdline
1144 else:
1145 self.WriteFailureAndRaise('No command line for %s found (test type %s).'
1146 % (target, test_type), output_path=None)
1147
1148 cmdline += isolate_map[target].get('args', [])
1149 1159
1150 return cmdline, extra_files 1160 return cmdline, extra_files
1151 1161
1152 def ToAbsPath(self, build_path, *comps): 1162 def ToAbsPath(self, build_path, *comps):
1153 return self.PathJoin(self.chromium_src_dir, 1163 return self.PathJoin(self.chromium_src_dir,
1154 self.ToSrcRelPath(build_path), 1164 self.ToSrcRelPath(build_path),
1155 *comps) 1165 *comps)
1156 1166
1157 def ToSrcRelPath(self, path): 1167 def ToSrcRelPath(self, path):
1158 """Returns a relative path from the top of the repo.""" 1168 """Returns a relative path from the top of the repo."""
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 # Then check to see if the arg contains any metacharacters other than 1563 # Then check to see if the arg contains any metacharacters other than
1554 # double quotes; if it does, quote everything (including the double 1564 # double quotes; if it does, quote everything (including the double
1555 # quotes) for safety. 1565 # quotes) for safety.
1556 if any(a in UNSAFE_FOR_CMD for a in arg): 1566 if any(a in UNSAFE_FOR_CMD for a in arg):
1557 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) 1567 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg)
1558 return arg 1568 return arg
1559 1569
1560 1570
1561 if __name__ == '__main__': 1571 if __name__ == '__main__':
1562 sys.exit(main(sys.argv[1:])) 1572 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tools/mb/mb_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698