blob: d852fb61749e14d8551bd730159e6b1d55411d25 [file] [log] [blame]
# Copyright 2018 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.
# TODO(IN-575): Run a policy check to ensure that the spec is valid.
# TODO(joshuaseaton): Only used in package() today; consider a scheme in which
# test specs are re-used for host tests.
# Describes the target device environment in which a test should run. Associated
# JSON is written to $target_out_dir with file extension "spec.json".
#
# Parameters
#
# path
# Required: Full path to the the test.
# output_dir
# Required: Where to write the test spec.
# environments
# Optional: Target device environments in which the test should run. This is
# a list of scopes that mirror the Environment go struct found in the
# testexec package in https://fuchsia.googlesource.com/infra/infra. If not
# present, the default QEMU environment will be used.
#
template("test_spec") {
assert(defined(invoker.path), "path must be defined.")
assert(defined(invoker.output_dir), "output_dir must be defined.")
test_spec = {
test = {
name = target_name
location = invoker.path
}
if (defined(invoker.environments)) {
environments = invoker.environments
} else {
environments = [
{
device = {
type = "QEMU"
}
},
]
}
}
write_file("${invoker.output_dir}/$target_name.spec.json", test_spec, "json")
}