# 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("${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("tests") {
  output_name = "libCredentialsTest"

  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" && chip_device_platform != "nxp") {
    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/credentials:test_dac_revocation_delegate",
    "${chip_root}/src/lib/core",
    "${chip_root}/src/lib/core:string-builder-adapters",
    "${chip_root}/src/lib/support:testing",
  ]
}

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

if (pw_enable_fuzz_test_targets) {
  chip_pw_fuzz_target("fuzz-chip-cert-pw") {
    test_source = [ "FuzzChipCertPW.cpp" ]
    public_deps = [
      "${chip_root}/src/credentials",
      "${chip_root}/src/platform/logging:default",
    ]
  }
}
