[M120 Migration][VD] Fix UDP socket crash issue
[platform/framework/web/chromium-efl.git] / chromeos / BUILD.gn
1 # Copyright 2014 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/buildflag_header.gni")
6 import("//build/config/ui.gni")
7 import("//testing/libfuzzer/fuzzer_test.gni")
8 import("//testing/test.gni")
9 import("./features.gni")
10 import("./tast_control.gni")
11
12 if (is_chromeos_device) {
13   import("//build/config/chromeos/rules.gni")
14 }
15
16 assert(is_chromeos, "Non-Chrome-OS builds must not depend on //chromeos")
17
18 # Used by targets that compile into the implementation.
19 config("chromeos_implementation") {
20   defines = [ "CHROMEOS_IMPLEMENTATION" ]
21 }
22
23 buildflag_header("features") {
24   header = "features.h"
25   flags = [ "USE_REAL_CHROMEOS_SERVICES=$use_real_chromeos_services" ]
26 }
27
28 component("chromeos") {
29   deps = [ "//chromeos/dbus/constants" ]
30   sources = []
31
32   if (is_chromeos_ash) {
33     configs += [ ":chromeos_implementation" ]
34     if (current_cpu == "arm" || current_cpu == "x86") {
35       defines = [ "BINDER_IPC_32BIT" ]
36     }
37   }
38 }
39
40 source_set("chromeos_export") {
41   deps = [ "//base" ]
42   sources = [ "chromeos_export.h" ]
43 }
44
45 # This must be a static library instead of a source set because some of the
46 # files pull in things with dependencies that aren't linked in all cases.
47 #
48 # TODO this should probably be changed such that it links in all cases and
49 # can be converted to a source set.
50 static_library("test_support") {
51   testonly = true
52   public_deps = [ ":test_support_source_set" ]
53 }
54
55 source_set("test_support_source_set") {
56   testonly = true
57   public_deps = [
58     ":chromeos",
59     ":test_utils",
60   ]
61   deps = [
62     "//testing/gmock",
63     "//testing/gtest",
64   ]
65   if (is_chromeos_ash) {
66     deps += [
67       "//chromeos/ash/components/dbus:test_support",
68       "//chromeos/ash/components/login/login_state:test_support",
69       "//chromeos/ash/components/network:test_support",
70       "//google_apis",
71       "//net:test_support",
72       "//services/network:test_support",
73     ]
74   }
75 }
76
77 source_set("test_utils") {
78   deps = [ "//base" ]
79   sources = [
80     "test/chromeos_test_utils.cc",
81     "test/chromeos_test_utils.h",
82   ]
83 }
84
85 test("chromeos_unittests") {
86   configs += [ "//build/config/linux/dbus" ]
87
88   deps = [
89     "//base",
90     "//base/test:test_support",
91     "//build:chromeos_buildflags",
92     "//mojo/core/embedder",
93   ]
94
95   sources = [ "test/run_all_unittests.cc" ]
96
97   # Tests that are common to Ash and Lacros.
98   deps += [
99     "//chromeos/components/firewall_hole:unit_tests",
100     "//chromeos/constants:unit_tests",
101     "//chromeos/system:unit_tests",
102   ]
103
104   if (is_chromeos_ash) {
105     deps += [
106       ":test_support",
107       "//chromeos/ash/components:test_support",
108       "//chromeos/ash/components:unit_tests",
109       "//chromeos/ash/components/dbus:test_support",
110       "//chromeos/ash/components/network:test_support",
111       "//chromeos/ash/services:unit_tests",
112       "//chromeos/crosapi/cpp:unit_tests",
113       "//chromeos/crosapi/mojom:unit_tests",
114       "//chromeos/dbus:unit_tests",
115       "//chromeos/printing:unit_tests",
116       "//chromeos/process_proxy:unit_tests",
117       "//chromeos/services:unit_tests",
118       "//chromeos/startup:unit_tests",
119       "//chromeos/ui/base:unit_tests",
120       "//chromeos/utils:unit_tests",
121       "//chromeos/version:unit_tests",
122       "//components/onc",
123       "//components/prefs:test_support",
124       "//components/proxy_config",
125       "//crypto",
126       "//dbus:test_support",
127       "//google_apis",
128       "//net",
129       "//net:test_support",
130       "//services/network/public/cpp",
131       "//url",
132     ]
133   }
134
135   data = [ "test/data/" ]
136 }
137
138 # The following definitions only apply when building for a CrOS board (ie: not
139 # linux-chromeos). See the following for reference:
140 # https://chromium.googlesource.com/chromium/src/+/main/docs/chromeos_build_instructions.md
141 # https://chromium.googlesource.com/chromiumos/docs/+/main/simple_chrome_workflow.md
142 if (is_chromeos_ash && is_chromeos_device) {
143   # This builds a tool that prepares a DUT or VM for testing, which can be
144   # utilized by wrapping a host-side script test.
145   generate_runner_script("cros_test_wrapper") {
146     generated_script = "$root_build_dir/bin/cros_test_wrapper"
147
148     # Assume every time we build cros_test_wrapper, we also build chrome and
149     # want to deploy it to the DUT.
150     deploy_chrome = true
151
152     # The only targets that currently use cros_test_wrapper are Telemetry-based
153     # tests, which have their own crash/symbolization handling code. So, strip
154     # Chrome before deploying in order to save disk space and avoid potential
155     # memory issues on 32-bit devices.
156     strip_chrome = true
157   }
158
159   tast_test("chrome_login_tast_tests") {
160     tast_tests = [
161       "ui.ChromeCrashLoggedIn",
162       "ui.ChromeCrashNotLoggedIn",
163     ]
164   }
165
166   # Used to report the size of various partitions. For more details, see:
167   # https://source.chromium.org/search?q=report_disk_usage.go
168   tast_test("disk_usage_tast_test") {
169     tast_tests = [ "platform.ReportDiskUsage" ]
170   }
171
172   # Tast test sources live in the Chromium OS repository.
173   # To diagnose tast failures or disable tests, see go/tast-failures
174   # For any builders that run this target, it should also build Lacros.
175   tast_test("chrome_all_tast_tests") {
176     if (is_skylab) {
177       # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration.
178       tast_attr_expr = "(\"group:mainline\" && \"dep:chrome\" && !\"dep:no_chrome_dcheck\" && !informational)"
179     } else {
180       deploy_lacros_chrome = true
181     }
182
183     # To disable a specific test, add it to the
184     # tast_disabled_tests_from_chrome_all list in "tast_control.gni" and cite
185     # a bug.
186     tast_disabled_tests = tast_disabled_tests_from_chrome_all
187   }
188
189   tast_test("chrome_all_tast_tests_informational") {
190     enable_tast_informational_tests = true
191   }
192
193   tast_test("chrome_criticalstaging_tast_tests") {
194     if (is_skylab) {
195       # TODO(b/284405976): Add a !no_chrome_dcheck condition automatically by reading the build configuration.
196       # TODO(b/294489383): Re-enable lacros tests once lacros chrome is deployed to ash skylab builders.
197       tast_attr_expr = "(\"group:mainline\" && \"dep:chrome\" && !\"dep:no_chrome_dcheck\" && !\"dep:lacros\" && \"informational\" && \"group:criticalstaging\")"
198     } else {
199       deploy_lacros_chrome = true
200     }
201
202     # To disable a specific test, add it to the
203     # tast_disabled_tests_from_chrome_all list in "tast_control.gni" and cite
204     # a bug.
205     tast_disabled_tests = tast_disabled_tests_from_chrome_all
206   }
207
208   tast_test("chrome_disabled_tast_tests") {
209     tast_tests = tast_disabled_tests_from_chrome_all
210   }
211
212   tast_test("chrome_variations_tast_tests") {
213     tast_tests = [ "ui.ChromeVariationsSmoke" ]
214   }
215
216   group("cros_chrome_deploy") {
217     # The following run-time dependencies are needed to deploy chrome to a
218     # ChromeOS device. See the link for the full list:
219     # https://codesearch.chromium.org/chromium/src/third_party/chromite/lib/chrome_util.py?l=341
220     # Most of these are copy targets, for which GN doesn't add their outputs
221     # as runtime-deps. See the link below for more details:
222     # https://chromium.googlesource.com/chromium/src/+/main/tools/gn/docs/reference.md#actions-and-copies
223     data_deps = [
224       "//chrome:xdg_mime",
225       "//mojo/core:shared_library_arc32",
226       "//mojo/core:shared_library_arc64",
227     ]
228
229     # TODO(bpastene): Figure out what's generating resources/chromeos/ and
230     # declare it as a dep instead of adding the dir directly.
231     data = [ "$root_out_dir/resources/chromeos/" ]
232   }
233 }