1# Copyright (C) 2020 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 19# Core tracing library, platform independent, no IPC layer, no service. 20source_set("core") { 21 public_deps = [ 22 "../../../include/perfetto/ext/tracing/core", 23 "../../protozero", 24 ] 25 deps = [ 26 "..:common", 27 "../../../gn:default_deps", 28 "../../../include/perfetto/tracing", 29 "../../../protos/perfetto/trace:zero", 30 "../../base", 31 ] 32 sources = [ 33 "id_allocator.cc", 34 "id_allocator.h", 35 "null_trace_writer.cc", 36 "null_trace_writer.h", 37 "patch_list.h", 38 "shared_memory_abi.cc", 39 "shared_memory_arbiter_impl.cc", 40 "shared_memory_arbiter_impl.h", 41 "trace_packet.cc", 42 "trace_writer_impl.cc", 43 "trace_writer_impl.h", 44 "virtual_destructors.cc", 45 ] 46} 47 48source_set("service") { 49 public_deps = [ 50 "..:common", 51 "../../../include/perfetto/ext/base", 52 "../../../include/perfetto/ext/tracing/core", 53 ] 54 deps = [ 55 ":core", 56 "../../../gn:default_deps", 57 "../../../include/perfetto/tracing", 58 "../../../protos/perfetto/common:zero", 59 "../../../protos/perfetto/config:zero", 60 "../../../protos/perfetto/trace:zero", 61 "../../../protos/perfetto/trace/perfetto:zero", # For MetatraceWriter. 62 "../../base", 63 ] 64 sources = [ 65 "metatrace_writer.cc", 66 "metatrace_writer.h", 67 "packet_stream_validator.cc", 68 "packet_stream_validator.h", 69 "trace_buffer.cc", 70 "trace_buffer.h", 71 "tracing_service_impl.cc", 72 "tracing_service_impl.h", 73 ] 74} 75 76perfetto_unittest_source_set("unittests") { 77 testonly = true 78 deps = [ 79 ":core", 80 ":service", 81 "../../../gn:default_deps", 82 "../../../gn:gtest_and_gmock", 83 "../../../protos/perfetto/trace:cpp", 84 "../../../protos/perfetto/trace:zero", 85 "../../../protos/perfetto/trace/ftrace:cpp", 86 "../../../protos/perfetto/trace/perfetto:cpp", 87 "../../base", 88 "../../base:test_support", 89 "../test:test_support", 90 ] 91 sources = [ 92 "id_allocator_unittest.cc", 93 "null_trace_writer_unittest.cc", 94 "packet_stream_validator_unittest.cc", 95 "patch_list_unittest.cc", 96 "shared_memory_abi_unittest.cc", 97 "trace_buffer_unittest.cc", 98 "trace_packet_unittest.cc", 99 ] 100 101 # These tests rely on test_task_runner.h which 102 # has no Windows implementation. 103 if (!is_win) { 104 sources += [ 105 "shared_memory_arbiter_impl_unittest.cc", 106 "trace_writer_impl_unittest.cc", 107 "tracing_service_impl_unittest.cc", 108 ] 109 } 110} 111 112perfetto_unittest_source_set("test_support") { 113 testonly = true 114 public_deps = [ 115 "../../../include/perfetto/ext/tracing/core", 116 "../../../protos/perfetto/trace:cpp", 117 "../../../protos/perfetto/trace:zero", 118 "../../protozero", 119 ] 120 sources = [ 121 "trace_writer_for_testing.cc", 122 "trace_writer_for_testing.h", 123 ] 124} 125 126if (enable_perfetto_benchmarks) { 127 source_set("benchmarks") { 128 testonly = true 129 deps = [ 130 ":core", 131 ":service", 132 "../../../../../gn:benchmark", 133 "../../../../../gn:default_deps", 134 "../../../protos/perfetto/trace:zero", 135 "../../../protos/perfetto/trace/ftrace:zero", 136 "../../protozero", 137 ] 138 sources = [ "packet_stream_validator_benchmark.cc" ] 139 } 140} 141 142perfetto_fuzzer_test("packet_stream_validator_fuzzer") { 143 sources = [ "packet_stream_validator_fuzzer.cc" ] 144 deps = [ 145 ":service", 146 "../../../../../gn:default_deps", 147 ] 148} 149