BUILD.gn 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. # Copyright 2017 The Crashpad Authors. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import("build/crashpad_buildconfig.gni")
  15. import("build/test.gni")
  16. import("util/net/tls.gni")
  17. config("crashpad_config") {
  18. include_dirs = [
  19. ".",
  20. root_gen_dir,
  21. ]
  22. }
  23. if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) {
  24. test("crashpad_tests") {
  25. deps = [
  26. "client:client_test",
  27. "minidump:minidump_test",
  28. "snapshot:snapshot_test",
  29. "test:googlemock_main",
  30. "test:test_test",
  31. "util:util_test",
  32. ]
  33. data_deps = [ "//testing/buildbot/filters:crashpad_tests_filters" ]
  34. if (!crashpad_is_ios && !crashpad_is_fuchsia) {
  35. deps += [ "handler:handler_test" ]
  36. }
  37. if (crashpad_is_in_fuchsia) {
  38. # TODO(fuchsia:46559): Fix the leaks and remove this.
  39. deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
  40. }
  41. if (crashpad_is_android) {
  42. use_raw_android_executable = true
  43. copy("crashpad_test_data") {
  44. testonly = true
  45. sources = [
  46. "test/test_paths_test_data_root.txt",
  47. "util/net/testdata/ascii_http_body.txt",
  48. "util/net/testdata/binary_http_body.dat",
  49. ]
  50. outputs = [ "$root_out_dir/crashpad_test_data/{{source}}" ]
  51. }
  52. deps += [ ":crashpad_test_data" ]
  53. extra_dist_files = [
  54. "$root_out_dir/crashpad_handler",
  55. "$root_out_dir/crashpad_test_test_multiprocess_exec_test_child",
  56. "$root_out_dir/crashpad_test_data",
  57. ]
  58. }
  59. }
  60. if (crashpad_is_in_fuchsia) {
  61. import("//build/components.gni")
  62. fuchsia_test_component("crashpad-test-component") {
  63. manifest = "test/fuchsia_crashpad_tests.cml"
  64. deps = [
  65. ":crashpad-test-resources",
  66. ":crashpad_tests",
  67. "snapshot:crashpad_snapshot_test_both_dt_hash_styles",
  68. "snapshot:crashpad_snapshot_test_module",
  69. "snapshot:crashpad_snapshot_test_module_large",
  70. "snapshot:crashpad_snapshot_test_module_small",
  71. "test:crashpad_test_test_multiprocess_exec_test_child",
  72. "util:http_transport_test_server",
  73. ]
  74. }
  75. fuchsia_test_package("crashpad-test") {
  76. test_components = [ ":crashpad-test-component" ]
  77. deps = [
  78. "//src/connectivity/network/dns:component",
  79. "//src/connectivity/network/netstack:component",
  80. ]
  81. test_specs = {
  82. log_settings = {
  83. max_severity = "FATAL"
  84. }
  85. }
  86. }
  87. _resource_files = [
  88. "test/test_paths_test_data_root.txt",
  89. "util/net/testdata/ascii_http_body.txt",
  90. "util/net/testdata/binary_http_body.dat",
  91. ]
  92. if (crashpad_use_boringssl_for_http_transport_socket) {
  93. _resource_files += [
  94. "util/net/testdata/crashpad_util_test_cert.pem",
  95. "util/net/testdata/crashpad_util_test_key.pem",
  96. ]
  97. }
  98. _resources = []
  99. foreach(resource_file, _resource_files) {
  100. _resource_file_target = string_replace(resource_file, "/", "_")
  101. resource("${_resource_file_target}") {
  102. sources = [ "${resource_file}" ]
  103. outputs = [ "data/${resource_file}" ]
  104. }
  105. _resources += [ ":${_resource_file_target}" ]
  106. }
  107. group("crashpad-test-resources") {
  108. deps = _resources
  109. }
  110. fuchsia_shell_package("crashpad-database-util") {
  111. package_name = "crashpad_database_util"
  112. deps = [ "tools:crashpad_database_util" ]
  113. }
  114. group("tests") {
  115. testonly = true
  116. deps = [ ":crashpad-test" ]
  117. }
  118. }
  119. } else if (crashpad_is_standalone || crashpad_is_external) {
  120. test("crashpad_client_test") {
  121. deps = [
  122. "client:client_test",
  123. "test:googlemock_main",
  124. ]
  125. }
  126. test("crashpad_handler_test") {
  127. deps = [
  128. "handler:handler_test",
  129. "test:googletest_main",
  130. ]
  131. if (crashpad_is_ios || crashpad_is_fuchsia) {
  132. deps -= [ "handler:handler_test" ]
  133. }
  134. }
  135. test("crashpad_minidump_test") {
  136. deps = [
  137. "minidump:minidump_test",
  138. "test:googletest_main",
  139. ]
  140. }
  141. test("crashpad_snapshot_test") {
  142. deps = [
  143. "snapshot:snapshot_test",
  144. "test:googlemock_main",
  145. ]
  146. }
  147. test("crashpad_test_test") {
  148. deps = [
  149. "test:googlemock_main",
  150. "test:test_test",
  151. ]
  152. }
  153. test("crashpad_util_test") {
  154. deps = [
  155. "test:googlemock_main",
  156. "util:util_test",
  157. ]
  158. }
  159. }
  160. if (crashpad_is_ios) {
  161. group("ios_xcuitests") {
  162. testonly = true
  163. deps = [ "test/ios:all_tests" ]
  164. }
  165. }