# 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/chip.gni")

import("${chip_root}/build/chip/tests.gni")
import("${chip_root}/src/ble/ble.gni")
import("${chip_root}/src/lwip/lwip.gni")
import("${chip_root}/src/platform/device.gni")

config("includes") {
  include_dirs = [
    "include",
    ".",
    "${root_gen_dir}/include",
  ]

  defines = [ "CHIP_HAVE_CONFIG_H=1" ]

  if (chip_device_platform == "linux" || chip_device_platform == "darwin") {
    defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=${chip_enable_ble}" ]
  }
}

if (chip_build_tests) {
  import("${chip_root}/build/chip/chip_test_group.gni")

  chip_test_group("tests") {
    deps = [
      "${chip_root}/src/app/tests",
      "${chip_root}/src/crypto/tests",
      "${chip_root}/src/inet/tests",
      "${chip_root}/src/lib/asn1/tests",
      "${chip_root}/src/lib/core/tests",
      "${chip_root}/src/lib/mdns/minimal/tests",
      "${chip_root}/src/lib/support/tests",
      "${chip_root}/src/messaging/tests",
      "${chip_root}/src/protocols/bdx/tests",
      "${chip_root}/src/setup_payload/tests",
      "${chip_root}/src/system/tests",
      "${chip_root}/src/transport/raw/tests",
      "${chip_root}/src/transport/retransmit/tests",
      "${chip_root}/src/transport/tests",
    ]

    if (chip_device_platform != "none") {
      deps += [ "${chip_root}/src/lib/mdns/minimal/tests" ]
    }

    if (chip_device_platform != "esp32") {
      deps += [ "${chip_root}/src/platform/tests" ]
    }

    if (chip_config_network_layer_ble) {
      deps += [ "${chip_root}/src/ble/tests" ]
    }

    if (chip_with_lwip && chip_device_platform != "esp32") {
      deps += [ "${chip_root}/src/lwip/tests" ]
    }

    if (current_os != "zephyr" && chip_device_platform != "esp32") {
      deps += [ "${chip_root}/src/lib/shell/tests" ]
    }
  }

  if (chip_enable_happy_tests) {
    group("happy_tests") {
      deps = [
        "${chip_root}/src/test_driver/happy/tests/standalone/inet:inet_tests",
      ]
    }
  }
}
