OLD | NEW |
---|---|
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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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'] | 1063 android = 'target_os="android"' in vals['gn_args'] |
1064 is_linux = self.platform == 'linux2' and not android | |
1065 | |
1066 # Memcheck is only supported for linux. Ignore in other platforms. | |
1067 memcheck = is_linux and 'rtc_use_memcheck=true' in vals['gn_args'] | |
1064 | 1068 |
1065 # This needs to mirror the settings in //build/config/ui.gni: | 1069 # This needs to mirror the settings in //build/config/ui.gni: |
1066 # use_x11 = is_linux && !use_ozone. | 1070 # use_x11 = is_linux && !use_ozone. |
1067 use_x11 = (self.platform == 'linux2' and | 1071 use_x11 = is_linux and not 'use_ozone=true' in vals['gn_args'] |
kjellander_webrtc
2016/11/21 08:33:59
Ouch, so there's logic in here that will change th
ehmaldonado_webrtc
2016/11/21 10:51:55
No, this doesn't override the logic in the GN vari
ehmaldonado_webrtc
2016/11/21 11:02:07
So, MB only has access to the GN flags that we pas
| |
1068 not android and | |
1069 not 'use_ozone=true' in vals['gn_args']) | |
1070 | 1072 |
1071 asan = 'is_asan=true' in vals['gn_args'] | 1073 asan = 'is_asan=true' in vals['gn_args'] |
1072 msan = 'is_msan=true' in vals['gn_args'] | 1074 msan = 'is_msan=true' in vals['gn_args'] |
1073 tsan = 'is_tsan=true' in vals['gn_args'] | 1075 tsan = 'is_tsan=true' in vals['gn_args'] |
1074 | 1076 |
1075 isolate_map = self.ReadIsolateMap() | 1077 isolate_map = self.ReadIsolateMap() |
1076 test_type = isolate_map[target]['type'] | 1078 test_type = isolate_map[target]['type'] |
1077 | 1079 |
1078 executable = isolate_map[target].get('executable', target) | 1080 executable = isolate_map[target].get('executable', target) |
1079 executable_suffix = '.exe' if self.platform == 'win32' else '' | 1081 executable_suffix = '.exe' if self.platform == 'win32' else '' |
1080 executable_prefix = '.\\' if self.platform == 'win32' else './' | 1082 executable_prefix = '.\\' if self.platform == 'win32' else './' |
1081 | 1083 |
1082 cmdline = [] | 1084 cmdline = [] |
1083 extra_files = [] | 1085 extra_files = [] |
1086 | |
1087 gtest_cmdline = [ | |
1088 'python', | |
1089 '../../third_party/gtest-parallel/gtest-parallel', | |
1090 ] | |
1091 memcheck_cmdline = [ | |
1092 'bash', | |
1093 '../../tools/valgrind-webrtc/webrtc_tests.sh', | |
1094 '--tool', | |
1095 'memcheck', | |
1096 '--target', | |
1097 'Release', | |
1098 '--build-dir', | |
1099 '..', | |
1100 '--test', | |
1101 ] | |
1084 common_cmdline = [ | 1102 common_cmdline = [ |
1085 executable_prefix + str(executable) + executable_suffix, | 1103 executable_prefix + str(executable) + executable_suffix, |
1086 '--', | 1104 '--', |
1087 '--asan=%d' % asan, | 1105 '--asan=%d' % asan, |
1088 '--msan=%d' % msan, | 1106 '--msan=%d' % msan, |
1089 '--tsan=%d' % tsan, | 1107 '--tsan=%d' % tsan, |
1090 ] | 1108 ] |
1091 | 1109 |
1092 if test_type == 'nontest': | 1110 if test_type == 'nontest': |
1093 self.WriteFailureAndRaise('We should not be isolating %s.' % target, | 1111 self.WriteFailureAndRaise('We should not be isolating %s.' % target, |
(...skipping 20 matching lines...) Expand all Loading... | |
1114 elif use_x11 and test_type == 'windowed_test_launcher': | 1132 elif use_x11 and test_type == 'windowed_test_launcher': |
1115 extra_files = [ | 1133 extra_files = [ |
1116 'xdisplaycheck', | 1134 'xdisplaycheck', |
1117 '../../testing/test_env.py', | 1135 '../../testing/test_env.py', |
1118 '../../testing/xvfb.py', | 1136 '../../testing/xvfb.py', |
1119 '../../third_party/gtest-parallel/gtest-parallel', | 1137 '../../third_party/gtest-parallel/gtest-parallel', |
1120 ] | 1138 ] |
1121 cmdline = [ | 1139 cmdline = [ |
1122 '../../testing/xvfb.py', | 1140 '../../testing/xvfb.py', |
1123 '.', | 1141 '.', |
1124 'python', | 1142 ] |
1125 '../../third_party/gtest-parallel/gtest-parallel', | 1143 if memcheck: |
kjellander_webrtc
2016/11/21 08:33:58
There must be a way to avoid duplicating this sect
| |
1126 ] + common_cmdline | 1144 cmdline += memcheck_cmdline |
1145 else: | |
1146 cmdline += gtest_cmdline | |
1147 cmdline += common_cmdline | |
1127 elif test_type in ('windowed_test_launcher', 'console_test_launcher'): | 1148 elif test_type in ('windowed_test_launcher', 'console_test_launcher'): |
1128 extra_files = [ | 1149 extra_files = [ |
1129 '../../testing/test_env.py', | 1150 '../../testing/test_env.py', |
1130 '../../third_party/gtest-parallel/gtest-parallel', | 1151 '../../third_party/gtest-parallel/gtest-parallel', |
1131 ] | 1152 ] |
1132 cmdline = [ | 1153 cmdline = [ '../../testing/test_env.py' ] |
1133 '../../testing/test_env.py', | 1154 if memcheck: |
kjellander_webrtc
2016/11/21 08:33:58
You could write this on just one line:
cmdline +=
| |
1134 'python', | 1155 cmdline += memcheck_cmdline |
1135 '../../third_party/gtest-parallel/gtest-parallel', | 1156 else: |
1136 ] + common_cmdline | 1157 cmdline += gtest_cmdline |
1158 cmdline += common_cmdline | |
1137 elif test_type == 'non_parallel_console_test_launcher': | 1159 elif test_type == 'non_parallel_console_test_launcher': |
1138 extra_files = [ | 1160 extra_files = [ |
1139 '../../testing/test_env.py', | 1161 '../../testing/test_env.py', |
1140 ] | 1162 ] |
1141 cmdline = [ | 1163 cmdline = [ |
1142 '../../testing/test_env.py', | 1164 '../../testing/test_env.py', |
1143 ] + common_cmdline | 1165 ] |
1166 if memcheck: | |
1167 cmdline += memcheck_cmdline | |
1168 cmdline += common_cmdline | |
1144 else: | 1169 else: |
1145 self.WriteFailureAndRaise('No command line for %s found (test type %s).' | 1170 self.WriteFailureAndRaise('No command line for %s found (test type %s).' |
1146 % (target, test_type), output_path=None) | 1171 % (target, test_type), output_path=None) |
1147 | 1172 |
1148 cmdline += isolate_map[target].get('args', []) | 1173 cmdline += isolate_map[target].get('args', []) |
1149 | 1174 |
1150 return cmdline, extra_files | 1175 return cmdline, extra_files |
1151 | 1176 |
1152 def ToAbsPath(self, build_path, *comps): | 1177 def ToAbsPath(self, build_path, *comps): |
1153 return self.PathJoin(self.chromium_src_dir, | 1178 return self.PathJoin(self.chromium_src_dir, |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1553 # Then check to see if the arg contains any metacharacters other than | 1578 # Then check to see if the arg contains any metacharacters other than |
1554 # double quotes; if it does, quote everything (including the double | 1579 # double quotes; if it does, quote everything (including the double |
1555 # quotes) for safety. | 1580 # quotes) for safety. |
1556 if any(a in UNSAFE_FOR_CMD for a in arg): | 1581 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) | 1582 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
1558 return arg | 1583 return arg |
1559 | 1584 |
1560 | 1585 |
1561 if __name__ == '__main__': | 1586 if __name__ == '__main__': |
1562 sys.exit(main(sys.argv[1:])) | 1587 sys.exit(main(sys.argv[1:])) |
OLD | NEW |