• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2019 The Android Open Source Project
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
15import("../../../gn/fuzzer.gni")
16import("../../../gn/perfetto.gni")
17import("../../../gn/test.gni")
18
19perfetto_unittest_source_set("test_support") {
20  testonly = true
21  public_deps = [
22    "../../../include/perfetto/test:test_support",
23    "../core:test_support",
24  ]
25  deps = [
26    "../../../gn:default_deps",
27    "../../../gn:gtest_and_gmock",
28    "../../../protos/perfetto/trace:cpp",
29    "../../../protos/perfetto/trace:lite",
30    "../../../protos/perfetto/trace:zero",
31    "../../../protos/perfetto/trace/ftrace:cpp",
32    "../../../protos/perfetto/trace/track_event:lite",
33    "../../base",
34    "../../base:test_support",
35    "../core",
36    "../core:test_support",
37    "../service",
38  ]
39  sources = [
40    "aligned_buffer_test.cc",
41    "aligned_buffer_test.h",
42    "fake_packet.cc",
43    "fake_packet.h",
44    "test_shared_memory.h",
45    "traced_value_test_support.cc",
46  ]
47
48  # These tests rely on test_task_runner.h which
49  # has no implementation for Windows or NaCL.
50  if (!is_win && !is_nacl) {
51    sources += [
52      "mock_consumer.cc",
53      "mock_consumer.h",
54      "mock_producer.cc",
55      "mock_producer.h",
56      "mock_producer_endpoint.h",
57    ]
58  }
59}
60
61if (enable_perfetto_ipc && enable_perfetto_system_consumer) {
62  perfetto_unittest_source_set("tracing_integration_test") {
63    testonly = true
64    deps = [
65      ":test_support",
66      "../../../gn:default_deps",
67      "../../../gn:gtest_and_gmock",
68      "../../base",
69      "../../base:test_support",
70      "../ipc/consumer",
71      "../ipc/producer",
72      "../ipc/service",
73      "../service",
74    ]
75    sources = [ "tracing_integration_test.cc" ]
76
77    # TODO(primiano): remove the build_with_chromium conditional once the root
78    # //BUILD.gn:libperfetto (in chromium) stops adding tracing:platform_fake.
79    # The problem is the following: in chrome builds we end up with duplicate
80    # symbol definitions in the test because both platorm (impl and fake) are
81    # present: impl added here and fake coming from chromium's base (full path:
82    # perfetto_unittests -> //(chromium)base:test_support -> //(chromium)base
83    # -> libperfetto -> platform_fake.
84    if (!build_with_chromium) {
85      deps += [
86        "..:client_api_without_backends",
87        "..:platform_impl",
88      ]
89      sources += [ "platform_unittest.cc" ]
90    }
91  }
92}
93
94if (enable_perfetto_integration_tests) {
95  source_set("client_api_integrationtests") {
96    testonly = true
97    deps = [
98      ":api_test_support",
99      "../:client_api",
100      "../:platform_impl",
101      "../../../:libperfetto_client_experimental",
102      "../../../gn:default_deps",
103      "../../../gn:gtest_and_gmock",
104      "../../../include/perfetto/tracing/core",
105      "../../../protos/perfetto/common:cpp",
106      "../../../protos/perfetto/common:zero",
107      "../../../protos/perfetto/config/track_event:cpp",
108      "../../../protos/perfetto/trace:cpp",
109      "../../../protos/perfetto/trace:zero",
110      "../../../protos/perfetto/trace/gpu:cpp",
111      "../../../protos/perfetto/trace/gpu:zero",
112      "../../../protos/perfetto/trace/interned_data:cpp",
113      "../../../protos/perfetto/trace/interned_data:zero",
114      "../../../protos/perfetto/trace/profiling:cpp",
115      "../../../protos/perfetto/trace/track_event:cpp",
116      "../../base",
117    ]
118    sources = [
119      "api_integrationtest.cc",
120      "api_integrationtest_main.cc",
121      "tracing_module.cc",
122      "tracing_module.h",
123      "tracing_module2.cc",
124      "tracing_module3.cc",
125      "tracing_module_categories.h",
126    ]
127  }
128
129  # api_test_support needs to be self-contained and not leak any other perfetto
130  # deps. See comment in api_test_support.h
131  source_set("api_test_support") {
132    testonly = true
133    deps = [
134      "../../..:libperfetto_client_experimental",
135      "../../../gn:default_deps",
136      "../../base",
137      "../../tracing:client_api_without_backends",
138    ]
139
140    # The system tracing backend requires IPC support.
141    if (enable_perfetto_ipc) {
142      deps += [ "../../../test:test_helper" ]
143    }
144    sources = [
145      "api_test_support.cc",
146      "api_test_support.h",
147    ]
148  }
149}
150