| # Copyright 2020 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/python/python_host_test.gni") |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":action_tracer_test($host_toolchain)", |
| ":output_cacher_test($host_toolchain)", |
| ":tracer_test", |
| |
| # There are known platforms where fsatrace_test fails. |
| # TODO(fxb/70879): enable when test passes on all of them |
| # ":fsatrace_test", |
| ] |
| } |
| |
| if (is_host) { |
| python_host_test("action_tracer_test") { |
| main_source = "action_tracer_test.py" |
| sources = [ "action_tracer.py" ] |
| } |
| } |
| |
| # 1. Turn on trace_action: |
| # $ fx set ... --args=build_should_trace_actions=true |
| # 2. Delete the output files to ensure that this action will run: |
| # $ rm -rf out/default/obj/build/tracer |
| # 3. Comment out either the `inputs`, or the second line of `outputs` below. |
| # 4. Build. |
| # $ fx build obj/build/tracer/tracer_test_output_1.txt |
| # You should see an error for the target below! |
| # |
| # You can also induce an error by commenting out one of the output-producing |
| # lines in tracer_test.sh. |
| action("tracer_test") { |
| script = "tracer_test.sh" |
| |
| inputs = [ "tracer_test_input.txt" ] |
| |
| outputs = [ |
| "$target_out_dir/tracer_test_output_1.txt", |
| "$target_out_dir/tracer_test_output_2.txt", |
| "$target_out_dir/tracer_test_output_3.txt", |
| ] |
| |
| args = [ |
| rebase_path(inputs[0], root_build_dir), |
| rebase_path(outputs[0], root_build_dir), |
| rebase_path(outputs[1], root_build_dir), |
| rebase_path(outputs[2], root_build_dir), |
| ] |
| } |
| |
| # Test that fsatrace is working properly on the host. |
| # If this fails, tracing is not capturing file accesses properly, |
| # and enabling action tracing is providing no coverage or diagnostic value. |
| action("fsatrace_test") { |
| script = "fsatrace_test.sh" |
| inputs = [ "//prebuilt/fsatrace/fsatrace" ] |
| outputs = [ "$target_out_dir/fsatrace_test_stamp.txt" ] |
| args = [ |
| rebase_path(inputs[0], root_build_dir), |
| rebase_path(outputs[0], root_build_dir), |
| ] |
| } |
| |
| if (is_host) { |
| python_host_test("output_cacher_test") { |
| main_source = "output_cacher_test.py" |
| sources = [ "output_cacher.py" ] |
| } |
| } |