# 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") {
    }

    pw_python_action(_test_name + "_run") {
      deps = [ ":${_test_name}" ]
      inputs = [ pw_unit_test_AUTOMATIC_RUNNER ]
      script = "$dir_pw_unit_test/py/pw_unit_test/test_runner.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, "*")
  }
}
