1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
build / config / ios / ios_test_runner_wrapper.gni [blame]
# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/coverage/coverage.gni")
import("//build/config/ios/ios_sdk.gni")
import("//build/util/generate_wrapper.gni")
# Invokes generate_wrapper to create an executable script wrapping iOS'
# run.py with baked in arguments. Only takes effect when test entry in
# gn_isolate_map.pyl is updated to type="generated_script" with script
# set to the wrapper output path.
#
# Arguments:
#
# clones
# (optional) number of ios simulator clones to execute tests on
# in parallel
#
# data
# (optional, default [ "//ios/build/bots/scripts/" ]) list of files or
# directories required to run target
#
# data_deps
# (optional) list of target non-linked labels
#
# deps
# (optional) list of files or directories required to run target
#
# executable_args
# (optional) a list of string arguments to pass to run.py
#
# retries
# (optional, default 3) number of retry attempts
#
# shards
# (optional) number of ios simulator clones to execute tests in parallel. not
# the same as swarming shards. Only used if clones is not provided. Will be
# deprecated.
#
# wrapper_output_name
# (optional, default "run_${target_name}") name of the wrapper script
#
template("ios_test_runner_wrapper") {
generate_wrapper(target_name) {
forward_variables_from(invoker,
[
"deps",
"retries",
"shards",
"wrapper_output_name",
])
testonly = true
executable = "//testing/test_env.py"
# iOS main test runner
_runner_path =
rebase_path("//ios/build/bots/scripts/run.py", root_build_dir)
executable_args = [ "@WrappedPath(${_runner_path})" ]
# arguments passed to run.py
if (defined(invoker.executable_args)) {
executable_args += invoker.executable_args
}
_rebased_mac_toolchain = rebase_path("//mac_toolchain", root_build_dir)
_rebased_xcode_path = rebase_path("//Xcode.app", root_build_dir)
_rebased_ios_runtime_cache_prefix =
rebase_path("//Runtime-ios-", root_build_dir)
# --out-dir argument is specified in gn_isolate_map.pyl because
# ${ISOLATED_OUTDIR} doesn't get resolved through this wrapper.
executable_args += [
"--xcode-path",
"@WrappedPath(${_rebased_xcode_path})",
"--mac-toolchain-cmd",
"@WrappedPath(${_rebased_mac_toolchain})",
"--runtime-cache-prefix",
"@WrappedPath(${_rebased_ios_runtime_cache_prefix})",
]
# Default retries to 3
if (!defined(retries)) {
retries = 3
}
executable_args += [
"--retries",
"${retries}",
]
# Clones is not required by test runner so only pass if defined.
if (defined(clones)) {
executable_args += [
"--clones",
"${clones}",
]
}
if (xcode_version_int >= 1400) {
executable_args += [
"--readline-timeout",
"600",
]
}
data_deps = [ "//testing:test_scripts_shared" ]
if (defined(invoker.data_deps)) {
data_deps += invoker.data_deps
}
# test runner relies on iossim for simulator builds.
if (target_environment == "simulator") {
_rebased_root_build_dir = rebase_path("${root_build_dir}", root_build_dir)
data_deps += [ "//testing/iossim" ]
executable_args += [
"--iossim",
"@WrappedPath(${_rebased_root_build_dir}/iossim)",
]
}
if (use_clang_coverage) {
executable_args += [ "--use-clang-coverage" ]
}
if (!is_debug) {
executable_args += [ "--release" ]
}
# wrapper script output name and path
if (!defined(wrapper_output_name)) {
_wrapper_output_name = "run_${target_name}"
} else {
_wrapper_output_name = wrapper_output_name
}
wrapper_script = "${root_build_dir}/bin/${_wrapper_output_name}"
data = []
if (defined(invoker.data)) {
data += invoker.data
}
data += [
"//ios/build/bots/scripts/",
"//ios/build/bots/scripts/plugin",
# gRPC interface for iOS test plugin
"//ios/testing/plugin",
# exception reporting protos
"//build/util/lib/proto",
# Variations test utilities used by variations_runner script.
"//testing/scripts/variations_seed_access_helper.py",
"//testing/test_env.py",
]
}
}