blob: b5b32f24d0b0b7b4a586a58688f3761acc606c24 [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, "*")
}
}