blob: 35cd7034906aef22dbe5251c4cc27e0ee4bf7138 [file]
# Copyright 2023 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/compiled_action.gni")
import("//build/rust/rustc_binary.gni")
import("//build/testing/golden_files.gni")
rustc_binary("fxt_pretty_printer") {
testonly = true
edition = "2024"
source_root = "src/pretty_printer.rs"
sources = [ source_root ]
deps = [
"//src/performance/lib/fxt/rust",
"//third_party/rust_crates:argh",
]
}
golden_test_defs = [
{
name = "simple_trace"
fxt = "//src/performance/trace2json/test_data/simple_trace.fxt"
golden = "simple_trace.golden.txt"
},
{
name = "example_benchmark"
fxt = "//src/performance/trace2json/test_data/example_benchmark.fxt"
golden = "example_benchmark.golden.txt"
},
{
name = "perfetto_golden"
fxt = "data/perfetto_golden.fxt"
golden = "perfetto_golden.golden.txt"
},
]
golden_deps = []
golden_comparisons = []
foreach(golden_test, golden_test_defs) {
_action_name = "convert_${golden_test.name}_to_txt"
_text_output = "${target_out_dir}/${golden_test.name}.txt"
compiled_action(_action_name) {
testonly = true
tool = ":fxt_pretty_printer"
args = [
"--input",
rebase_path(golden_test.fxt, root_build_dir),
"--output",
rebase_path(_text_output, root_build_dir),
]
inputs = [ golden_test.fxt ]
outputs = [ _text_output ]
}
golden_deps += [ ":${_action_name}" ]
golden_comparisons += [
{
golden = golden_test.golden
candidate = _text_output
},
]
}
golden_files("goldens") {
testonly = true
comparisons = golden_comparisons
deps = golden_deps
}