BUILD.gn 6.5 KB

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