| # Copyright (C) 2017 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("../../../../gn/fuzzer.gni") |
| import("../../../../gn/perfetto.gni") |
| import("../../../../gn/proto_library.gni") |
| import("../../../../gn/protozero_library.gni") |
| |
| # For use_libfuzzer. |
| if (perfetto_build_standalone || perfetto_build_with_android) { |
| import("//gn/standalone/sanitizers/vars.gni") |
| } else { |
| import("//build/config/sanitizers/sanitizers.gni") |
| } |
| |
| source_set("test_support") { |
| testonly = true |
| deps = [ |
| ":ftrace", |
| "../../../../gn:default_deps", |
| "../../../protozero", |
| ] |
| public_deps = [ |
| "../../../protozero", |
| ] |
| |
| sources = [ |
| "test/cpu_reader_support.cc", |
| "test/cpu_reader_support.h", |
| ] |
| } |
| |
| source_set("unittests") { |
| testonly = true |
| deps = [ |
| ":format_parser", |
| ":ftrace", |
| ":test_messages_lite", |
| ":test_messages_zero", |
| ":test_support", |
| "../../../../gn:default_deps", |
| "../../../../gn:gtest_and_gmock", |
| "../../../../protos/perfetto/trace/ftrace:lite", |
| "../../../base:test_support", |
| "../../../tracing:test_support", |
| ] |
| sources = [ |
| "cpu_reader_unittest.cc", |
| "cpu_stats_parser_unittest.cc", |
| "event_info_unittest.cc", |
| "format_parser_unittest.cc", |
| "ftrace_config_muxer_unittest.cc", |
| "ftrace_config_unittest.cc", |
| "ftrace_controller_unittest.cc", |
| "ftrace_procfs_unittest.cc", |
| "proto_translation_table_unittest.cc", |
| ] |
| } |
| |
| ftrace_reader_test_proto_sources = [ "test/test_messages.proto" ] |
| |
| protozero_library("test_messages_zero") { |
| sources = ftrace_reader_test_proto_sources |
| proto_in_dir = perfetto_root_path |
| proto_out_dir = perfetto_root_path |
| generator_plugin_options = "wrapper_namespace=pbzero" |
| } |
| |
| proto_library("test_messages_lite") { |
| generate_python = false |
| sources = ftrace_reader_test_proto_sources |
| proto_in_dir = perfetto_root_path |
| proto_out_dir = perfetto_root_path |
| } |
| |
| # These tests require access to a real ftrace implementation and must |
| # run with sudo. |
| source_set("integrationtests") { |
| testonly = true |
| deps = [ |
| ":ftrace", |
| ":test_support", |
| "../../../../gn:default_deps", |
| "../../../../gn:gtest_and_gmock", |
| "../../../../protos/perfetto/trace/ftrace:lite", |
| "../../../base", |
| "../../../tracing", |
| ] |
| sources = [ |
| "ftrace_procfs_integrationtest.cc", |
| ] |
| } |
| |
| source_set("ftrace") { |
| public_deps = [ |
| "../../../../protos/perfetto/trace/ftrace:zero", |
| "../../../tracing", |
| ] |
| deps = [ |
| ":format_parser", |
| "..:data_source", |
| "../../../../gn:default_deps", |
| "../../../../include/perfetto/ext/traced", |
| "../../../../protos/perfetto/config:lite", |
| "../../../android_internal:lazy_library_loader", |
| "../../../base", |
| "../../../protozero", |
| ] |
| sources = [ |
| "atrace_hal_wrapper.cc", |
| "atrace_hal_wrapper.h", |
| "atrace_wrapper.cc", |
| "atrace_wrapper.h", |
| "cpu_reader.cc", |
| "cpu_reader.h", |
| "cpu_stats_parser.cc", |
| "cpu_stats_parser.h", |
| "event_info.cc", |
| "event_info.h", |
| "event_info_constants.cc", |
| "event_info_constants.h", |
| "ftrace_config.cc", |
| "ftrace_config.h", |
| "ftrace_config_muxer.cc", |
| "ftrace_config_muxer.h", |
| "ftrace_config_utils.cc", |
| "ftrace_config_utils.h", |
| "ftrace_controller.cc", |
| "ftrace_controller.h", |
| "ftrace_data_source.cc", |
| "ftrace_data_source.h", |
| "ftrace_metadata.cc", |
| "ftrace_metadata.h", |
| "ftrace_procfs.cc", |
| "ftrace_procfs.h", |
| "ftrace_stats.cc", |
| "ftrace_stats.h", |
| "proto_translation_table.cc", |
| "proto_translation_table.h", |
| ] |
| } |
| |
| source_set("format_parser") { |
| deps = [ |
| "../../../../gn:default_deps", |
| "../../../base", |
| ] |
| sources = [ |
| "format_parser.cc", |
| "format_parser.h", |
| ] |
| } |
| |
| if (perfetto_build_standalone) { |
| source_set("benchmarks") { |
| testonly = true |
| deps = [ |
| ":ftrace", |
| ":test_support", |
| "../../../../gn:benchmark", |
| "../../../../gn:default_deps", |
| ] |
| sources = [ |
| "cpu_reader_benchmark.cc", |
| ] |
| } |
| } |
| |
| perfetto_fuzzer_test("cpu_reader_fuzzer") { |
| testonly = true |
| sources = [ |
| "cpu_reader_fuzzer.cc", |
| ] |
| deps = [ |
| ":ftrace", |
| ":test_support", |
| "../../../../gn:default_deps", |
| ] |
| } |