Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 1 | # Copyright (C) 2017 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 | |
Hector Dearman | cc6dcb0 | 2017-12-12 16:48:43 +0000 | [diff] [blame] | 15 | import("../../gn/perfetto.gni") |
| 16 | import("../../gn/proto_library.gni") |
| 17 | import("../protozero/protozero_library.gni") |
| 18 | |
Hector Dearman | 7391c0f | 2018-02-02 14:20:09 +0000 | [diff] [blame] | 19 | # For use_libfuzzer. |
| 20 | if (!build_with_chromium) { |
| 21 | import("//gn/standalone/sanitizers/vars.gni") |
| 22 | } else { |
| 23 | import("//build/config/sanitizers/sanitizers.gni") |
| 24 | } |
| 25 | |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 26 | source_set("test_support") { |
| 27 | testonly = true |
| 28 | deps = [ |
Hector Dearman | bc8368e | 2018-01-25 17:34:11 +0000 | [diff] [blame] | 29 | ":ftrace_reader", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 30 | "../../gn:default_deps", |
| 31 | "../protozero", |
| 32 | ] |
| 33 | sources = [ |
Hector Dearman | bc8368e | 2018-01-25 17:34:11 +0000 | [diff] [blame] | 34 | "test/cpu_reader_support.cc", |
| 35 | "test/cpu_reader_support.h", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 36 | "test/scattered_stream_delegate_for_testing.cc", |
| 37 | "test/scattered_stream_delegate_for_testing.h", |
| 38 | ] |
| 39 | } |
| 40 | |
Hector Dearman | 6cfec8a | 2018-03-14 16:54:09 +0000 | [diff] [blame] | 41 | source_set("unittests") { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 42 | testonly = true |
| 43 | deps = [ |
| 44 | ":ftrace_reader", |
Hector Dearman | cc6dcb0 | 2017-12-12 16:48:43 +0000 | [diff] [blame] | 45 | ":ftrace_reader_test_messages_lite", |
| 46 | ":ftrace_reader_test_messages_zero", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 47 | ":test_support", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 48 | "../../gn:default_deps", |
| 49 | "../../gn:gtest_deps", |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 50 | "../../protos/perfetto/trace/ftrace:lite", |
Hector Dearman | 86cfbe1 | 2018-03-22 11:58:42 +0000 | [diff] [blame] | 51 | "../base:test_support", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 52 | ] |
| 53 | sources = [ |
| 54 | "cpu_reader_unittest.cc", |
Hector Dearman | 83d9803 | 2017-12-11 16:37:43 +0000 | [diff] [blame] | 55 | "event_info_unittest.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 56 | "format_parser_unittest.cc", |
Hector Dearman | 5013971 | 2018-02-23 15:43:41 +0000 | [diff] [blame] | 57 | "ftrace_config_muxer_unittest.cc", |
Hector Dearman | cb4ba32 | 2018-02-09 14:12:27 +0000 | [diff] [blame] | 58 | "ftrace_config_unittest.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 59 | "ftrace_controller_unittest.cc", |
Hector Dearman | 5013971 | 2018-02-23 15:43:41 +0000 | [diff] [blame] | 60 | "ftrace_procfs_unittest.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 61 | "proto_translation_table_unittest.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 62 | ] |
| 63 | } |
| 64 | |
Hector Dearman | cc6dcb0 | 2017-12-12 16:48:43 +0000 | [diff] [blame] | 65 | ftrace_reader_test_proto_sources = [ "test/test_messages.proto" ] |
| 66 | |
| 67 | protozero_library("ftrace_reader_test_messages_zero") { |
| 68 | sources = ftrace_reader_test_proto_sources |
| 69 | proto_in_dir = perfetto_root_path |
Oystein Eftevaag | 51e06e5 | 2018-01-18 11:28:49 -0800 | [diff] [blame] | 70 | proto_out_dir = perfetto_root_path |
Hector Dearman | cc6dcb0 | 2017-12-12 16:48:43 +0000 | [diff] [blame] | 71 | generator_plugin_options = "wrapper_namespace=pbzero" |
| 72 | } |
| 73 | |
| 74 | proto_library("ftrace_reader_test_messages_lite") { |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 75 | generate_python = false |
Hector Dearman | cc6dcb0 | 2017-12-12 16:48:43 +0000 | [diff] [blame] | 76 | sources = ftrace_reader_test_proto_sources |
| 77 | proto_in_dir = perfetto_root_path |
Oystein Eftevaag | 51e06e5 | 2018-01-18 11:28:49 -0800 | [diff] [blame] | 78 | proto_out_dir = perfetto_root_path |
Hector Dearman | cc6dcb0 | 2017-12-12 16:48:43 +0000 | [diff] [blame] | 79 | } |
| 80 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 81 | # These tests require access to a real ftrace implementation and must |
| 82 | # run with sudo. |
Lalit Maganti | 79f2d7b | 2018-01-23 18:27:33 +0000 | [diff] [blame] | 83 | source_set("ftrace_reader_integrationtests") { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 84 | testonly = true |
| 85 | deps = [ |
| 86 | ":ftrace_reader", |
Primiano Tucci | b03ba36 | 2017-12-06 09:47:41 +0000 | [diff] [blame] | 87 | ":test_support", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 88 | "../../gn:default_deps", |
| 89 | "../../gn:gtest_deps", |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 90 | "../../protos/perfetto/trace/ftrace:lite", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 91 | "../base", |
Hector Dearman | cb4ba32 | 2018-02-09 14:12:27 +0000 | [diff] [blame] | 92 | "../tracing", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 93 | ] |
| 94 | sources = [ |
| 95 | "end_to_end_integrationtest.cc", |
| 96 | "ftrace_procfs_integrationtest.cc", |
| 97 | ] |
| 98 | } |
| 99 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 100 | source_set("ftrace_reader") { |
| 101 | public_deps = [ |
Hector Dearman | 3e712a0 | 2017-12-19 16:39:59 +0000 | [diff] [blame] | 102 | "../../gn:gtest_prod_config", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 103 | "../../include/perfetto/ftrace_reader", |
Primiano Tucci | 20b760c | 2018-01-19 12:36:12 +0000 | [diff] [blame] | 104 | "../../protos/perfetto/trace/ftrace:zero", |
Hector Dearman | cb4ba32 | 2018-02-09 14:12:27 +0000 | [diff] [blame] | 105 | "../tracing", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 106 | ] |
| 107 | deps = [ |
| 108 | "../../gn:default_deps", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 109 | "../base", |
| 110 | "../protozero", |
| 111 | ] |
| 112 | sources = [ |
Hector Dearman | c20f221 | 2018-03-08 10:39:00 +0000 | [diff] [blame] | 113 | "atrace_wrapper.cc", |
| 114 | "atrace_wrapper.h", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 115 | "cpu_reader.cc", |
| 116 | "cpu_reader.h", |
Hector Dearman | 83d9803 | 2017-12-11 16:37:43 +0000 | [diff] [blame] | 117 | "event_info.cc", |
| 118 | "event_info.h", |
Hector Dearman | 7f37dc8 | 2018-01-25 12:25:40 +0000 | [diff] [blame] | 119 | "event_info_constants.cc", |
| 120 | "event_info_constants.h", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 121 | "format_parser.cc", |
Hector Dearman | cb4ba32 | 2018-02-09 14:12:27 +0000 | [diff] [blame] | 122 | "ftrace_config.cc", |
Hector Dearman | 5013971 | 2018-02-23 15:43:41 +0000 | [diff] [blame] | 123 | "ftrace_config_muxer.cc", |
| 124 | "ftrace_config_muxer.h", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 125 | "ftrace_controller.cc", |
| 126 | "ftrace_procfs.cc", |
| 127 | "ftrace_procfs.h", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 128 | "proto_translation_table.cc", |
| 129 | "proto_translation_table.h", |
| 130 | ] |
| 131 | } |
Hector Dearman | bc8368e | 2018-01-25 17:34:11 +0000 | [diff] [blame] | 132 | |
| 133 | if (!build_with_chromium) { |
| 134 | source_set("ftrace_reader_benchmarks") { |
| 135 | testonly = true |
| 136 | deps = [ |
| 137 | ":ftrace_reader", |
| 138 | ":test_support", |
| 139 | "../../gn:default_deps", |
| 140 | "//buildtools:benchmark", |
| 141 | ] |
| 142 | sources = [ |
| 143 | "cpu_reader_benchmark.cc", |
| 144 | ] |
| 145 | } |
| 146 | } |
Hector Dearman | 7391c0f | 2018-02-02 14:20:09 +0000 | [diff] [blame] | 147 | |
| 148 | if (use_libfuzzer) { |
| 149 | executable("cpu_reader_fuzzer") { |
| 150 | testonly = true |
| 151 | sources = [ |
| 152 | "cpu_reader_fuzzer.cc", |
| 153 | ] |
| 154 | deps = [ |
| 155 | ":ftrace_reader", |
| 156 | ":test_support", |
| 157 | "../../gn:default_deps", |
| 158 | ] |
| 159 | configs += [ "../../gn:fuzzer_config" ] |
| 160 | } |
| 161 | } |