Christoffer Jansson | 4e8a773 | 2022-02-08 09:01:12 +0100 | [diff] [blame] | 1 | #!/usr/bin/env vpython3 |
| 2 | |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 3 | # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 4 | # |
| 5 | # Use of this source code is governed by a BSD-style license |
| 6 | # that can be found in the LICENSE file in the root of the source |
| 7 | # tree. An additional intellectual property rights grant can be found |
| 8 | # in the file PATENTS. All contributing project authors may |
| 9 | # be found in the AUTHORS file in the root of the source tree. |
| 10 | |
| 11 | """Tests for mb.py.""" |
| 12 | |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 13 | import ast |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 14 | import os |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 15 | import re |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 16 | import sys |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 17 | import tempfile |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 18 | import unittest |
| 19 | |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 20 | _SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 21 | _SRC_DIR = os.path.dirname(os.path.dirname(_SCRIPT_DIR)) |
| 22 | sys.path.insert(0, _SRC_DIR) |
| 23 | |
| 24 | from tools_webrtc.mb import mb |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 25 | |
| 26 | |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 27 | class FakeMBW(mb.WebRTCMetaBuildWrapper): |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 28 | def __init__(self, win32=False): |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 29 | super().__init__() |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 30 | |
| 31 | # Override vars for test portability. |
| 32 | if win32: |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 33 | self.chromium_src_dir = 'c:\\fake_src' |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 34 | self.default_config = 'c:\\fake_src\\tools_webrtc\\mb\\mb_config.pyl' |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 35 | self.default_isolate_map = ('c:\\fake_src\\testing\\buildbot\\' |
| 36 | 'gn_isolate_map.pyl') |
| 37 | self.platform = 'win32' |
Christoffer Jansson | 4e8a773 | 2022-02-08 09:01:12 +0100 | [diff] [blame] | 38 | self.executable = 'c:\\python\\vpython3.exe' |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 39 | self.sep = '\\' |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 40 | self.cwd = 'c:\\fake_src\\out\\Default' |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 41 | else: |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 42 | self.chromium_src_dir = '/fake_src' |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 43 | self.default_config = '/fake_src/tools_webrtc/mb/mb_config.pyl' |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 44 | self.default_isolate_map = '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
Christoffer Jansson | 4e8a773 | 2022-02-08 09:01:12 +0100 | [diff] [blame] | 45 | self.executable = '/usr/bin/vpython3' |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 46 | self.platform = 'linux2' |
| 47 | self.sep = '/' |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 48 | self.cwd = '/fake_src/out/Default' |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 49 | |
| 50 | self.files = {} |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 51 | self.dirs = set() |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 52 | self.calls = [] |
| 53 | self.cmds = [] |
| 54 | self.cross_compile = None |
| 55 | self.out = '' |
| 56 | self.err = '' |
| 57 | self.rmdirs = [] |
| 58 | |
| 59 | def ExpandUser(self, path): |
Jeremy Leconte | e288161 | 2022-04-19 14:03:35 +0200 | [diff] [blame] | 60 | # pylint: disable=no-self-use |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 61 | return '$HOME/%s' % path |
| 62 | |
| 63 | def Exists(self, path): |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 64 | abs_path = self._AbsPath(path) |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 65 | return self.files.get(abs_path) is not None or abs_path in self.dirs |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 66 | |
| 67 | def ListDir(self, path): |
| 68 | dir_contents = [] |
| 69 | for f in list(self.files.keys()) + list(self.dirs): |
| 70 | head, _ = os.path.split(f) |
| 71 | if head == path: |
| 72 | dir_contents.append(f) |
| 73 | return dir_contents |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 74 | |
| 75 | def MaybeMakeDirectory(self, path): |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 76 | abpath = self._AbsPath(path) |
| 77 | self.dirs.add(abpath) |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 78 | |
| 79 | def PathJoin(self, *comps): |
| 80 | return self.sep.join(comps) |
| 81 | |
| 82 | def ReadFile(self, path): |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 83 | try: |
| 84 | return self.files[self._AbsPath(path)] |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 85 | except KeyError as e: |
| 86 | raise IOError('%s not found' % path) from e |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 87 | |
| 88 | def WriteFile(self, path, contents, force_verbose=False): |
| 89 | if self.args.dryrun or self.args.verbose or force_verbose: |
| 90 | self.Print('\nWriting """\\\n%s""" to %s.\n' % (contents, path)) |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 91 | abpath = self._AbsPath(path) |
| 92 | self.files[abpath] = contents |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 93 | |
Jeremy Leconte | 3d38cd3 | 2022-08-16 15:13:58 +0200 | [diff] [blame] | 94 | def Call(self, cmd, env=None, capture_output=True, stdin=None): |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 95 | del env |
Jeremy Leconte | 3d38cd3 | 2022-08-16 15:13:58 +0200 | [diff] [blame] | 96 | del capture_output |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 97 | del stdin |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 98 | self.calls.append(cmd) |
| 99 | if self.cmds: |
| 100 | return self.cmds.pop(0) |
| 101 | return 0, '', '' |
| 102 | |
| 103 | def Print(self, *args, **kwargs): |
| 104 | sep = kwargs.get('sep', ' ') |
| 105 | end = kwargs.get('end', '\n') |
| 106 | f = kwargs.get('file', sys.stdout) |
| 107 | if f == sys.stderr: |
| 108 | self.err += sep.join(args) + end |
| 109 | else: |
| 110 | self.out += sep.join(args) + end |
| 111 | |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 112 | def TempDir(self): |
| 113 | tmp_dir = os.path.join(tempfile.gettempdir(), 'mb_test') |
| 114 | self.dirs.add(tmp_dir) |
| 115 | return tmp_dir |
| 116 | |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 117 | def TempFile(self, mode='w'): |
| 118 | del mode |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 119 | return FakeFile(self.files) |
| 120 | |
| 121 | def RemoveFile(self, path): |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 122 | abpath = self._AbsPath(path) |
| 123 | self.files[abpath] = None |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 124 | |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 125 | def RemoveDirectory(self, abs_path): |
| 126 | # Normalize the passed-in path to handle different working directories |
| 127 | # used during unit testing. |
| 128 | abs_path = self._AbsPath(abs_path) |
| 129 | self.rmdirs.append(abs_path) |
| 130 | files_to_delete = [f for f in self.files if f.startswith(abs_path)] |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 131 | for f in files_to_delete: |
| 132 | self.files[f] = None |
| 133 | |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 134 | def _AbsPath(self, path): |
| 135 | if not ((self.platform == 'win32' and path.startswith('c:')) or |
| 136 | (self.platform != 'win32' and path.startswith('/'))): |
| 137 | path = self.PathJoin(self.cwd, path) |
| 138 | if self.sep == '\\': |
| 139 | return re.sub(r'\\+', r'\\', path) |
Nidhi Jaju | 2394977 | 2021-12-02 10:38:50 +0000 | [diff] [blame] | 140 | return re.sub('/+', '/', path) |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 141 | |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 142 | |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 143 | class FakeFile: |
| 144 | # pylint: disable=invalid-name |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 145 | def __init__(self, files): |
| 146 | self.name = '/tmp/file' |
| 147 | self.buf = '' |
| 148 | self.files = files |
| 149 | |
| 150 | def write(self, contents): |
| 151 | self.buf += contents |
| 152 | |
| 153 | def close(self): |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 154 | self.files[self.name] = self.buf |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 155 | |
| 156 | |
| 157 | TEST_CONFIG = """\ |
| 158 | { |
Mirko Bonadei | 8606b9c | 2021-01-12 14:29:40 +0100 | [diff] [blame] | 159 | 'builder_groups': { |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 160 | 'chromium': {}, |
Mirko Bonadei | 8606b9c | 2021-01-12 14:29:40 +0100 | [diff] [blame] | 161 | 'fake_group': { |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 162 | 'fake_builder': 'rel_bot', |
| 163 | 'fake_debug_builder': 'debug_goma', |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 164 | 'fake_args_bot': 'fake_args_bot', |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 165 | 'fake_multi_phase': { 'phase_1': 'phase_1', 'phase_2': 'phase_2'}, |
| 166 | 'fake_android_bot': 'android_bot', |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 167 | 'fake_args_file': 'args_file_goma', |
| 168 | 'fake_ios_error': 'ios_error', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 169 | }, |
| 170 | }, |
| 171 | 'configs': { |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 172 | 'args_file_goma': ['fake_args_bot', 'goma'], |
| 173 | 'fake_args_bot': ['fake_args_bot'], |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 174 | 'rel_bot': ['rel', 'goma', 'fake_feature1'], |
| 175 | 'debug_goma': ['debug', 'goma'], |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 176 | 'phase_1': ['rel', 'phase_1'], |
| 177 | 'phase_2': ['rel', 'phase_2'], |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 178 | 'android_bot': ['android'], |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 179 | 'ios_error': ['error'], |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 180 | }, |
| 181 | 'mixins': { |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 182 | 'error': { |
| 183 | 'gn_args': 'error', |
| 184 | }, |
| 185 | 'fake_args_bot': { |
| 186 | 'args_file': '//build/args/bots/fake_group/fake_args_bot.gn', |
| 187 | }, |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 188 | 'fake_feature1': { |
| 189 | 'gn_args': 'enable_doom_melon=true', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 190 | }, |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 191 | 'goma': { |
| 192 | 'gn_args': 'use_goma=true', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 193 | }, |
| 194 | 'phase_1': { |
| 195 | 'gn_args': 'phase=1', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 196 | }, |
| 197 | 'phase_2': { |
| 198 | 'gn_args': 'phase=2', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 199 | }, |
| 200 | 'rel': { |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 201 | 'gn_args': 'is_debug=false dcheck_always_on=false', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 202 | }, |
| 203 | 'debug': { |
| 204 | 'gn_args': 'is_debug=true', |
| 205 | }, |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 206 | 'android': { |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 207 | 'gn_args': 'target_os="android" dcheck_always_on=false', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 208 | } |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 209 | }, |
| 210 | } |
| 211 | """ |
| 212 | |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 213 | |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 214 | def CreateFakeMBW(files=None, win32=False): |
| 215 | mbw = FakeMBW(win32=win32) |
| 216 | mbw.files.setdefault(mbw.default_config, TEST_CONFIG) |
| 217 | mbw.files.setdefault( |
| 218 | mbw.ToAbsPath('//testing/buildbot/gn_isolate_map.pyl'), '''{ |
| 219 | "foo_unittests": { |
| 220 | "label": "//foo:foo_unittests", |
| 221 | "type": "console_test_launcher", |
| 222 | "args": [], |
| 223 | }, |
| 224 | }''') |
| 225 | mbw.files.setdefault( |
| 226 | mbw.ToAbsPath('//build/args/bots/fake_group/fake_args_bot.gn'), |
| 227 | 'is_debug = false\ndcheck_always_on=false\n') |
| 228 | mbw.files.setdefault(mbw.ToAbsPath('//tools/mb/rts_banned_suites.json'), '{}') |
| 229 | if files: |
| 230 | for path, contents in list(files.items()): |
| 231 | mbw.files[path] = contents |
| 232 | if path.endswith('.runtime_deps'): |
| 233 | |
Jeremy Leconte | 3d38cd3 | 2022-08-16 15:13:58 +0200 | [diff] [blame] | 234 | def FakeCall(cmd, env=None, capture_output=True, stdin=None): |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 235 | # pylint: disable=cell-var-from-loop |
| 236 | del cmd |
| 237 | del env |
Jeremy Leconte | 3d38cd3 | 2022-08-16 15:13:58 +0200 | [diff] [blame] | 238 | del capture_output |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 239 | del stdin |
| 240 | mbw.files[path] = contents |
| 241 | return 0, '', '' |
| 242 | |
| 243 | # pylint: disable=invalid-name |
| 244 | mbw.Call = FakeCall |
| 245 | return mbw |
| 246 | |
| 247 | |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 248 | class UnitTest(unittest.TestCase): |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 249 | # pylint: disable=invalid-name |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 250 | def check(self, |
| 251 | args, |
| 252 | mbw=None, |
| 253 | files=None, |
| 254 | out=None, |
| 255 | err=None, |
| 256 | ret=None, |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 257 | env=None): |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 258 | if not mbw: |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 259 | mbw = CreateFakeMBW(files) |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 260 | |
Mirko Bonadei | 989e6e7 | 2021-01-29 14:34:52 +0100 | [diff] [blame] | 261 | try: |
| 262 | prev_env = os.environ.copy() |
| 263 | os.environ = env if env else prev_env |
| 264 | actual_ret = mbw.Main(args) |
| 265 | finally: |
| 266 | os.environ = prev_env |
| 267 | self.assertEqual( |
| 268 | actual_ret, ret, |
| 269 | "ret: %s, out: %s, err: %s" % (actual_ret, mbw.out, mbw.err)) |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 270 | if out is not None: |
| 271 | self.assertEqual(mbw.out, out) |
| 272 | if err is not None: |
| 273 | self.assertEqual(mbw.err, err) |
| 274 | return mbw |
| 275 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 276 | def test_gen_swarming(self): |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 277 | files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 278 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 279 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 280 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 281 | ("{'foo_unittests': {" |
| 282 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 283 | " 'type': 'raw'," |
| 284 | " 'args': []," |
| 285 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 286 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 287 | } |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 288 | mbw = CreateFakeMBW(files) |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 289 | self.check([ |
| 290 | 'gen', '-c', 'debug_goma', '--swarming-targets-file', |
| 291 | '/tmp/swarming_targets', '//out/Default' |
| 292 | ], |
| 293 | mbw=mbw, |
| 294 | ret=0) |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 295 | self.assertIn('/fake_src/out/Default/foo_unittests.isolate', mbw.files) |
| 296 | self.assertIn('/fake_src/out/Default/foo_unittests.isolated.gen.json', |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 297 | mbw.files) |
| 298 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 299 | def test_gen_swarming_android(self): |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 300 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 301 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 302 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 303 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 304 | ("{'foo_unittests': {" |
| 305 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 306 | " 'type': 'console_test_launcher'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 307 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 308 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 309 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 310 | mbw = self.check([ |
| 311 | 'gen', '-c', 'android_bot', '//out/Default', '--swarming-targets-file', |
| 312 | '/tmp/swarming_targets', '--isolate-map-file', |
| 313 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 314 | ], |
| 315 | files=test_files, |
| 316 | ret=0) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 317 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 318 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 319 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 320 | files = isolate_file_contents['variables']['files'] |
| 321 | command = isolate_file_contents['variables']['command'] |
| 322 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 323 | self.assertEqual( |
| 324 | files, |
| 325 | ['../../.vpython3', '../../testing/test_env.py', 'foo_unittests']) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 326 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 327 | 'vpython3', |
kjellander | f9e2a36 | 2017-03-24 12:17:33 -0700 | [diff] [blame] | 328 | '../../build/android/test_wrapper/logdog_wrapper.py', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 329 | '--target', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 330 | 'foo_unittests', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 331 | '--logdog-bin-cmd', |
| 332 | '../../bin/logdog_butler', |
| 333 | '--logcat-output-file', |
| 334 | '${ISOLATED_OUTDIR}/logcats', |
ehmaldonado | 34623ce | 2017-09-08 07:03:13 -0700 | [diff] [blame] | 335 | '--store-tombstones', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 336 | ]) |
| 337 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 338 | def test_gen_swarming_android_junit_test(self): |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 339 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 340 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 341 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 342 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 343 | ("{'foo_unittests': {" |
| 344 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 345 | " 'type': 'junit_test'," |
| 346 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 347 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 348 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 349 | mbw = self.check([ |
| 350 | 'gen', '-c', 'android_bot', '//out/Default', '--swarming-targets-file', |
| 351 | '/tmp/swarming_targets', '--isolate-map-file', |
| 352 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 353 | ], |
| 354 | files=test_files, |
| 355 | ret=0) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 356 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 357 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 358 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 359 | files = isolate_file_contents['variables']['files'] |
| 360 | command = isolate_file_contents['variables']['command'] |
| 361 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 362 | self.assertEqual( |
| 363 | files, |
| 364 | ['../../.vpython3', '../../testing/test_env.py', 'foo_unittests']) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 365 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 366 | 'vpython3', |
kjellander | f9e2a36 | 2017-03-24 12:17:33 -0700 | [diff] [blame] | 367 | '../../build/android/test_wrapper/logdog_wrapper.py', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 368 | '--target', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 369 | 'foo_unittests', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 370 | '--logdog-bin-cmd', |
| 371 | '../../bin/logdog_butler', |
| 372 | '--logcat-output-file', |
| 373 | '${ISOLATED_OUTDIR}/logcats', |
ehmaldonado | 34623ce | 2017-09-08 07:03:13 -0700 | [diff] [blame] | 374 | '--store-tombstones', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 375 | ]) |
| 376 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 377 | def test_gen_timeout(self): |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 378 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 379 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 380 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 381 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 382 | ("{'foo_unittests': {" |
| 383 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 384 | " 'type': 'non_parallel_console_test_launcher'," |
| 385 | " 'timeout': 500," |
| 386 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 387 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 388 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 389 | mbw = self.check([ |
| 390 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 391 | '/tmp/swarming_targets', '--isolate-map-file', |
| 392 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 393 | ], |
| 394 | files=test_files, |
| 395 | ret=0) |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 396 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 397 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 398 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 399 | files = isolate_file_contents['variables']['files'] |
| 400 | command = isolate_file_contents['variables']['command'] |
| 401 | |
| 402 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 403 | '../../.vpython3', |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 404 | '../../testing/test_env.py', |
| 405 | '../../third_party/gtest-parallel/gtest-parallel', |
| 406 | '../../third_party/gtest-parallel/gtest_parallel.py', |
| 407 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 408 | 'foo_unittests', |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 409 | ]) |
| 410 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 411 | 'vpython3', |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 412 | '../../testing/test_env.py', |
| 413 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
| 414 | '--output_dir=${ISOLATED_OUTDIR}/test_logs', |
| 415 | '--gtest_color=no', |
| 416 | '--timeout=500', |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 417 | '--workers=1', |
Yves Gerey | 2e0c655 | 2018-10-08 21:59:25 +0200 | [diff] [blame] | 418 | '--retry_failed=3', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 419 | './foo_unittests', |
Edward Lemur | beffdd4 | 2017-09-27 13:07:47 +0200 | [diff] [blame] | 420 | '--asan=0', |
| 421 | '--lsan=0', |
| 422 | '--msan=0', |
| 423 | '--tsan=0', |
| 424 | ]) |
| 425 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 426 | def test_gen_script(self): |
Edward Lemur | 2011075 | 2017-09-28 16:14:37 +0200 | [diff] [blame] | 427 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 428 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 429 | 'foo_unittests_script\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 430 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 431 | ("{'foo_unittests_script': {" |
| 432 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | 137173c | 2022-03-29 07:12:54 +0000 | [diff] [blame] | 433 | " 'type': 'script'," |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 434 | " 'script': '//foo/foo_unittests_script.py'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 435 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 436 | '/fake_src/out/Default/foo_unittests_script.runtime_deps': |
| 437 | ("foo_unittests\n" |
| 438 | "foo_unittests_script.py\n"), |
Edward Lemur | 2011075 | 2017-09-28 16:14:37 +0200 | [diff] [blame] | 439 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 440 | mbw = self.check([ |
| 441 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 442 | '/tmp/swarming_targets', '--isolate-map-file', |
| 443 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 444 | ], |
| 445 | files=test_files, |
| 446 | ret=0) |
Edward Lemur | 2011075 | 2017-09-28 16:14:37 +0200 | [diff] [blame] | 447 | |
| 448 | isolate_file = ( |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 449 | mbw.files['/fake_src/out/Default/foo_unittests_script.isolate']) |
Edward Lemur | 2011075 | 2017-09-28 16:14:37 +0200 | [diff] [blame] | 450 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 451 | files = isolate_file_contents['variables']['files'] |
| 452 | command = isolate_file_contents['variables']['command'] |
| 453 | |
| 454 | self.assertEqual(files, [ |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 455 | '../../.vpython3', |
| 456 | '../../testing/test_env.py', |
| 457 | 'foo_unittests', |
| 458 | 'foo_unittests_script.py', |
Edward Lemur | 2011075 | 2017-09-28 16:14:37 +0200 | [diff] [blame] | 459 | ]) |
| 460 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 461 | 'vpython3', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 462 | '../../foo/foo_unittests_script.py', |
Edward Lemur | 2011075 | 2017-09-28 16:14:37 +0200 | [diff] [blame] | 463 | ]) |
| 464 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 465 | def test_gen_raw(self): |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 466 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 467 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 468 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 469 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 470 | ("{'foo_unittests': {" |
| 471 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 472 | " 'type': 'raw'," |
| 473 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 474 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 475 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 476 | mbw = self.check([ |
| 477 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 478 | '/tmp/swarming_targets', '--isolate-map-file', |
| 479 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 480 | ], |
| 481 | files=test_files, |
| 482 | ret=0) |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 483 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 484 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 485 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 486 | files = isolate_file_contents['variables']['files'] |
| 487 | command = isolate_file_contents['variables']['command'] |
| 488 | |
| 489 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 490 | '../../.vpython3', |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 491 | '../../testing/test_env.py', |
Jeremy Leconte | a2e3d80 | 2021-12-07 12:54:08 +0100 | [diff] [blame] | 492 | '../../tools_webrtc/flags_compatibility.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 493 | 'foo_unittests', |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 494 | ]) |
| 495 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 496 | 'vpython3', |
Jeremy Leconte | a2e3d80 | 2021-12-07 12:54:08 +0100 | [diff] [blame] | 497 | '../../tools_webrtc/flags_compatibility.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 498 | './foo_unittests', |
Edward Lemur | 2b67f5c | 2018-02-07 18:09:44 +0100 | [diff] [blame] | 499 | ]) |
| 500 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 501 | def test_gen_non_parallel_console_test_launcher(self): |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 502 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 503 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 504 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 505 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 506 | ("{'foo_unittests': {" |
| 507 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 508 | " 'type': 'non_parallel_console_test_launcher'," |
| 509 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 510 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 511 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 512 | mbw = self.check([ |
| 513 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 514 | '/tmp/swarming_targets', '--isolate-map-file', |
| 515 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 516 | ], |
| 517 | files=test_files, |
| 518 | ret=0) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 519 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 520 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 521 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 522 | files = isolate_file_contents['variables']['files'] |
| 523 | command = isolate_file_contents['variables']['command'] |
| 524 | |
| 525 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 526 | '../../.vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 527 | '../../testing/test_env.py', |
kjellander | 382f2b2 | 2017-04-11 04:07:01 -0700 | [diff] [blame] | 528 | '../../third_party/gtest-parallel/gtest-parallel', |
ehmaldonado | a7507eb | 2017-05-10 13:40:29 -0700 | [diff] [blame] | 529 | '../../third_party/gtest-parallel/gtest_parallel.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 530 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 531 | 'foo_unittests', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 532 | ]) |
| 533 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 534 | 'vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 535 | '../../testing/test_env.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 536 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
kjellander | 382f2b2 | 2017-04-11 04:07:01 -0700 | [diff] [blame] | 537 | '--output_dir=${ISOLATED_OUTDIR}/test_logs', |
ehmaldonado | 76e60e9 | 2017-05-04 06:18:26 -0700 | [diff] [blame] | 538 | '--gtest_color=no', |
| 539 | '--timeout=900', |
kjellander | 382f2b2 | 2017-04-11 04:07:01 -0700 | [diff] [blame] | 540 | '--workers=1', |
Yves Gerey | 2e0c655 | 2018-10-08 21:59:25 +0200 | [diff] [blame] | 541 | '--retry_failed=3', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 542 | './foo_unittests', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 543 | '--asan=0', |
kjellander | 461a560 | 2017-05-05 06:39:16 -0700 | [diff] [blame] | 544 | '--lsan=0', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 545 | '--msan=0', |
| 546 | '--tsan=0', |
| 547 | ]) |
| 548 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 549 | def test_isolate_windowed_test_launcher_linux(self): |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 550 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 551 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 552 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 553 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 554 | ("{'foo_unittests': {" |
| 555 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 556 | " 'type': 'windowed_test_launcher'," |
| 557 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 558 | '/fake_src/out/Default/foo_unittests.runtime_deps': |
| 559 | ("foo_unittests\n" |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 560 | "some_resource_file\n"), |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 561 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 562 | mbw = self.check([ |
| 563 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 564 | '/tmp/swarming_targets', '--isolate-map-file', |
| 565 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 566 | ], |
| 567 | files=test_files, |
| 568 | ret=0) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 569 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 570 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 571 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 572 | files = isolate_file_contents['variables']['files'] |
| 573 | command = isolate_file_contents['variables']['command'] |
| 574 | |
| 575 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 576 | '../../.vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 577 | '../../testing/test_env.py', |
| 578 | '../../testing/xvfb.py', |
| 579 | '../../third_party/gtest-parallel/gtest-parallel', |
ehmaldonado | a7507eb | 2017-05-10 13:40:29 -0700 | [diff] [blame] | 580 | '../../third_party/gtest-parallel/gtest_parallel.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 581 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 582 | 'foo_unittests', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 583 | 'some_resource_file', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 584 | ]) |
| 585 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 586 | 'vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 587 | '../../testing/xvfb.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 588 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
ehmaldonado | 5583384 | 2017-02-13 03:58:13 -0800 | [diff] [blame] | 589 | '--output_dir=${ISOLATED_OUTDIR}/test_logs', |
ehmaldonado | 76e60e9 | 2017-05-04 06:18:26 -0700 | [diff] [blame] | 590 | '--gtest_color=no', |
| 591 | '--timeout=900', |
ehmaldonado | 2a28035 | 2017-05-05 04:33:57 -0700 | [diff] [blame] | 592 | '--retry_failed=3', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 593 | './foo_unittests', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 594 | '--asan=0', |
kjellander | 461a560 | 2017-05-05 06:39:16 -0700 | [diff] [blame] | 595 | '--lsan=0', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 596 | '--msan=0', |
| 597 | '--tsan=0', |
| 598 | ]) |
| 599 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 600 | def test_gen_windowed_test_launcher_win(self): |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 601 | files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 602 | 'c:\\fake_src\\out\\Default\\tmp\\swarming_targets': |
| 603 | 'unittests\n', |
| 604 | 'c:\\fake_src\\testing\\buildbot\\gn_isolate_map.pyl': |
| 605 | ("{'unittests': {" |
| 606 | " 'label': '//somewhere:unittests'," |
| 607 | " 'type': 'windowed_test_launcher'," |
| 608 | "}}\n"), |
| 609 | r'c:\fake_src\out\Default\unittests.exe.runtime_deps': |
| 610 | ("unittests.exe\n" |
| 611 | "some_dependency\n"), |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 612 | } |
Jeremy Leconte | ac5cf78 | 2022-03-31 11:55:01 +0200 | [diff] [blame] | 613 | mbw = CreateFakeMBW(files=files, win32=True) |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 614 | self.check([ |
| 615 | 'gen', '-c', 'debug_goma', '--swarming-targets-file', |
| 616 | 'c:\\fake_src\\out\\Default\\tmp\\swarming_targets', |
| 617 | '--isolate-map-file', |
| 618 | 'c:\\fake_src\\testing\\buildbot\\gn_isolate_map.pyl', '//out/Default' |
| 619 | ], |
| 620 | mbw=mbw, |
| 621 | ret=0) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 622 | |
| 623 | isolate_file = mbw.files['c:\\fake_src\\out\\Default\\unittests.isolate'] |
| 624 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 625 | files = isolate_file_contents['variables']['files'] |
| 626 | command = isolate_file_contents['variables']['command'] |
| 627 | |
| 628 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 629 | '../../.vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 630 | '../../testing/test_env.py', |
| 631 | '../../third_party/gtest-parallel/gtest-parallel', |
ehmaldonado | a7507eb | 2017-05-10 13:40:29 -0700 | [diff] [blame] | 632 | '../../third_party/gtest-parallel/gtest_parallel.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 633 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 634 | 'some_dependency', |
| 635 | 'unittests.exe', |
| 636 | ]) |
| 637 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 638 | 'vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 639 | '../../testing/test_env.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 640 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
Jeremy Leconte | e288161 | 2022-04-19 14:03:35 +0200 | [diff] [blame] | 641 | '--output_dir=${ISOLATED_OUTDIR}/test_logs', |
ehmaldonado | 76e60e9 | 2017-05-04 06:18:26 -0700 | [diff] [blame] | 642 | '--gtest_color=no', |
| 643 | '--timeout=900', |
ehmaldonado | 2a28035 | 2017-05-05 04:33:57 -0700 | [diff] [blame] | 644 | '--retry_failed=3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 645 | r'.\unittests.exe', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 646 | '--asan=0', |
kjellander | 461a560 | 2017-05-05 06:39:16 -0700 | [diff] [blame] | 647 | '--lsan=0', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 648 | '--msan=0', |
| 649 | '--tsan=0', |
| 650 | ]) |
| 651 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 652 | def test_gen_console_test_launcher(self): |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 653 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 654 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 655 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 656 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 657 | ("{'foo_unittests': {" |
| 658 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 659 | " 'type': 'console_test_launcher'," |
| 660 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 661 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 662 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 663 | mbw = self.check([ |
| 664 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 665 | '/tmp/swarming_targets', '--isolate-map-file', |
| 666 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 667 | ], |
| 668 | files=test_files, |
| 669 | ret=0) |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 670 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 671 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 672 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 673 | files = isolate_file_contents['variables']['files'] |
| 674 | command = isolate_file_contents['variables']['command'] |
| 675 | |
| 676 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 677 | '../../.vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 678 | '../../testing/test_env.py', |
| 679 | '../../third_party/gtest-parallel/gtest-parallel', |
ehmaldonado | a7507eb | 2017-05-10 13:40:29 -0700 | [diff] [blame] | 680 | '../../third_party/gtest-parallel/gtest_parallel.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 681 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 682 | 'foo_unittests', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 683 | ]) |
| 684 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 685 | 'vpython3', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 686 | '../../testing/test_env.py', |
Henrik Kjellander | 90fd7d8 | 2017-05-09 08:30:10 +0200 | [diff] [blame] | 687 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
ehmaldonado | 5583384 | 2017-02-13 03:58:13 -0800 | [diff] [blame] | 688 | '--output_dir=${ISOLATED_OUTDIR}/test_logs', |
ehmaldonado | 76e60e9 | 2017-05-04 06:18:26 -0700 | [diff] [blame] | 689 | '--gtest_color=no', |
| 690 | '--timeout=900', |
ehmaldonado | 2a28035 | 2017-05-05 04:33:57 -0700 | [diff] [blame] | 691 | '--retry_failed=3', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 692 | './foo_unittests', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 693 | '--asan=0', |
kjellander | 461a560 | 2017-05-05 06:39:16 -0700 | [diff] [blame] | 694 | '--lsan=0', |
ehmaldonado | ed8c8ed | 2016-11-23 12:58:35 -0800 | [diff] [blame] | 695 | '--msan=0', |
| 696 | '--tsan=0', |
| 697 | ]) |
| 698 | |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 699 | def test_isolate_test_launcher_with_webcam(self): |
| 700 | test_files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 701 | '/tmp/swarming_targets': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 702 | 'foo_unittests\n', |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 703 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 704 | ("{'foo_unittests': {" |
| 705 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 706 | " 'type': 'console_test_launcher'," |
| 707 | " 'use_webcam': True," |
| 708 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 709 | '/fake_src/out/Default/foo_unittests.runtime_deps': |
| 710 | ("foo_unittests\n" |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 711 | "some_resource_file\n"), |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 712 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 713 | mbw = self.check([ |
| 714 | 'gen', '-c', 'debug_goma', '//out/Default', '--swarming-targets-file', |
| 715 | '/tmp/swarming_targets', '--isolate-map-file', |
| 716 | '/fake_src/testing/buildbot/gn_isolate_map.pyl' |
| 717 | ], |
| 718 | files=test_files, |
| 719 | ret=0) |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 720 | |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 721 | isolate_file = mbw.files['/fake_src/out/Default/foo_unittests.isolate'] |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 722 | isolate_file_contents = ast.literal_eval(isolate_file) |
| 723 | files = isolate_file_contents['variables']['files'] |
| 724 | command = isolate_file_contents['variables']['command'] |
| 725 | |
| 726 | self.assertEqual(files, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 727 | '../../.vpython3', |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 728 | '../../testing/test_env.py', |
| 729 | '../../third_party/gtest-parallel/gtest-parallel', |
| 730 | '../../third_party/gtest-parallel/gtest_parallel.py', |
| 731 | '../../tools_webrtc/ensure_webcam_is_running.py', |
| 732 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 733 | 'foo_unittests', |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 734 | 'some_resource_file', |
| 735 | ]) |
| 736 | self.assertEqual(command, [ |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 737 | 'vpython3', |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 738 | '../../tools_webrtc/ensure_webcam_is_running.py', |
Mirko Bonadei | 5d9ae86 | 2022-01-27 20:18:16 +0100 | [diff] [blame] | 739 | 'vpython3', |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 740 | '../../testing/test_env.py', |
| 741 | '../../tools_webrtc/gtest-parallel-wrapper.py', |
| 742 | '--output_dir=${ISOLATED_OUTDIR}/test_logs', |
| 743 | '--gtest_color=no', |
| 744 | '--timeout=900', |
| 745 | '--retry_failed=3', |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 746 | './foo_unittests', |
Oleh Prypin | 739b816 | 2018-05-17 13:28:29 +0200 | [diff] [blame] | 747 | '--asan=0', |
| 748 | '--lsan=0', |
| 749 | '--msan=0', |
| 750 | '--tsan=0', |
| 751 | ]) |
| 752 | |
Oleh Prypin | b708e93 | 2018-03-18 17:34:20 +0100 | [diff] [blame] | 753 | def test_isolate(self): |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 754 | files = { |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 755 | '/fake_src/out/Default/toolchain.ninja': |
| 756 | "", |
| 757 | '/fake_src/testing/buildbot/gn_isolate_map.pyl': |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 758 | ("{'foo_unittests': {" |
| 759 | " 'label': '//foo:foo_unittests'," |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 760 | " 'type': 'non_parallel_console_test_launcher'," |
| 761 | "}}\n"), |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 762 | '/fake_src/out/Default/foo_unittests.runtime_deps': ("foo_unittests\n"), |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 763 | } |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 764 | self.check( |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 765 | ['isolate', '-c', 'debug_goma', '//out/Default', 'foo_unittests'], |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 766 | files=files, |
| 767 | ret=0) |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 768 | |
| 769 | # test running isolate on an existing build_dir |
Jeremy Leconte | 81635f3 | 2022-03-29 12:32:14 +0200 | [diff] [blame] | 770 | files['/fake_src/out/Default/args.gn'] = 'is_debug = true\n' |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 771 | self.check(['isolate', '//out/Default', 'foo_unittests'], |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 772 | files=files, |
| 773 | ret=0) |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 774 | files['/fake_src/out/Default/mb_type'] = 'gn\n' |
Jeremy Leconte | 7c94291 | 2022-04-25 21:05:27 +0200 | [diff] [blame] | 775 | self.check(['isolate', '//out/Default', 'foo_unittests'], |
Jeremy Leconte | f22c78b | 2021-12-07 19:49:48 +0100 | [diff] [blame] | 776 | files=files, |
| 777 | ret=0) |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 778 | |
kjellander | a013a02 | 2016-11-14 05:54:22 -0800 | [diff] [blame] | 779 | if __name__ == '__main__': |
| 780 | unittest.main() |