| # Copyright 2021 The Pigweed 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 |
| # |
| # https://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/pigweed.gni") |
| |
| import("$dir_pw_build/python.gni") |
| |
| # A hardware-in-the-loop (HIL) test. |
| # |
| # The HIL tests are assumed to require exclusive access to a device-under-test, |
| # and are always executed serially. |
| # |
| # Args: |
| # target_type: The type of underlying target that implements the HIL |
| # test. Currently "python" is the only supported value, producing a |
| # "py_python_script". Support for other languages will be added in the |
| # future. |
| template("pw_hil_test") { |
| assert(defined(invoker.target_type), |
| "pw_hil_test must specify the 'target_type'") |
| if (invoker.target_type == "python") { |
| pw_python_script(target_name) { |
| action = { |
| pool = "$dir_pw_build/pool:pw_hil_test($default_toolchain)" |
| stamp = true |
| |
| # We want the test stdout to be saved. |
| capture_output = false |
| } |
| forward_variables_from(invoker, "*", [ "target_type" ]) |
| } |
| } |
| } |