| # Copyright 2019 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/test/test_package.gni") |
| |
| # This declares a test executable for drivers that are placed in /boot/test |
| template("driver_test_package") { |
| test_manifest = "${target_gen_dir}/meta/${target_name}.cmx" |
| manifest_label_target = "${target_name}.cmx" |
| generated_file(manifest_label_target) { |
| outputs = [ |
| test_manifest, |
| ] |
| |
| contents = { |
| program = { |
| binary = "test/${target_name}" |
| } |
| |
| # these might not be needed, but a closer env to what they |
| # ran in before moving to GN. re-evaluate |
| sandbox = { |
| features = [ |
| "deprecated-shell", |
| "deprecated-ambient-replace-as-executable", |
| ] |
| } |
| } |
| output_conversion = "json" |
| } |
| |
| test_package(target_name) { |
| deprecated_shell = "//build" |
| |
| deps = [ |
| ":$manifest_label_target", |
| ":${target_name}_gen_tests", |
| ] |
| |
| tests = [ |
| { |
| name = target_name |
| forward_variables_from(invoker, |
| [ |
| "dest", |
| "disabled", |
| ]) |
| manifest = test_manifest |
| }, |
| ] |
| } |
| |
| executable("${target_name}_gen_tests") { |
| forward_variables_from(invoker, "*") |
| target_name = "${target_name}_gen_tests" |
| testonly = true |
| } |
| } |