# Copyright (c) 2020-2022 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/nlunit_test.gni")

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

static_library("cert_test_vectors") {
  output_name = "libCertTestVectors"
  output_dir = "${root_out_dir}/lib"

  sources = [
    "CHIPAttCert_test_vectors.cpp",
    "CHIPAttCert_test_vectors.h",
    "CHIPCert_error_test_vectors.cpp",
    "CHIPCert_error_test_vectors.h",
    "CHIPCert_test_vectors.cpp",
    "CHIPCert_test_vectors.h",
    "CHIPCert_unit_test_vectors.cpp",
    "CHIPCert_unit_test_vectors.h",
  ]

  cflags = [ "-Wconversion" ]

  public_deps = [
    "${chip_root}/src/credentials",
    "${chip_root}/src/credentials:test_paa_store",
  ]
}

chip_test_suite_using_nltest("tests") {
  output_name = "libCredentialsTest"
  output_dir = "${root_out_dir}/lib"

  test_sources = [
    "TestCertificationDeclaration.cpp",
    "TestChipCert.cpp",
    "TestDeviceAttestationConstruction.cpp",
    "TestDeviceAttestationCredentials.cpp",
    "TestFabricTable.cpp",
    "TestGroupDataProvider.cpp",
    "TestPersistentStorageOpCertStore.cpp",
  ]

  # DUTVectors test requires <dirent.h> which is not supported on all platforms
  if (chip_device_platform != "openiotsdk") {
    test_sources += [ "TestCommissionerDUTVectors.cpp" ]
  }

  cflags = [ "-Wconversion" ]

  public_deps = [
    ":cert_test_vectors",
    "${chip_root}/src/app/tests/suites/credentials:dac_provider",
    "${chip_root}/src/controller:controller",
    "${chip_root}/src/credentials",
    "${chip_root}/src/credentials:default_attestation_verifier",
    "${chip_root}/src/lib/core",
    "${chip_root}/src/lib/support:testing",
    "${chip_root}/src/lib/support:testing_nlunit",
    "${nlunit_test_root}:nlunit-test",
  ]
}

if (enable_fuzz_test_targets) {
  chip_fuzz_target("fuzz-chip-cert") {
    sources = [ "FuzzChipCert.cpp" ]
    public_deps = [ "${chip_root}/src/credentials" ]
  }
}
