# 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/perfetto.gni")
import("../../../../gn/proto_library.gni")
import("../../../protozero/protozero_library.gni")

# For use_libfuzzer.
if (!build_with_chromium) {
  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:test_support",
  ]

  sources = [
    "test/cpu_reader_support.cc",
    "test/cpu_reader_support.h",
  ]
}

source_set("unittests") {
  testonly = true
  deps = [
    ":ftrace",
    ":test_messages_lite",
    ":test_messages_zero",
    ":test_support",
    "../../../../gn:default_deps",
    "../../../../gn:gtest_deps",
    "../../../../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_deps",
    "../../../../protos/perfetto/trace/ftrace:lite",
    "../../../base",
    "../../../tracing",
  ]
  sources = [
    "end_to_end_integrationtest.cc",
    "ftrace_procfs_integrationtest.cc",
  ]
}

source_set("ftrace") {
  public_deps = [
    "../../../../gn:gtest_prod_config",
    "../../../../protos/perfetto/trace/ftrace:zero",
    "../../../tracing",
  ]
  deps = [
    "../../../../gn:default_deps",
    "../../../../include/perfetto/traced",
    "../../../base",
    "../../../protozero",
  ]
  sources = [
    "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",
    "format_parser.cc",
    "format_parser.h",
    "ftrace_config.cc",
    "ftrace_config.h",
    "ftrace_config_muxer.cc",
    "ftrace_config_muxer.h",
    "ftrace_controller.cc",
    "ftrace_controller.h",
    "ftrace_procfs.cc",
    "ftrace_procfs.h",
    "proto_translation_table.cc",
    "proto_translation_table.h",
  ]
}

if (!build_with_chromium) {
  source_set("benchmarks") {
    testonly = true
    deps = [
      ":ftrace",
      ":test_support",
      "../../../../gn:default_deps",
      "//buildtools:benchmark",
    ]
    sources = [
      "cpu_reader_benchmark.cc",
    ]
  }
}

if (use_libfuzzer && !build_with_chromium) {
  executable("cpu_reader_fuzzer") {
    testonly = true
    sources = [
      "cpu_reader_fuzzer.cc",
    ]
    deps = [
      ":ftrace",
      ":test_support",
      "../../../../gn:default_deps",
    ]
    configs += [ "../../../../gn:fuzzer_config" ]
  }
}
