blob: 8c0d498bb680749be367c5a11f35ae45a099bd7e [file] [log] [blame]
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/python_action.gni")
import("${chip_root}/build/chip/tests.gni")
import("${chip_root}/src/platform/device.gni")
import("${dir_pw_unit_test}/test.gni")
assert(chip_build_tests)
if (chip_link_tests) {
template("chip_test") {
_test_name = target_name
_test_output_dir = "${root_out_dir}/tests"
if (defined(invoker.output_dir)) {
_test_output_dir = invoker.output_dir
}
executable(_test_name) {
forward_variables_from(invoker, "*", [ "output_dir" ])
output_dir = _test_output_dir
}
group(_test_name + "_lib") {
}
if (chip_pw_run_tests) {
pw_python_action(_test_name + "_run") {
deps = [ ":${_test_name}" ]
inputs = [ pw_unit_test_AUTOMATIC_RUNNER ]
module = "pw_unit_test.test_runner"
python_deps = [
"$dir_pw_cli/py",
"$dir_pw_unit_test/py",
]
args = [
"--runner",
rebase_path(pw_unit_test_AUTOMATIC_RUNNER, root_build_dir),
"--test",
rebase_path("$_test_output_dir/$_test_name", root_build_dir),
]
stamp = true
}
}
}
} else {
template("chip_test") {
group(target_name) {
}
group(target_name + "_lib") {
}
not_needed(invoker, "*")
}
}