# 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"
  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" && 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",
    ]
  }
}
