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.cc", 45 "test_shared_memory.h", 46 "traced_value_test_support.cc", 47 ] 48 49 # These tests rely on test_task_runner.h which 50 # has no implementation for Windows or NaCL. 51 if (!is_win && !is_nacl) { 52 sources += [ 53 "mock_consumer.cc", 54 "mock_consumer.h", 55 "mock_producer.cc", 56 "mock_producer.h", 57 "mock_producer_endpoint.h", 58 "proxy_producer_endpoint.cc", 59 "proxy_producer_endpoint.h", 60 ] 61 } 62} 63 64if (enable_perfetto_ipc && enable_perfetto_system_consumer) { 65 perfetto_unittest_source_set("tracing_integration_test") { 66 testonly = true 67 deps = [ 68 ":test_support", 69 "..:client_api_without_backends", 70 "../../../gn:default_deps", 71 "../../../gn:gtest_and_gmock", 72 "../../base", 73 "../../base:test_support", 74 "../ipc/consumer", 75 "../ipc/producer", 76 "../ipc/service", 77 "../service", 78 ] 79 sources = [ "tracing_integration_test.cc" ] 80 81 # TODO(lalitm): this tests appear to be failing on Chromium for unknown 82 # reasons. Figure out why and reenable them. 83 if (!build_with_chromium) { 84 sources += [ "platform_unittest.cc" ] 85 } 86 } 87} 88 89if (enable_perfetto_integration_tests) { 90 source_set("client_api_integrationtests") { 91 testonly = true 92 deps = [ 93 ":api_test_support", 94 "../:client_api", 95 "../../../:libperfetto_client_experimental", 96 "../../../gn:default_deps", 97 "../../../gn:gtest_and_gmock", 98 "../../../include/perfetto/tracing/core", 99 "../../../protos/perfetto/common:cpp", 100 "../../../protos/perfetto/common:zero", 101 "../../../protos/perfetto/config/track_event:cpp", 102 "../../../protos/perfetto/trace:cpp", 103 "../../../protos/perfetto/trace:zero", 104 "../../../protos/perfetto/trace/gpu:cpp", 105 "../../../protos/perfetto/trace/gpu:zero", 106 "../../../protos/perfetto/trace/interned_data:cpp", 107 "../../../protos/perfetto/trace/interned_data:zero", 108 "../../../protos/perfetto/trace/profiling:cpp", 109 "../../../protos/perfetto/trace/track_event:cpp", 110 "../../../test:integrationtest_initializer", 111 "../../base", 112 ] 113 sources = [ 114 "api_integrationtest.cc", 115 "tracing_module.cc", 116 "tracing_module.h", 117 "tracing_module2.cc", 118 "tracing_module3.cc", 119 "tracing_module_categories.h", 120 ] 121 } 122 123 # api_test_support needs to be self-contained and not leak any other perfetto 124 # deps. See comment in api_test_support.h 125 source_set("api_test_support") { 126 testonly = true 127 deps = [ 128 "../../..:libperfetto_client_experimental", 129 "../../../gn:default_deps", 130 "../../base", 131 "../../tracing:client_api_without_backends", 132 ] 133 134 # The system tracing backend requires IPC support. 135 if (enable_perfetto_ipc) { 136 deps += [ "../../../test:test_helper" ] 137 } 138 sources = [ 139 "api_test_support.cc", 140 "api_test_support.h", 141 ] 142 } 143} 144