# 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/nlfaultinjection.gni")
import("//build_overrides/pigweed.gni")

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

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

config("tests_config") {
  include_dirs = [ "." ]
}

static_library("helpers") {
  output_name = "libInetTestHelpers"
  output_dir = "${root_out_dir}/lib"

  sources = [
    "TestInetCommon.h",
    "TestInetCommonOptions.cpp",
    "TestInetCommonOptions.h",
    "TestInetCommonPosix.cpp",
    "TestInetLayerCommon.cpp",
    "TestInetLayerCommon.hpp",
    "TestSetupSignalling.h",
    "TestSetupSignallingPosix.cpp",
  ]

  cflags = [ "-Wconversion" ]

  public_deps = [
    "${chip_root}/src/inet",
    "${chip_root}/src/lib/core",
    "${chip_root}/src/platform",
  ]

  if (chip_with_nlfaultinjection) {
    sources += [
      "TestSetupFaultInjection.h",
      "TestSetupFaultInjectionPosix.cpp",
    ]
  }
}

if (chip_build_tests) {
  chip_test_suite("tests") {
    output_name = "libInetLayerTests"

    public_configs = [ ":tests_config" ]

    public_deps = [
      ":helpers",
      "${chip_root}/src/inet",
      "${chip_root}/src/lib/core",
      "${chip_root}/src/lib/core:string-builder-adapters",
    ]
    test_sources = [
      "TestBasicPacketFilters.cpp",
      "TestInetAddress.cpp",
      "TestInetErrorStr.cpp",
    ]
    sources = []

    if (chip_system_config_use_sockets && current_os != "zephyr") {
      test_sources += [ "TestInetEndPoint.cpp" ]
    }

    cflags = [ "-Wconversion" ]
  }
}

executable("inet-layer-test-tool") {
  sources = [ "inet-layer-test-tool.cpp" ]

  cflags = [ "-Wconversion" ]

  public_deps = [
    ":helpers",
    "${chip_root}/src/inet",
    "${chip_root}/src/lib/core",
    "${chip_root}/src/platform",
    "${chip_root}/src/platform/logging:default",
  ]

  output_dir = root_out_dir
}
