# 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,
]
}
}