1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87

base / tracing / BUILD.gn [blame]

# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/util/generate_wrapper.gni")
import("//build_overrides/build.gni")

if (enable_base_tracing) {
  generate_wrapper("perfetto_diff_tests") {
    testonly = true

    _protos_path = "$root_gen_dir/third_party/perfetto/protos"
    _trace_descriptor = "$_protos_path/perfetto/trace/trace.descriptor"
    _rebased_trace_descriptor = rebase_path(_trace_descriptor, root_build_dir)
    _test_extensions_descriptor =
        "$_protos_path/perfetto/trace/test_extensions.descriptor"
    _rebased_test_extensions_descriptor =
        rebase_path(_test_extensions_descriptor, root_build_dir)
    _metrics_descriptor = "$_protos_path/perfetto/metrics/metrics.descriptor"
    _rebased_metrics_descriptor =
        rebase_path(_metrics_descriptor, root_build_dir)
    _all_chrome_metrics_descriptor =
        "$_protos_path/perfetto/metrics/chrome/all_chrome_metrics.descriptor"
    _rebased_all_chrome_metrics_descriptor =
        rebase_path(_all_chrome_metrics_descriptor, root_build_dir)
    _chrome_track_event_descriptor =
        "$root_gen_dir/base/tracing/protos/chrome_track_event.descriptor"
    _rebased_chrome_track_event_descriptor =
        rebase_path(_chrome_track_event_descriptor, root_build_dir)
    _winscope_extensions_descriptor =
        "$_protos_path/perfetto/trace/android/winscope.descriptor"
    _rebased_winscope_extensions_descriptor =
        rebase_path(_winscope_extensions_descriptor, root_build_dir)

    _perfetto_script =
        rebase_path("//third_party/perfetto/tools/diff_test_trace_processor.py",
                    root_build_dir)
    _chrome_stdlib = rebase_path("//base/tracing/stdlib/chrome", root_build_dir)
    _test_dir = rebase_path("//base/tracing", root_build_dir)

    executable = "//base/tracing/test/run_perfetto_diff_tests.py"
    wrapper_script = "$root_build_dir/bin/run_perfetto_diff_tests"

    executable_args = [
      "--trace-processor-shell",
      "@WrappedPath(./trace_processor_shell)",
      "--chrome-stdlib",
      "@WrappedPath($_chrome_stdlib)",
      "--test-dir",
      "@WrappedPath($_test_dir)",
      "--trace-descriptor",
      "@WrappedPath($_rebased_trace_descriptor)",
      "--test-extensions-descriptor",
      "@WrappedPath($_rebased_test_extensions_descriptor)",
      "--metrics-descriptor",
      "@WrappedPath($_rebased_metrics_descriptor)",
      "--all-chrome-metrics-descriptor",
      "@WrappedPath($_rebased_all_chrome_metrics_descriptor)",
      "--chrome-track-event-descriptor",
      "@WrappedPath($_rebased_chrome_track_event_descriptor)",
      "--winscope-extensions-descriptor",
      "@WrappedPath($_rebased_winscope_extensions_descriptor)",
      "--script",
      "@WrappedPath($_perfetto_script)",
    ]

    data_deps = [
      "//base/tracing/protos:chrome_track_event",
      "//third_party/perfetto/protos/perfetto/metrics:descriptor",
      "//third_party/perfetto/protos/perfetto/metrics/chrome:descriptor",
      "//third_party/perfetto/protos/perfetto/trace:descriptor",
      "//third_party/perfetto/protos/perfetto/trace:test_extensions_descriptor",
      "//third_party/perfetto/src/trace_processor:trace_processor_shell",
    ]

    data = [
      "//third_party/perfetto/tools/diff_test_trace_processor.py",
      "//third_party/perfetto/python/generators/diff_tests/",
      "//base/tracing/",
      _trace_descriptor,
      _test_extensions_descriptor,
      _metrics_descriptor,
      _all_chrome_metrics_descriptor,
      _chrome_track_event_descriptor,
    ]
  }
}