1# Copyright (C) 2018 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/perfetto.gni")
16import("//build_overrides/build.gni")
17
18# For use_libfuzzer.
19if (!build_with_chromium) {
20  import("//gn/standalone/sanitizers/vars.gni")
21} else {
22  import("//build/config/sanitizers/sanitizers.gni")
23}
24
25source_set("end_to_end_integrationtests") {
26  testonly = true
27  deps = [
28    ":task_runner_thread",
29    ":task_runner_thread_delegates",
30    ":test_helper",
31    "../gn:default_deps",
32    "../gn:gtest_deps",
33    "../protos/perfetto/trace:lite",
34    "../src/base:base",
35    "../src/base:test_support",
36  ]
37  sources = [
38    "end_to_end_integrationtest.cc",
39  ]
40  if (is_android && !build_with_chromium) {
41    deps += [ "../src/base:android_task_runner" ]
42  }
43  if (start_daemons_for_testing) {
44    cflags = [ "-DPERFETTO_START_DAEMONS_FOR_TESTING" ]
45  }
46}
47
48if (use_libfuzzer) {
49  executable("end_to_end_shared_memory_fuzzer") {
50    sources = [
51      "end_to_end_shared_memory_fuzzer.cc",
52    ]
53    testonly = true
54    deps = [
55      ":task_runner_thread",
56      ":task_runner_thread_delegates",
57      ":test_helper",
58      "../gn:default_deps",
59      "../src/base:test_support",
60      "../src/protozero",
61      "../src/tracing",
62      "../src/tracing:ipc",
63    ]
64    configs += [ "../gn:fuzzer_config" ]
65  }
66}
67
68source_set("task_runner_thread") {
69  testonly = true
70  deps = [
71    "../gn:default_deps",
72    "../src/base:test_support",
73  ]
74  sources = [
75    "task_runner_thread.cc",
76    "task_runner_thread.h",
77  ]
78}
79
80source_set("task_runner_thread_delegates") {
81  testonly = true
82  deps = [
83    ":task_runner_thread",
84    "../gn:default_deps",
85    "../src/base:test_support",
86    "../src/traced/probes:probes_src",
87    "../src/tracing:ipc",
88  ]
89  sources = [
90    "fake_producer.cc",
91    "fake_producer.h",
92    "task_runner_thread_delegates.h",
93  ]
94}
95
96source_set("test_helper") {
97  testonly = true
98  public_deps = [
99    "../src/tracing:ipc",
100  ]
101  deps = [
102    ":task_runner_thread",
103    ":task_runner_thread_delegates",
104    "../gn:default_deps",
105    "../protos/perfetto/trace:lite",
106    "../src/base:test_support",
107  ]
108  sources = [
109    "test_helper.cc",
110    "test_helper.h",
111  ]
112  if (start_daemons_for_testing) {
113    cflags = [ "-DPERFETTO_START_DAEMONS_FOR_TESTING" ]
114  }
115}
116
117if (!build_with_chromium) {
118  source_set("end_to_end_benchmarks") {
119    testonly = true
120    deps = [
121      ":task_runner_thread",
122      ":task_runner_thread_delegates",
123      ":test_helper",
124      "../../gn:default_deps",
125      "../gn:gtest_deps",
126      "../protos/perfetto/trace:lite",
127      "../protos/perfetto/trace:zero",
128      "../src/base:test_support",
129      "//buildtools:benchmark",
130    ]
131    sources = [
132      "end_to_end_benchmark.cc",
133    ]
134    if (is_android && !build_with_chromium) {
135      deps += [ "../src/base:android_task_runner" ]
136    }
137    if (start_daemons_for_testing) {
138      cflags = [ "-DPERFETTO_START_DAEMONS_FOR_TESTING" ]
139    }
140  }
141
142  source_set("benchmark_main") {
143    testonly = true
144    deps = [
145      "../../gn:default_deps",
146      "//buildtools:benchmark",
147    ]
148    sources = [
149      "benchmark_main.cc",
150    ]
151  }
152}
153