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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 self.WriteFailureAndRaise('No command line for %s found (test type %s).' |
| 1075 % (target, test_type), output_path=None) |
1095 | 1076 |
1096 if android and test_type != "script": | 1077 if android: |
1097 logdog_command = [ | 1078 logdog_command = [ |
1098 '--logdog-bin-cmd', './../../bin/logdog_butler', | 1079 '--logdog-bin-cmd', './../../bin/logdog_butler', |
1099 '--project', 'chromium', | 1080 '--project', 'chromium', |
1100 '--service-account-json', | 1081 '--service-account-json', |
1101 '/creds/service_accounts/service-account-luci-logdog-publisher.json', | 1082 '/creds/service_accounts/service-account-luci-logdog-publisher.json', |
1102 '--prefix', 'android/swarming/logcats/${SWARMING_TASK_ID}', | 1083 '--prefix', 'android/swarming/logcats/${SWARMING_TASK_ID}', |
1103 '--source', '${ISOLATED_OUTDIR}/logcats', | 1084 '--source', '${ISOLATED_OUTDIR}/logcats', |
1104 '--name', 'unified_logcats', | 1085 '--name', 'unified_logcats', |
1105 ] | 1086 ] |
1106 test_cmdline = [ | 1087 test_cmdline = [ |
1107 self.PathJoin('bin', 'run_%s' % target), | 1088 self.PathJoin('bin', 'run_%s' % target), |
1108 '--logcat-output-file', '${ISOLATED_OUTDIR}/logcats', | 1089 '--logcat-output-file', '${ISOLATED_OUTDIR}/logcats', |
1109 '--target-devices-file', '${SWARMING_BOT_FILE}', | 1090 '--target-devices-file', '${SWARMING_BOT_FILE}', |
1110 '-v' | 1091 '-v' |
1111 ] | 1092 ] |
1112 cmdline = (['./../../build/android/test_wrapper/logdog_wrapper.py'] | 1093 cmdline = (['./../../build/android/test_wrapper/logdog_wrapper.py'] |
1113 + logdog_command + test_cmdline) | 1094 + logdog_command + test_cmdline) |
1114 elif use_x11 and test_type == 'windowed_test_launcher': | 1095 else: |
1115 extra_files = [ | 1096 extra_files = ['../../testing/test_env.py'] |
1116 'xdisplaycheck', | 1097 |
1117 '../../testing/test_env.py', | 1098 # This needs to mirror the settings in //build/config/ui.gni: |
1118 '../../testing/xvfb.py', | 1099 # use_x11 = is_linux && !use_ozone. |
1119 '../../third_party/gtest-parallel/gtest-parallel', | 1100 use_x11 = is_linux and not 'use_ozone=true' in vals['gn_args'] |
1120 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', | 1101 |
| 1102 xvfb = use_x11 and test_type == 'windowed_test_launcher' |
| 1103 if xvfb: |
| 1104 extra_files += [ |
| 1105 'xdisplaycheck', |
| 1106 '../../testing/xvfb.py', |
| 1107 ] |
| 1108 |
| 1109 # Memcheck is only supported for linux. Ignore in other platforms. |
| 1110 memcheck = is_linux and 'rtc_use_memcheck=true' in vals['gn_args'] |
| 1111 memcheck_cmdline = [ |
| 1112 'bash', |
| 1113 '../../tools/valgrind-webrtc/webrtc_tests.sh', |
| 1114 '--tool', |
| 1115 'memcheck', |
| 1116 '--target', |
| 1117 'Release', |
| 1118 '--build-dir', |
| 1119 '..', |
| 1120 '--test', |
1121 ] | 1121 ] |
1122 cmdline = [ | 1122 |
1123 '../../testing/xvfb.py', | 1123 gtest_parallel = (test_type != 'non_parallel_console_test_launcher' and |
1124 '.', | 1124 not memcheck) |
1125 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', | 1125 gtest_parallel_wrapper = [ |
1126 ] + common_cmdline | 1126 '../../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 ] | 1127 ] |
1133 cmdline = [ | 1128 if gtest_parallel: |
1134 '../../testing/test_env.py', | 1129 extra_files += [ |
1135 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', | 1130 '../../third_party/gtest-parallel/gtest-parallel', |
1136 ] + common_cmdline | 1131 '../../third_party/gtest-parallel/gtest-parallel-wrapper.py', |
1137 elif test_type == 'non_parallel_console_test_launcher': | 1132 ] |
1138 extra_files = [ | 1133 |
1139 '../../testing/test_env.py', | 1134 asan = 'is_asan=true' in vals['gn_args'] |
| 1135 msan = 'is_msan=true' in vals['gn_args'] |
| 1136 tsan = 'is_tsan=true' in vals['gn_args'] |
| 1137 |
| 1138 executable_prefix = '.\\' if self.platform == 'win32' else './' |
| 1139 executable_suffix = '.exe' if self.platform == 'win32' else '' |
| 1140 executable = executable_prefix + target + executable_suffix |
| 1141 |
| 1142 cmdline = (['../../testing/xvfb.py', '.'] if xvfb else |
| 1143 ['../../testing/test_env.py']) |
| 1144 if memcheck: |
| 1145 cmdline += memcheck_cmdline |
| 1146 elif gtest_parallel: |
| 1147 cmdline += gtest_parallel_wrapper |
| 1148 cmdline += [ |
| 1149 executable, |
| 1150 '--', |
| 1151 '--asan=%d' % asan, |
| 1152 '--msan=%d' % msan, |
| 1153 '--tsan=%d' % tsan, |
1140 ] | 1154 ] |
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 | 1155 |
1150 return cmdline, extra_files | 1156 return cmdline, extra_files |
1151 | 1157 |
1152 def ToAbsPath(self, build_path, *comps): | 1158 def ToAbsPath(self, build_path, *comps): |
1153 return self.PathJoin(self.chromium_src_dir, | 1159 return self.PathJoin(self.chromium_src_dir, |
1154 self.ToSrcRelPath(build_path), | 1160 self.ToSrcRelPath(build_path), |
1155 *comps) | 1161 *comps) |
1156 | 1162 |
1157 def ToSrcRelPath(self, path): | 1163 def ToSrcRelPath(self, path): |
1158 """Returns a relative path from the top of the repo.""" | 1164 """Returns a relative path from the top of the repo.""" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 # Then check to see if the arg contains any metacharacters other than | 1559 # Then check to see if the arg contains any metacharacters other than |
1554 # double quotes; if it does, quote everything (including the double | 1560 # double quotes; if it does, quote everything (including the double |
1555 # quotes) for safety. | 1561 # quotes) for safety. |
1556 if any(a in UNSAFE_FOR_CMD for a in arg): | 1562 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) | 1563 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
1558 return arg | 1564 return arg |
1559 | 1565 |
1560 | 1566 |
1561 if __name__ == '__main__': | 1567 if __name__ == '__main__': |
1562 sys.exit(main(sys.argv[1:])) | 1568 sys.exit(main(sys.argv[1:])) |
OLD | NEW |