1 # Copyright (c) 2020 Project CHIP Authors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 import("//build_overrides/build.gni")
16 import("//build_overrides/chip.gni")
17 import("//build_overrides/pigweed.gni")
19 import("$dir_pw_build/python_action.gni")
21 import("${chip_root}/build/chip/tests.gni")
22 import("${chip_root}/src/platform/device.gni")
23 import("${dir_pw_unit_test}/test.gni")
25 assert(chip_build_tests)
27 if (chip_link_tests) {
28 template("chip_test") {
29 _test_name = target_name
31 _test_output_dir = "${root_out_dir}/tests"
32 if (defined(invoker.output_dir)) {
33 _test_output_dir = invoker.output_dir
36 executable(_test_name) {
37 forward_variables_from(invoker, "*", [ "output_dir" ])
38 output_dir = _test_output_dir
41 group(_test_name + "_lib") {
44 pw_python_action(_test_name + "_run") {
45 deps = [ ":${_test_name}" ]
46 inputs = [ pw_unit_test_AUTOMATIC_RUNNER ]
47 script = "$dir_pw_unit_test/py/pw_unit_test/test_runner.py"
50 rebase_path(pw_unit_test_AUTOMATIC_RUNNER, root_build_dir),
52 rebase_path("$_test_output_dir/$_test_name", root_build_dir),
58 template("chip_test") {
61 group(target_name + "_lib") {
63 not_needed(invoker, "*")