blob: 18392e9f9b9803fd8e978202ee3212eea11ef1fc [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("${chip_root}/build/chip/tests.gni")
assert(chip_build_tests)
assert(chip_enable_happy_tests)
template("happy_test") {
_suite_name = target_name
_deps = invoker.deps
_test_output_dir = "${root_out_dir}/tests"
_tests = []
if (defined(invoker.tests)) {
foreach(_test, invoker.tests) {
action("${_test}_test") {
script = rebase_path("${chip_root}/scripts/tests/happy_test_wrapper.py")
data_deps = _deps
inputs = [ "${_test}.py" ]
outputs = [ "${_test_output_dir}/${_test}.testout" ]
# GN will run python under virtual env, which will cause test failed to run
args = [
"--ci=True",
"--silent=True",
"--test-bin-dir",
rebase_path("${_test_output_dir}"),
rebase_path("${_test}.py"),
]
}
_tests += [ ":${_test}_test" ]
}
}
group("${_suite_name}") {
deps = _tests
}
}