xref: /aosp_15_r20/external/angle/build/config/chromeos/rules.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2018 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/chrome_build.gni")
6*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/chromeos/args.gni")
7*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/chromeos/ui_mode.gni")
8*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/dcheck_always_on.gni")
9*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/gclient_args.gni")
10*8975f5c5SAndroid Build Coastguard Workerimport("//build/config/python.gni")
11*8975f5c5SAndroid Build Coastguard Workerimport("//build/util/generate_wrapper.gni")
12*8975f5c5SAndroid Build Coastguard Worker
13*8975f5c5SAndroid Build Coastguard Workerassert(is_chromeos)
14*8975f5c5SAndroid Build Coastguard Workerassert(is_chromeos_device)
15*8975f5c5SAndroid Build Coastguard Worker
16*8975f5c5SAndroid Build Coastguard Worker# Determine the real paths for various items in the SDK, which may be used
17*8975f5c5SAndroid Build Coastguard Worker# in the 'generate_runner_script' template below. We do so outside the template
18*8975f5c5SAndroid Build Coastguard Worker# to confine exec_script to a single invocation.
19*8975f5c5SAndroid Build Coastguard Workerif (cros_sdk_version != "") {
20*8975f5c5SAndroid Build Coastguard Worker  # Ideally these should be maps, however, gn doesn't support map, so using a
21*8975f5c5SAndroid Build Coastguard Worker  # list of list to simulate a map:
22*8975f5c5SAndroid Build Coastguard Worker  # [key1, [value1, value2, ...]], [key2, [value1, value2, ...]], where
23*8975f5c5SAndroid Build Coastguard Worker  # the keys are boards and values are symlinks or symlink targets, and the
24*8975f5c5SAndroid Build Coastguard Worker  # mapping shouldn't be used for anything else.
25*8975f5c5SAndroid Build Coastguard Worker  #
26*8975f5c5SAndroid Build Coastguard Worker  # A sample usage is:
27*8975f5c5SAndroid Build Coastguard Worker  # foreach(m, _symlink_targets_map) {
28*8975f5c5SAndroid Build Coastguard Worker  #   if(m[0] == target_key) {
29*8975f5c5SAndroid Build Coastguard Worker  #     target_value = m[1]
30*8975f5c5SAndroid Build Coastguard Worker  #   }
31*8975f5c5SAndroid Build Coastguard Worker  # }
32*8975f5c5SAndroid Build Coastguard Worker  #
33*8975f5c5SAndroid Build Coastguard Worker  _symlink_map = []
34*8975f5c5SAndroid Build Coastguard Worker  _symlink_targets_map = []
35*8975f5c5SAndroid Build Coastguard Worker
36*8975f5c5SAndroid Build Coastguard Worker  if (is_chromeos_ash) {
37*8975f5c5SAndroid Build Coastguard Worker    _potential_test_boards = [ cros_board ]
38*8975f5c5SAndroid Build Coastguard Worker  } else {
39*8975f5c5SAndroid Build Coastguard Worker    _potential_test_boards = []
40*8975f5c5SAndroid Build Coastguard Worker    if (cros_boards != "") {
41*8975f5c5SAndroid Build Coastguard Worker      _potential_test_boards += string_split(cros_boards, ":")
42*8975f5c5SAndroid Build Coastguard Worker    }
43*8975f5c5SAndroid Build Coastguard Worker    if (cros_boards_with_qemu_images != "") {
44*8975f5c5SAndroid Build Coastguard Worker      _potential_test_boards += string_split(cros_boards_with_qemu_images, ":")
45*8975f5c5SAndroid Build Coastguard Worker    }
46*8975f5c5SAndroid Build Coastguard Worker  }
47*8975f5c5SAndroid Build Coastguard Worker
48*8975f5c5SAndroid Build Coastguard Worker  foreach(b, _potential_test_boards) {
49*8975f5c5SAndroid Build Coastguard Worker    _cache_path_prefix =
50*8975f5c5SAndroid Build Coastguard Worker        "//build/cros_cache/chrome-sdk/symlinks/${b}+${cros_sdk_version}"
51*8975f5c5SAndroid Build Coastguard Worker
52*8975f5c5SAndroid Build Coastguard Worker    _cros_is_vm = false
53*8975f5c5SAndroid Build Coastguard Worker    foreach(b1, string_split(cros_boards_with_qemu_images, ":")) {
54*8975f5c5SAndroid Build Coastguard Worker      if (b == b1) {
55*8975f5c5SAndroid Build Coastguard Worker        _cros_is_vm = true
56*8975f5c5SAndroid Build Coastguard Worker      }
57*8975f5c5SAndroid Build Coastguard Worker    }
58*8975f5c5SAndroid Build Coastguard Worker
59*8975f5c5SAndroid Build Coastguard Worker    _symlinks = []
60*8975f5c5SAndroid Build Coastguard Worker    _symlinks = [
61*8975f5c5SAndroid Build Coastguard Worker      # Tast harness & test data.
62*8975f5c5SAndroid Build Coastguard Worker      rebase_path("${_cache_path_prefix}+autotest_server_package.tar.bz2"),
63*8975f5c5SAndroid Build Coastguard Worker
64*8975f5c5SAndroid Build Coastguard Worker      # Binutils (and other toolchain tools) used to deploy Chrome to the device.
65*8975f5c5SAndroid Build Coastguard Worker      rebase_path(
66*8975f5c5SAndroid Build Coastguard Worker          "${_cache_path_prefix}+environment_chromeos-base_chromeos-chrome.tar.xz"),
67*8975f5c5SAndroid Build Coastguard Worker      rebase_path("${_cache_path_prefix}+target_toolchain"),
68*8975f5c5SAndroid Build Coastguard Worker    ]
69*8975f5c5SAndroid Build Coastguard Worker    if (_cros_is_vm) {
70*8975f5c5SAndroid Build Coastguard Worker      # VM-related tools.
71*8975f5c5SAndroid Build Coastguard Worker      _symlinks +=
72*8975f5c5SAndroid Build Coastguard Worker          [ rebase_path("${_cache_path_prefix}+chromiumos_test_image.tar.xz") ]
73*8975f5c5SAndroid Build Coastguard Worker    }
74*8975f5c5SAndroid Build Coastguard Worker    _symlink_map += [ [
75*8975f5c5SAndroid Build Coastguard Worker          b,
76*8975f5c5SAndroid Build Coastguard Worker          _symlinks,
77*8975f5c5SAndroid Build Coastguard Worker        ] ]
78*8975f5c5SAndroid Build Coastguard Worker  }
79*8975f5c5SAndroid Build Coastguard Worker
80*8975f5c5SAndroid Build Coastguard Worker  _all_symlinks = []
81*8975f5c5SAndroid Build Coastguard Worker  foreach(m, _symlink_map) {
82*8975f5c5SAndroid Build Coastguard Worker    _all_symlinks += m[1]
83*8975f5c5SAndroid Build Coastguard Worker  }
84*8975f5c5SAndroid Build Coastguard Worker  _all_symlink_targets =
85*8975f5c5SAndroid Build Coastguard Worker      exec_script("//build/get_symlink_targets.py", _all_symlinks, "list lines")
86*8975f5c5SAndroid Build Coastguard Worker  _index = 0
87*8975f5c5SAndroid Build Coastguard Worker  foreach(m, _symlink_map) {
88*8975f5c5SAndroid Build Coastguard Worker    _symlink_targets = []
89*8975f5c5SAndroid Build Coastguard Worker    foreach(_, m[1]) {
90*8975f5c5SAndroid Build Coastguard Worker      _symlink_targets += [ _all_symlink_targets[_index] ]
91*8975f5c5SAndroid Build Coastguard Worker      _index += 1
92*8975f5c5SAndroid Build Coastguard Worker    }
93*8975f5c5SAndroid Build Coastguard Worker
94*8975f5c5SAndroid Build Coastguard Worker    _symlink_targets_map += [ [
95*8975f5c5SAndroid Build Coastguard Worker          m[0],
96*8975f5c5SAndroid Build Coastguard Worker          _symlink_targets,
97*8975f5c5SAndroid Build Coastguard Worker        ] ]
98*8975f5c5SAndroid Build Coastguard Worker  }
99*8975f5c5SAndroid Build Coastguard Worker}
100*8975f5c5SAndroid Build Coastguard Worker
101*8975f5c5SAndroid Build Coastguard Workertemplate("generate_chromeos_sdk_deps") {
102*8975f5c5SAndroid Build Coastguard Worker  forward_variables_from(invoker,
103*8975f5c5SAndroid Build Coastguard Worker                         [
104*8975f5c5SAndroid Build Coastguard Worker                           "deploy_chrome",
105*8975f5c5SAndroid Build Coastguard Worker                           "is_tast",
106*8975f5c5SAndroid Build Coastguard Worker                         ])
107*8975f5c5SAndroid Build Coastguard Worker  if (!defined(deploy_chrome)) {
108*8975f5c5SAndroid Build Coastguard Worker    deploy_chrome = false
109*8975f5c5SAndroid Build Coastguard Worker  }
110*8975f5c5SAndroid Build Coastguard Worker  if (!defined(is_tast)) {
111*8975f5c5SAndroid Build Coastguard Worker    is_tast = false
112*8975f5c5SAndroid Build Coastguard Worker  }
113*8975f5c5SAndroid Build Coastguard Worker
114*8975f5c5SAndroid Build Coastguard Worker  _sdk_data = []
115*8975f5c5SAndroid Build Coastguard Worker  assert(cros_sdk_version != "", "cros sdk version is not defined")
116*8975f5c5SAndroid Build Coastguard Worker  foreach(b, _potential_test_boards) {
117*8975f5c5SAndroid Build Coastguard Worker    _cros_is_vm = false
118*8975f5c5SAndroid Build Coastguard Worker    foreach(b1, string_split(cros_boards_with_qemu_images, ":")) {
119*8975f5c5SAndroid Build Coastguard Worker      if (b == b1) {
120*8975f5c5SAndroid Build Coastguard Worker        _cros_is_vm = true
121*8975f5c5SAndroid Build Coastguard Worker      }
122*8975f5c5SAndroid Build Coastguard Worker    }
123*8975f5c5SAndroid Build Coastguard Worker
124*8975f5c5SAndroid Build Coastguard Worker    # Determine the real paths for various items in the SDK, which may be used
125*8975f5c5SAndroid Build Coastguard Worker    # in the 'generate_runner_script' template below.
126*8975f5c5SAndroid Build Coastguard Worker    if (is_tast || _cros_is_vm || deploy_chrome) {
127*8975f5c5SAndroid Build Coastguard Worker      _symlink_targets = []
128*8975f5c5SAndroid Build Coastguard Worker      foreach(m, _symlink_targets_map) {
129*8975f5c5SAndroid Build Coastguard Worker        if (b == m[0]) {
130*8975f5c5SAndroid Build Coastguard Worker          _symlink_targets = []
131*8975f5c5SAndroid Build Coastguard Worker          _symlink_targets = m[1]
132*8975f5c5SAndroid Build Coastguard Worker        }
133*8975f5c5SAndroid Build Coastguard Worker      }
134*8975f5c5SAndroid Build Coastguard Worker
135*8975f5c5SAndroid Build Coastguard Worker      if (is_tast) {
136*8975f5c5SAndroid Build Coastguard Worker        # Add tast sdk items.
137*8975f5c5SAndroid Build Coastguard Worker        _sdk_data += [ _symlink_targets[0] ]
138*8975f5c5SAndroid Build Coastguard Worker      }
139*8975f5c5SAndroid Build Coastguard Worker      if (deploy_chrome) {
140*8975f5c5SAndroid Build Coastguard Worker        # To deploy chrome to the VM, it needs to be stripped down to fit into
141*8975f5c5SAndroid Build Coastguard Worker        # the VM. This is done by using binutils in the toolchain. So add the
142*8975f5c5SAndroid Build Coastguard Worker        # toolchain to the data.
143*8975f5c5SAndroid Build Coastguard Worker        _sdk_data += [
144*8975f5c5SAndroid Build Coastguard Worker          _symlink_targets[1],
145*8975f5c5SAndroid Build Coastguard Worker          _symlink_targets[2],
146*8975f5c5SAndroid Build Coastguard Worker        ]
147*8975f5c5SAndroid Build Coastguard Worker      }
148*8975f5c5SAndroid Build Coastguard Worker      if (_cros_is_vm) {
149*8975f5c5SAndroid Build Coastguard Worker        # Add vm sdk items.
150*8975f5c5SAndroid Build Coastguard Worker        _sdk_data += [ _symlink_targets[3] ]
151*8975f5c5SAndroid Build Coastguard Worker      }
152*8975f5c5SAndroid Build Coastguard Worker    }
153*8975f5c5SAndroid Build Coastguard Worker  }
154*8975f5c5SAndroid Build Coastguard Worker  group(target_name) {
155*8975f5c5SAndroid Build Coastguard Worker    data = _sdk_data
156*8975f5c5SAndroid Build Coastguard Worker    data += [
157*8975f5c5SAndroid Build Coastguard Worker      # Needed for various SDK components used below.
158*8975f5c5SAndroid Build Coastguard Worker      "//build/cros_cache/chrome-sdk/misc/",
159*8975f5c5SAndroid Build Coastguard Worker      "//build/cros_cache/chrome-sdk/symlinks/",
160*8975f5c5SAndroid Build Coastguard Worker      "//build/cros_cache/common/",
161*8975f5c5SAndroid Build Coastguard Worker      "//chrome/VERSION",
162*8975f5c5SAndroid Build Coastguard Worker
163*8975f5c5SAndroid Build Coastguard Worker      # The LKGM file controls what version of the VM image to download. Add it
164*8975f5c5SAndroid Build Coastguard Worker      # as data here so that changes to it will trigger analyze.
165*8975f5c5SAndroid Build Coastguard Worker      "//chromeos/CHROMEOS_LKGM",
166*8975f5c5SAndroid Build Coastguard Worker    ]
167*8975f5c5SAndroid Build Coastguard Worker    if (cros_boards_with_qemu_images != "") {
168*8975f5c5SAndroid Build Coastguard Worker      data += [ "//build/cros_cache/cipd/" ]
169*8975f5c5SAndroid Build Coastguard Worker    }
170*8975f5c5SAndroid Build Coastguard Worker  }
171*8975f5c5SAndroid Build Coastguard Worker}
172*8975f5c5SAndroid Build Coastguard Worker
173*8975f5c5SAndroid Build Coastguard Worker# Creates tast filter files for skylab tast tests.
174*8975f5c5SAndroid Build Coastguard Worker# Args:
175*8975f5c5SAndroid Build Coastguard Worker#   tast_attr_expr: Tast expression to determine tests to run. This creates the
176*8975f5c5SAndroid Build Coastguard Worker#       initial set of tests that can be further filtered..
177*8975f5c5SAndroid Build Coastguard Worker#   tast_tests: Names of tests to enable in tast. All other tests will be
178*8975f5c5SAndroid Build Coastguard Worker#       disabled that are not listed.
179*8975f5c5SAndroid Build Coastguard Worker#   tast_disabled_tests: Names of tests to disable in tast. All other tests that
180*8975f5c5SAndroid Build Coastguard Worker#       match the tast expression will still run.
181*8975f5c5SAndroid Build Coastguard Worker#   tast_control: gni file with collections of tests to be used for specific
182*8975f5c5SAndroid Build Coastguard Worker#       filters (e.g. "//chromeos/tast_control.gni"). Any lists of strings in
183*8975f5c5SAndroid Build Coastguard Worker#       this file will be used to generate additional tast expressions with
184*8975f5c5SAndroid Build Coastguard Worker#       those strings expanded into tests to disable (i.e. as && !"name:test").
185*8975f5c5SAndroid Build Coastguard Worker#       The name of those lists are then intended to be used to specify in
186*8975f5c5SAndroid Build Coastguard Worker#       test_suites.pyl which collection to be used on specific test suites.
187*8975f5c5SAndroid Build Coastguard Workertemplate("generate_skylab_tast_filter") {
188*8975f5c5SAndroid Build Coastguard Worker  forward_variables_from(invoker,
189*8975f5c5SAndroid Build Coastguard Worker                         [
190*8975f5c5SAndroid Build Coastguard Worker                           "tast_attr_expr",
191*8975f5c5SAndroid Build Coastguard Worker                           "tast_tests",
192*8975f5c5SAndroid Build Coastguard Worker                           "tast_disabled_tests",
193*8975f5c5SAndroid Build Coastguard Worker                           "tast_control",
194*8975f5c5SAndroid Build Coastguard Worker                         ])
195*8975f5c5SAndroid Build Coastguard Worker
196*8975f5c5SAndroid Build Coastguard Worker  if (defined(tast_disabled_tests)) {
197*8975f5c5SAndroid Build Coastguard Worker    assert(defined(tast_attr_expr),
198*8975f5c5SAndroid Build Coastguard Worker           "tast_attr_expr must be used when specifying tast_disabled_tests.")
199*8975f5c5SAndroid Build Coastguard Worker  }
200*8975f5c5SAndroid Build Coastguard Worker  _generated_filter = "$root_build_dir/bin/${target_name}.filter"
201*8975f5c5SAndroid Build Coastguard Worker  _skylab_args = [
202*8975f5c5SAndroid Build Coastguard Worker    "generate-filter",
203*8975f5c5SAndroid Build Coastguard Worker    "--output",
204*8975f5c5SAndroid Build Coastguard Worker    rebase_path(_generated_filter),
205*8975f5c5SAndroid Build Coastguard Worker  ]
206*8975f5c5SAndroid Build Coastguard Worker  if (defined(tast_control)) {
207*8975f5c5SAndroid Build Coastguard Worker    _skylab_args += [
208*8975f5c5SAndroid Build Coastguard Worker      "--tast-control",
209*8975f5c5SAndroid Build Coastguard Worker      rebase_path(tast_control),
210*8975f5c5SAndroid Build Coastguard Worker    ]
211*8975f5c5SAndroid Build Coastguard Worker  }
212*8975f5c5SAndroid Build Coastguard Worker  if (defined(tast_attr_expr)) {
213*8975f5c5SAndroid Build Coastguard Worker    _skylab_args += [
214*8975f5c5SAndroid Build Coastguard Worker      "--tast-expr",
215*8975f5c5SAndroid Build Coastguard Worker      tast_attr_expr,
216*8975f5c5SAndroid Build Coastguard Worker    ]
217*8975f5c5SAndroid Build Coastguard Worker  }
218*8975f5c5SAndroid Build Coastguard Worker  if (defined(tast_tests)) {
219*8975f5c5SAndroid Build Coastguard Worker    foreach(_test, tast_tests) {
220*8975f5c5SAndroid Build Coastguard Worker      _skylab_args += [
221*8975f5c5SAndroid Build Coastguard Worker        "--enabled-tests",
222*8975f5c5SAndroid Build Coastguard Worker        _test,
223*8975f5c5SAndroid Build Coastguard Worker      ]
224*8975f5c5SAndroid Build Coastguard Worker    }
225*8975f5c5SAndroid Build Coastguard Worker  }
226*8975f5c5SAndroid Build Coastguard Worker  if (defined(tast_disabled_tests)) {
227*8975f5c5SAndroid Build Coastguard Worker    foreach(_test_name, tast_disabled_tests) {
228*8975f5c5SAndroid Build Coastguard Worker      _skylab_args += [
229*8975f5c5SAndroid Build Coastguard Worker        "--disabled-tests",
230*8975f5c5SAndroid Build Coastguard Worker        _test_name,
231*8975f5c5SAndroid Build Coastguard Worker      ]
232*8975f5c5SAndroid Build Coastguard Worker    }
233*8975f5c5SAndroid Build Coastguard Worker  }
234*8975f5c5SAndroid Build Coastguard Worker  action(target_name) {
235*8975f5c5SAndroid Build Coastguard Worker    testonly = true
236*8975f5c5SAndroid Build Coastguard Worker    script = "//build/chromeos/generate_skylab_tast_filter.py"
237*8975f5c5SAndroid Build Coastguard Worker    if (defined(tast_control)) {
238*8975f5c5SAndroid Build Coastguard Worker      sources = [ tast_control ]
239*8975f5c5SAndroid Build Coastguard Worker    }
240*8975f5c5SAndroid Build Coastguard Worker    outputs = [ _generated_filter ]
241*8975f5c5SAndroid Build Coastguard Worker    args = _skylab_args
242*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.data_deps)) {
243*8975f5c5SAndroid Build Coastguard Worker      data_deps = invoker.data_deps
244*8975f5c5SAndroid Build Coastguard Worker    }
245*8975f5c5SAndroid Build Coastguard Worker    data = [ _generated_filter ]
246*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.data)) {
247*8975f5c5SAndroid Build Coastguard Worker      data += invoker.data
248*8975f5c5SAndroid Build Coastguard Worker    }
249*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.deps)) {
250*8975f5c5SAndroid Build Coastguard Worker      deps = invoker.deps
251*8975f5c5SAndroid Build Coastguard Worker    }
252*8975f5c5SAndroid Build Coastguard Worker  }
253*8975f5c5SAndroid Build Coastguard Worker}
254*8975f5c5SAndroid Build Coastguard Worker
255*8975f5c5SAndroid Build Coastguard Worker# Creates a script at $generated_script that can be used to launch a cros VM
256*8975f5c5SAndroid Build Coastguard Worker# and optionally run a test within it.
257*8975f5c5SAndroid Build Coastguard Worker# Args:
258*8975f5c5SAndroid Build Coastguard Worker#   test_exe: Name of test binary located in the out dir. This will get copied
259*8975f5c5SAndroid Build Coastguard Worker#       to the VM and executed there.
260*8975f5c5SAndroid Build Coastguard Worker#   tast_attr_expr: Tast expression to pass to local_test_runner on the VM.
261*8975f5c5SAndroid Build Coastguard Worker#   tast_tests: List of Tast tests to run on the VM. Note that when this is
262*8975f5c5SAndroid Build Coastguard Worker#       specified, the target name used to invoke this template will be
263*8975f5c5SAndroid Build Coastguard Worker#       designated as the "name" of this test and will primarly used for test
264*8975f5c5SAndroid Build Coastguard Worker#       results tracking and displaying (eg: flakiness dashboard).
265*8975f5c5SAndroid Build Coastguard Worker#   generated_script: Path to place the generated script.
266*8975f5c5SAndroid Build Coastguard Worker#   deploy_chrome: If true, deploys a locally built chrome located in the root
267*8975f5c5SAndroid Build Coastguard Worker#       build dir to the VM or DUT after launching it.
268*8975f5c5SAndroid Build Coastguard Worker#   runtime_deps_file: Path to file listing runtime deps for the test. If set,
269*8975f5c5SAndroid Build Coastguard Worker#       all files listed will be copied to the VM before testing.
270*8975f5c5SAndroid Build Coastguard Worker#   skip_generating_board_args: By default, this template generates an '--board'
271*8975f5c5SAndroid Build Coastguard Worker#       arg with corresponding '--flash' or '--use-vm' args for device and vm
272*8975f5c5SAndroid Build Coastguard Worker#       respectively. This argument instructs the template to skip generating
273*8975f5c5SAndroid Build Coastguard Worker#       them, and it's designed for use cases where one builds for one board
274*8975f5c5SAndroid Build Coastguard Worker#       (e.g. amd64-generic), but tests on a different board (e.g. eve).
275*8975f5c5SAndroid Build Coastguard Worker#   tast_vars: A list of "key=value" runtime variable pairs to pass to invoke
276*8975f5c5SAndroid Build Coastguard Worker#   strip_chrome: If true, strips Chrome before deploying it for non-Tast tests.
277*8975f5c5SAndroid Build Coastguard Worker#       the Tast tests. For more details, please see:
278*8975f5c5SAndroid Build Coastguard Worker#       https://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/writing_tests.md#Runtime-variables
279*8975f5c5SAndroid Build Coastguard Workertemplate("generate_runner_script") {
280*8975f5c5SAndroid Build Coastguard Worker  forward_variables_from(invoker,
281*8975f5c5SAndroid Build Coastguard Worker                         [
282*8975f5c5SAndroid Build Coastguard Worker                           "deploy_chrome",
283*8975f5c5SAndroid Build Coastguard Worker                           "generated_script",
284*8975f5c5SAndroid Build Coastguard Worker                           "runtime_deps_file",
285*8975f5c5SAndroid Build Coastguard Worker                           "skip_generating_board_args",
286*8975f5c5SAndroid Build Coastguard Worker                           "strip_chrome",
287*8975f5c5SAndroid Build Coastguard Worker                           "tast_attr_expr",
288*8975f5c5SAndroid Build Coastguard Worker                           "tast_tests",
289*8975f5c5SAndroid Build Coastguard Worker                           "tast_vars",
290*8975f5c5SAndroid Build Coastguard Worker                           "testonly",
291*8975f5c5SAndroid Build Coastguard Worker                           "test_exe",
292*8975f5c5SAndroid Build Coastguard Worker                         ])
293*8975f5c5SAndroid Build Coastguard Worker
294*8975f5c5SAndroid Build Coastguard Worker  if (!defined(skip_generating_board_args)) {
295*8975f5c5SAndroid Build Coastguard Worker    # --board should be assigned by the autotest wrapper on skylab builders
296*8975f5c5SAndroid Build Coastguard Worker    skip_generating_board_args = is_skylab
297*8975f5c5SAndroid Build Coastguard Worker  }
298*8975f5c5SAndroid Build Coastguard Worker
299*8975f5c5SAndroid Build Coastguard Worker  if (skip_generating_board_args) {
300*8975f5c5SAndroid Build Coastguard Worker    # cros_board is not needed, so setting it to empty to avoid being used
301*8975f5c5SAndroid Build Coastguard Worker    # accidentally below.
302*8975f5c5SAndroid Build Coastguard Worker    cros_board = ""
303*8975f5c5SAndroid Build Coastguard Worker    not_needed([ cros_board ])
304*8975f5c5SAndroid Build Coastguard Worker  }
305*8975f5c5SAndroid Build Coastguard Worker
306*8975f5c5SAndroid Build Coastguard Worker  if (!defined(deploy_chrome)) {
307*8975f5c5SAndroid Build Coastguard Worker    deploy_chrome = false
308*8975f5c5SAndroid Build Coastguard Worker  }
309*8975f5c5SAndroid Build Coastguard Worker  if (!defined(strip_chrome)) {
310*8975f5c5SAndroid Build Coastguard Worker    strip_chrome = false
311*8975f5c5SAndroid Build Coastguard Worker  }
312*8975f5c5SAndroid Build Coastguard Worker  is_tast = defined(tast_attr_expr) || defined(tast_tests)
313*8975f5c5SAndroid Build Coastguard Worker  assert(!(is_tast && defined(test_exe)),
314*8975f5c5SAndroid Build Coastguard Worker         "Tast tests are invoked from binaries shipped with the VM image. " +
315*8975f5c5SAndroid Build Coastguard Worker             "There should be no locally built binary needed.")
316*8975f5c5SAndroid Build Coastguard Worker  assert(is_tast || !defined(tast_vars),
317*8975f5c5SAndroid Build Coastguard Worker         "tast_vars is only support for Tast tests")
318*8975f5c5SAndroid Build Coastguard Worker
319*8975f5c5SAndroid Build Coastguard Worker  if (is_tast) {
320*8975f5c5SAndroid Build Coastguard Worker    not_needed([ "strip_chrome" ])
321*8975f5c5SAndroid Build Coastguard Worker  }
322*8975f5c5SAndroid Build Coastguard Worker
323*8975f5c5SAndroid Build Coastguard Worker  # If we're in the cros chrome-sdk (and not the raw ebuild), the test will
324*8975f5c5SAndroid Build Coastguard Worker  # need some additional runtime data located in the SDK cache.
325*8975f5c5SAndroid Build Coastguard Worker  if (cros_sdk_version != "") {
326*8975f5c5SAndroid Build Coastguard Worker    assert(defined(generated_script),
327*8975f5c5SAndroid Build Coastguard Worker           "Must specify where to place generated test launcher script via " +
328*8975f5c5SAndroid Build Coastguard Worker               "'generated_script'")
329*8975f5c5SAndroid Build Coastguard Worker
330*8975f5c5SAndroid Build Coastguard Worker    generate_chromeos_sdk_deps(target_name + "_cros_deps__helper") {
331*8975f5c5SAndroid Build Coastguard Worker      is_tast = is_tast
332*8975f5c5SAndroid Build Coastguard Worker      deploy_chrome = deploy_chrome
333*8975f5c5SAndroid Build Coastguard Worker    }
334*8975f5c5SAndroid Build Coastguard Worker  }
335*8975f5c5SAndroid Build Coastguard Worker
336*8975f5c5SAndroid Build Coastguard Worker  generate_wrapper(target_name) {
337*8975f5c5SAndroid Build Coastguard Worker    executable = "//build/chromeos/test_runner.py"
338*8975f5c5SAndroid Build Coastguard Worker    wrapper_script = generated_script
339*8975f5c5SAndroid Build Coastguard Worker    executable_args = []
340*8975f5c5SAndroid Build Coastguard Worker
341*8975f5c5SAndroid Build Coastguard Worker    if (defined(runtime_deps_file)) {
342*8975f5c5SAndroid Build Coastguard Worker      write_runtime_deps = runtime_deps_file
343*8975f5c5SAndroid Build Coastguard Worker    }
344*8975f5c5SAndroid Build Coastguard Worker
345*8975f5c5SAndroid Build Coastguard Worker    # Build executable_args for the three different test types: GTest, Tast,
346*8975f5c5SAndroid Build Coastguard Worker    # and host-side commands (eg telemetry).
347*8975f5c5SAndroid Build Coastguard Worker    if (defined(test_exe)) {
348*8975f5c5SAndroid Build Coastguard Worker      executable_args += [
349*8975f5c5SAndroid Build Coastguard Worker        "gtest",
350*8975f5c5SAndroid Build Coastguard Worker        "--test-exe",
351*8975f5c5SAndroid Build Coastguard Worker        test_exe,
352*8975f5c5SAndroid Build Coastguard Worker      ]
353*8975f5c5SAndroid Build Coastguard Worker
354*8975f5c5SAndroid Build Coastguard Worker      # This target is not a gtest unit test, but an integration test suite.
355*8975f5c5SAndroid Build Coastguard Worker      # Similar to interactive ui tests, it would start a full browser and
356*8975f5c5SAndroid Build Coastguard Worker      # then do testing.
357*8975f5c5SAndroid Build Coastguard Worker      # See more at //docs/testing/chromeos_integration.
358*8975f5c5SAndroid Build Coastguard Worker      if (test_exe == "chromeos_integration_tests") {
359*8975f5c5SAndroid Build Coastguard Worker        # Run the test sudo helper.
360*8975f5c5SAndroid Build Coastguard Worker        executable_args += [ "--run-test-sudo-helper" ]
361*8975f5c5SAndroid Build Coastguard Worker
362*8975f5c5SAndroid Build Coastguard Worker        if (is_chromeos_ash) {
363*8975f5c5SAndroid Build Coastguard Worker          # For ash, it need to first stop the existing ash.
364*8975f5c5SAndroid Build Coastguard Worker          executable_args += [ "--stop-ui" ]
365*8975f5c5SAndroid Build Coastguard Worker
366*8975f5c5SAndroid Build Coastguard Worker          # Use the deployed dbus configs.
367*8975f5c5SAndroid Build Coastguard Worker          executable_args += [ "--use-deployed-dbus-configs" ]
368*8975f5c5SAndroid Build Coastguard Worker        }
369*8975f5c5SAndroid Build Coastguard Worker
370*8975f5c5SAndroid Build Coastguard Worker        # Make the tests match the browser's selinux tags so it gets the same
371*8975f5c5SAndroid Build Coastguard Worker        # security context as the browser would.
372*8975f5c5SAndroid Build Coastguard Worker        executable_args += [ "--set-selinux-label=chromeos_integration_tests=u:object_r:chrome_browser_exec:s0" ]
373*8975f5c5SAndroid Build Coastguard Worker      }
374*8975f5c5SAndroid Build Coastguard Worker      if (defined(runtime_deps_file)) {
375*8975f5c5SAndroid Build Coastguard Worker        executable_args += [
376*8975f5c5SAndroid Build Coastguard Worker          "--runtime-deps-path",
377*8975f5c5SAndroid Build Coastguard Worker          rebase_path(runtime_deps_file, root_build_dir),
378*8975f5c5SAndroid Build Coastguard Worker        ]
379*8975f5c5SAndroid Build Coastguard Worker      }
380*8975f5c5SAndroid Build Coastguard Worker    } else if (is_tast) {
381*8975f5c5SAndroid Build Coastguard Worker      # When --tast-tests is specified, test_runner.py will call
382*8975f5c5SAndroid Build Coastguard Worker      # local_test_runner on the VM to run the set of tests.
383*8975f5c5SAndroid Build Coastguard Worker      executable_args += [
384*8975f5c5SAndroid Build Coastguard Worker        "tast",
385*8975f5c5SAndroid Build Coastguard Worker        "--suite-name",
386*8975f5c5SAndroid Build Coastguard Worker        target_name,
387*8975f5c5SAndroid Build Coastguard Worker      ]
388*8975f5c5SAndroid Build Coastguard Worker      if (defined(tast_attr_expr)) {
389*8975f5c5SAndroid Build Coastguard Worker        executable_args += [
390*8975f5c5SAndroid Build Coastguard Worker          "--attr-expr",
391*8975f5c5SAndroid Build Coastguard Worker          tast_attr_expr,
392*8975f5c5SAndroid Build Coastguard Worker        ]
393*8975f5c5SAndroid Build Coastguard Worker      } else {
394*8975f5c5SAndroid Build Coastguard Worker        foreach(test, tast_tests) {
395*8975f5c5SAndroid Build Coastguard Worker          executable_args += [
396*8975f5c5SAndroid Build Coastguard Worker            "-t",
397*8975f5c5SAndroid Build Coastguard Worker            test,
398*8975f5c5SAndroid Build Coastguard Worker          ]
399*8975f5c5SAndroid Build Coastguard Worker        }
400*8975f5c5SAndroid Build Coastguard Worker      }
401*8975f5c5SAndroid Build Coastguard Worker      if (defined(tast_vars)) {
402*8975f5c5SAndroid Build Coastguard Worker        foreach(var, tast_vars) {
403*8975f5c5SAndroid Build Coastguard Worker          executable_args += [
404*8975f5c5SAndroid Build Coastguard Worker            "--tast-var",
405*8975f5c5SAndroid Build Coastguard Worker            var,
406*8975f5c5SAndroid Build Coastguard Worker          ]
407*8975f5c5SAndroid Build Coastguard Worker        }
408*8975f5c5SAndroid Build Coastguard Worker      }
409*8975f5c5SAndroid Build Coastguard Worker      if (dcheck_always_on) {
410*8975f5c5SAndroid Build Coastguard Worker        executable_args += [
411*8975f5c5SAndroid Build Coastguard Worker          "--tast-extra-use-flags",
412*8975f5c5SAndroid Build Coastguard Worker          "chrome_dcheck",
413*8975f5c5SAndroid Build Coastguard Worker        ]
414*8975f5c5SAndroid Build Coastguard Worker      }
415*8975f5c5SAndroid Build Coastguard Worker    } else {
416*8975f5c5SAndroid Build Coastguard Worker      executable_args += [ "host-cmd" ]
417*8975f5c5SAndroid Build Coastguard Worker    }
418*8975f5c5SAndroid Build Coastguard Worker    executable_args += [
419*8975f5c5SAndroid Build Coastguard Worker      "--cros-cache",
420*8975f5c5SAndroid Build Coastguard Worker      "build/cros_cache/",
421*8975f5c5SAndroid Build Coastguard Worker      "--path-to-outdir",
422*8975f5c5SAndroid Build Coastguard Worker      rebase_path(root_out_dir, "//"),
423*8975f5c5SAndroid Build Coastguard Worker      "-v",
424*8975f5c5SAndroid Build Coastguard Worker    ]
425*8975f5c5SAndroid Build Coastguard Worker
426*8975f5c5SAndroid Build Coastguard Worker    if (!is_tast && strip_chrome) {
427*8975f5c5SAndroid Build Coastguard Worker      executable_args += [ "--strip-chrome" ]
428*8975f5c5SAndroid Build Coastguard Worker    }
429*8975f5c5SAndroid Build Coastguard Worker
430*8975f5c5SAndroid Build Coastguard Worker    if (!skip_generating_board_args) {
431*8975f5c5SAndroid Build Coastguard Worker      executable_args += [
432*8975f5c5SAndroid Build Coastguard Worker        "--board",
433*8975f5c5SAndroid Build Coastguard Worker        cros_board,
434*8975f5c5SAndroid Build Coastguard Worker      ]
435*8975f5c5SAndroid Build Coastguard Worker
436*8975f5c5SAndroid Build Coastguard Worker      _cros_is_vm = false
437*8975f5c5SAndroid Build Coastguard Worker      foreach(b, string_split(cros_boards_with_qemu_images, ":")) {
438*8975f5c5SAndroid Build Coastguard Worker        if (cros_board == b) {
439*8975f5c5SAndroid Build Coastguard Worker          _cros_is_vm = true
440*8975f5c5SAndroid Build Coastguard Worker        }
441*8975f5c5SAndroid Build Coastguard Worker      }
442*8975f5c5SAndroid Build Coastguard Worker      if (_cros_is_vm) {
443*8975f5c5SAndroid Build Coastguard Worker        executable_args += [ "--use-vm" ]
444*8975f5c5SAndroid Build Coastguard Worker      } else {
445*8975f5c5SAndroid Build Coastguard Worker        executable_args += [ "--flash" ]
446*8975f5c5SAndroid Build Coastguard Worker      }
447*8975f5c5SAndroid Build Coastguard Worker    }
448*8975f5c5SAndroid Build Coastguard Worker
449*8975f5c5SAndroid Build Coastguard Worker    # If we have public Chromium builds, use public Chromium OS images when
450*8975f5c5SAndroid Build Coastguard Worker    # flashing the test device.
451*8975f5c5SAndroid Build Coastguard Worker    if (!is_chrome_branded) {
452*8975f5c5SAndroid Build Coastguard Worker      executable_args += [ "--public-image" ]
453*8975f5c5SAndroid Build Coastguard Worker    }
454*8975f5c5SAndroid Build Coastguard Worker
455*8975f5c5SAndroid Build Coastguard Worker    if (deploy_chrome && !defined(test_exe)) {
456*8975f5c5SAndroid Build Coastguard Worker      executable_args += [ "--deploy-chrome" ]
457*8975f5c5SAndroid Build Coastguard Worker    }
458*8975f5c5SAndroid Build Coastguard Worker
459*8975f5c5SAndroid Build Coastguard Worker    # executable_args should be finished, now build the data and deps lists.
460*8975f5c5SAndroid Build Coastguard Worker    deps = [ "//testing/buildbot/filters:chromeos_filters" ]
461*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.deps)) {
462*8975f5c5SAndroid Build Coastguard Worker      deps += invoker.deps
463*8975f5c5SAndroid Build Coastguard Worker    }
464*8975f5c5SAndroid Build Coastguard Worker    data = [
465*8975f5c5SAndroid Build Coastguard Worker      "//.vpython3",
466*8975f5c5SAndroid Build Coastguard Worker
467*8975f5c5SAndroid Build Coastguard Worker      # We use android test-runner's results libs to construct gtest output
468*8975f5c5SAndroid Build Coastguard Worker      # json.
469*8975f5c5SAndroid Build Coastguard Worker      "//build/android/pylib/__init__.py",
470*8975f5c5SAndroid Build Coastguard Worker      "//build/android/pylib/base/",
471*8975f5c5SAndroid Build Coastguard Worker      "//build/android/pylib/results/",
472*8975f5c5SAndroid Build Coastguard Worker      "//build/chromeos/",
473*8975f5c5SAndroid Build Coastguard Worker      "//build/util/",
474*8975f5c5SAndroid Build Coastguard Worker      "//third_party/chromite/",
475*8975f5c5SAndroid Build Coastguard Worker    ]
476*8975f5c5SAndroid Build Coastguard Worker
477*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.data)) {
478*8975f5c5SAndroid Build Coastguard Worker      data += invoker.data
479*8975f5c5SAndroid Build Coastguard Worker    }
480*8975f5c5SAndroid Build Coastguard Worker
481*8975f5c5SAndroid Build Coastguard Worker    data_deps = [ "//testing:test_scripts_shared" ]
482*8975f5c5SAndroid Build Coastguard Worker    if (cros_sdk_version != "") {
483*8975f5c5SAndroid Build Coastguard Worker      data_deps += [ ":" + target_name + "_cros_deps__helper" ]
484*8975f5c5SAndroid Build Coastguard Worker    }
485*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.data_deps)) {
486*8975f5c5SAndroid Build Coastguard Worker      data_deps += invoker.data_deps
487*8975f5c5SAndroid Build Coastguard Worker    }
488*8975f5c5SAndroid Build Coastguard Worker  }
489*8975f5c5SAndroid Build Coastguard Worker}
490*8975f5c5SAndroid Build Coastguard Worker
491*8975f5c5SAndroid Build Coastguard Worker# Handy template to define a generated_script test prepended with the
492*8975f5c5SAndroid Build Coastguard Worker# cros_test_wrapper, which will automatically handle spinning up a CrOS VM
493*8975f5c5SAndroid Build Coastguard Worker# and/or deploying the browser to the DUT prior to test execution.
494*8975f5c5SAndroid Build Coastguard Workertemplate("cros_test_wrapper_script_test") {
495*8975f5c5SAndroid Build Coastguard Worker  generate_wrapper("${target_name}") {
496*8975f5c5SAndroid Build Coastguard Worker    forward_variables_from(invoker,
497*8975f5c5SAndroid Build Coastguard Worker                           "*",
498*8975f5c5SAndroid Build Coastguard Worker                           [
499*8975f5c5SAndroid Build Coastguard Worker                             "args",
500*8975f5c5SAndroid Build Coastguard Worker                             "data_deps",
501*8975f5c5SAndroid Build Coastguard Worker                           ])
502*8975f5c5SAndroid Build Coastguard Worker    executable = "$root_out_dir/bin/cros_test_wrapper"
503*8975f5c5SAndroid Build Coastguard Worker    wrapper_script = "$root_out_dir/bin/run_${target_name}"
504*8975f5c5SAndroid Build Coastguard Worker    testonly = true
505*8975f5c5SAndroid Build Coastguard Worker
506*8975f5c5SAndroid Build Coastguard Worker    executable_args = []
507*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.args)) {
508*8975f5c5SAndroid Build Coastguard Worker      executable_args += invoker.args
509*8975f5c5SAndroid Build Coastguard Worker    }
510*8975f5c5SAndroid Build Coastguard Worker
511*8975f5c5SAndroid Build Coastguard Worker    data_deps = [ "//chromeos:cros_test_wrapper" ]
512*8975f5c5SAndroid Build Coastguard Worker    if (defined(invoker.data_deps)) {
513*8975f5c5SAndroid Build Coastguard Worker      data_deps += invoker.data_deps
514*8975f5c5SAndroid Build Coastguard Worker    }
515*8975f5c5SAndroid Build Coastguard Worker  }
516*8975f5c5SAndroid Build Coastguard Worker}
517*8975f5c5SAndroid Build Coastguard Worker
518*8975f5c5SAndroid Build Coastguard Workertemplate("tast_test") {
519*8975f5c5SAndroid Build Coastguard Worker  forward_variables_from(invoker, "*")
520*8975f5c5SAndroid Build Coastguard Worker
521*8975f5c5SAndroid Build Coastguard Worker  # Default the expression to match any chrome-related test.
522*8975f5c5SAndroid Build Coastguard Worker  if (!defined(tast_attr_expr) && !defined(tast_tests)) {
523*8975f5c5SAndroid Build Coastguard Worker    # The following expression filters out all non-critical tests. See the link
524*8975f5c5SAndroid Build Coastguard Worker    # below for more details:
525*8975f5c5SAndroid Build Coastguard Worker    # https://chromium.googlesource.com/chromiumos/platform/tast/+/main/docs/test_attributes.md
526*8975f5c5SAndroid Build Coastguard Worker    tast_attr_expr = "\"group:mainline\" && \"dep:chrome\""
527*8975f5c5SAndroid Build Coastguard Worker
528*8975f5c5SAndroid Build Coastguard Worker    if (defined(enable_tast_informational_tests) &&
529*8975f5c5SAndroid Build Coastguard Worker        enable_tast_informational_tests) {
530*8975f5c5SAndroid Build Coastguard Worker      tast_attr_expr += " && informational"
531*8975f5c5SAndroid Build Coastguard Worker    } else {
532*8975f5c5SAndroid Build Coastguard Worker      tast_attr_expr += " && !informational"
533*8975f5c5SAndroid Build Coastguard Worker    }
534*8975f5c5SAndroid Build Coastguard Worker    if (!is_chrome_branded) {
535*8975f5c5SAndroid Build Coastguard Worker      tast_attr_expr += " && !\"dep:chrome_internal\""
536*8975f5c5SAndroid Build Coastguard Worker    }
537*8975f5c5SAndroid Build Coastguard Worker  } else {
538*8975f5c5SAndroid Build Coastguard Worker    assert(defined(tast_attr_expr) != defined(tast_tests),
539*8975f5c5SAndroid Build Coastguard Worker           "Specify one of tast_tests or tast_attr_expr.")
540*8975f5c5SAndroid Build Coastguard Worker  }
541*8975f5c5SAndroid Build Coastguard Worker
542*8975f5c5SAndroid Build Coastguard Worker  _data_deps = [
543*8975f5c5SAndroid Build Coastguard Worker    "//:chromiumos_preflight",  # Builds the browser.
544*8975f5c5SAndroid Build Coastguard Worker    "//chromeos:cros_chrome_deploy",  # Adds additional browser run-time deps.
545*8975f5c5SAndroid Build Coastguard Worker
546*8975f5c5SAndroid Build Coastguard Worker    # Tools used to symbolize Chrome crash dumps.
547*8975f5c5SAndroid Build Coastguard Worker    # TODO(crbug.com/40160552): Remove these if/when all tests pick them up by
548*8975f5c5SAndroid Build Coastguard Worker    # default.
549*8975f5c5SAndroid Build Coastguard Worker    "//third_party/breakpad:dump_syms",
550*8975f5c5SAndroid Build Coastguard Worker    "//third_party/breakpad:minidump_dump",
551*8975f5c5SAndroid Build Coastguard Worker    "//third_party/breakpad:minidump_stackwalk",
552*8975f5c5SAndroid Build Coastguard Worker  ]
553*8975f5c5SAndroid Build Coastguard Worker  _data = [ "//components/crash/content/tools/generate_breakpad_symbols.py" ]
554*8975f5c5SAndroid Build Coastguard Worker
555*8975f5c5SAndroid Build Coastguard Worker  if (is_skylab) {
556*8975f5c5SAndroid Build Coastguard Worker    generate_skylab_tast_filter(target_name) {
557*8975f5c5SAndroid Build Coastguard Worker      # chromite.deploy_chrome is needed for sideloading Chrome.
558*8975f5c5SAndroid Build Coastguard Worker      data = _data + [ "//third_party/chromite/" ]
559*8975f5c5SAndroid Build Coastguard Worker      data_deps = _data_deps
560*8975f5c5SAndroid Build Coastguard Worker
561*8975f5c5SAndroid Build Coastguard Worker      # To disable a test on specific milestones, add it to the appropriate
562*8975f5c5SAndroid Build Coastguard Worker      # collection in the following file
563*8975f5c5SAndroid Build Coastguard Worker      tast_control = "//chromeos/tast_control.gni"
564*8975f5c5SAndroid Build Coastguard Worker    }
565*8975f5c5SAndroid Build Coastguard Worker  } else {
566*8975f5c5SAndroid Build Coastguard Worker    # Append any disabled tests to the expression.
567*8975f5c5SAndroid Build Coastguard Worker    if (defined(tast_disabled_tests)) {
568*8975f5c5SAndroid Build Coastguard Worker      assert(defined(tast_attr_expr),
569*8975f5c5SAndroid Build Coastguard Worker             "tast_attr_expr must be used when specifying tast_disabled_tests.")
570*8975f5c5SAndroid Build Coastguard Worker      foreach(_test_name, tast_disabled_tests) {
571*8975f5c5SAndroid Build Coastguard Worker        tast_attr_expr += " && !\"name:${_test_name}\""
572*8975f5c5SAndroid Build Coastguard Worker      }
573*8975f5c5SAndroid Build Coastguard Worker    }
574*8975f5c5SAndroid Build Coastguard Worker    if (defined(tast_attr_expr)) {
575*8975f5c5SAndroid Build Coastguard Worker      tast_attr_expr = "( " + tast_attr_expr + " )"
576*8975f5c5SAndroid Build Coastguard Worker    }
577*8975f5c5SAndroid Build Coastguard Worker    generate_runner_script(target_name) {
578*8975f5c5SAndroid Build Coastguard Worker      testonly = true
579*8975f5c5SAndroid Build Coastguard Worker      generated_script = "$root_build_dir/bin/run_${target_name}"
580*8975f5c5SAndroid Build Coastguard Worker      runtime_deps_file = "$root_out_dir/${target_name}.runtime_deps"
581*8975f5c5SAndroid Build Coastguard Worker      deploy_chrome = true
582*8975f5c5SAndroid Build Coastguard Worker      data_deps = _data_deps
583*8975f5c5SAndroid Build Coastguard Worker      data = _data
584*8975f5c5SAndroid Build Coastguard Worker    }
585*8975f5c5SAndroid Build Coastguard Worker  }
586*8975f5c5SAndroid Build Coastguard Worker}
587