| # Copyright (c) 2020-2021 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_root}/config/compiler/compiler.gni") |
| import("${chip_root}/build/chip/java/config.gni") |
| import("${chip_root}/build/chip/tests.gni") |
| import("${chip_root}/src/ble/ble.gni") |
| import("${chip_root}/src/platform/device.gni") |
| import("${chip_root}/src/tracing/tracing_args.gni") |
| |
| # chip_root relative to root_build_dir for macro-prefix-map. |
| # "/." avoids trailing "/" in result when chip_root is "//" |
| build_relative_chip_root = rebase_path("${chip_root}/.", root_build_dir) |
| |
| config("includes") { |
| include_dirs = [ |
| "include", |
| ".", |
| "${root_gen_dir}/include", |
| ] |
| |
| if (chip_device_platform == "external" && |
| chip_external_platform_include_dir != "") { |
| include_dirs += [ "${chip_external_platform_include_dir}" ] |
| } |
| |
| defines = [ "CHIP_HAVE_CONFIG_H=1" ] |
| |
| # Make __FILE__ and related macros relative to chip_root |
| cflags = [ "-fmacro-prefix-map=${build_relative_chip_root}/=" ] |
| } |
| |
| if (chip_build_tests) { |
| import("${chip_root}/build/chip/chip_test_group.gni") |
| |
| chip_test_group("tests") { |
| deps = [] |
| tests = [ |
| "${chip_root}/src/access/tests", |
| "${chip_root}/src/app/data-model/tests", |
| "${chip_root}/src/app/cluster-building-blocks/tests", |
| "${chip_root}/src/app/data-model-provider/tests", |
| "${chip_root}/src/app/icd/server/tests", |
| "${chip_root}/src/crypto/tests", |
| "${chip_root}/src/inet/tests", |
| "${chip_root}/src/lib/address_resolve/tests", |
| "${chip_root}/src/lib/asn1/tests", |
| "${chip_root}/src/lib/core/tests", |
| "${chip_root}/src/lib/format/tests", |
| "${chip_root}/src/messaging/tests", |
| "${chip_root}/src/protocols/bdx/tests", |
| "${chip_root}/src/protocols/interaction_model/tests", |
| "${chip_root}/src/protocols/secure_channel/tests", |
| "${chip_root}/src/protocols/user_directed_commissioning/tests", |
| "${chip_root}/src/system/tests", |
| "${chip_root}/src/transport/retransmit/tests", |
| "${chip_root}/src/transport/tests", |
| ] |
| |
| # Skip DNSSD tests for Mbed platform due to flash memory size limitations |
| if (current_os != "mbed") { |
| tests += [ |
| "${chip_root}/src/lib/dnssd/minimal_mdns/core/tests", |
| "${chip_root}/src/lib/dnssd/minimal_mdns/responders/tests", |
| "${chip_root}/src/lib/dnssd/minimal_mdns/tests", |
| "${chip_root}/src/lib/dnssd/tests", |
| ] |
| } |
| |
| if (current_os != "zephyr" && current_os != "mbed") { |
| tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/records/tests" ] |
| } |
| |
| if (current_os != "zephyr" && current_os != "mbed") { |
| # Avoid these items from "one single binary" test executions. Once tests |
| # are split, we can re-visit this (and likely many others). |
| # |
| # In particular: "app/codegen-data-model-provider/tests" contains |
| # symbols for ember mocks which are used by other tests. |
| |
| tests += [ |
| "${chip_root}/src/app/codegen-data-model-provider/tests", |
| "${chip_root}/src/setup_payload/tests", |
| "${chip_root}/src/transport/raw/tests", |
| ] |
| } |
| |
| if (chip_device_platform != "efr32") { |
| tests += [ |
| "${chip_root}/src/app/tests", |
| "${chip_root}/src/app/util/persistence/tests", |
| ] |
| |
| # Disabled for EFR32 because _open is not implemented. |
| # https://github.com/project-chip/connectedhomeip/issues/35624 |
| tests += [ |
| "${chip_root}/src/credentials/tests", |
| "${chip_root}/src/lib/support/tests", |
| ] |
| } |
| |
| if (matter_enable_tracing_support && |
| matter_trace_config == "${chip_root}/src/tracing/multiplexed") { |
| tests += [ "${chip_root}/src/tracing/tests" ] |
| } |
| |
| if (chip_device_platform != "none") { |
| tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/tests" ] |
| } |
| |
| if (chip_device_platform != "esp32" && chip_device_platform != "ameba") { |
| tests += [ "${chip_root}/src/platform/tests" ] |
| } |
| |
| if (chip_config_network_layer_ble) { |
| tests += [ "${chip_root}/src/ble/tests" ] |
| } |
| |
| # On nrfconnect, the controller tests run into |
| # https://github.com/project-chip/connectedhomeip/issues/9630 |
| if (chip_device_platform != "nrfconnect") { |
| tests += [ "${chip_root}/src/controller/tests/data_model" ] |
| |
| # Skip controller test for Open IoT SDK |
| # https://github.com/project-chip/connectedhomeip/issues/23747 |
| if (chip_device_platform != "openiotsdk") { |
| tests += [ "${chip_root}/src/controller/tests" ] |
| } |
| } |
| |
| if (current_os != "zephyr" && current_os != "mbed" && |
| chip_device_platform != "esp32" && chip_device_platform != "ameba") { |
| tests += [ "${chip_root}/src/lib/shell/tests" ] |
| } |
| |
| if (chip_monolithic_tests) { |
| deps += [ "${chip_root}/src/lib/support:pw_tests_wrapper" ] |
| build_monolithic_library = true |
| output_name = "libCHIP_tests" |
| output_dir = "${root_out_dir}/lib" |
| } |
| } |
| |
| chip_test_group("example_tests") { |
| deps = [] |
| tests = [] |
| if (chip_device_platform != "esp32" && chip_device_platform != "efr32" && |
| current_os != "android") { |
| tests += [ "${chip_root}/examples/energy-management-app/energy-management-common/tests" ] |
| } |
| } |
| |
| chip_test_group("fake_platform_tests") { |
| tests = [ "${chip_root}/src/lib/dnssd/platform/tests" ] |
| } |
| |
| # Tests to run with each Crypto PAL |
| chip_test_group("crypto_tests") { |
| tests = [ |
| "${chip_root}/src/credentials/tests", |
| "${chip_root}/src/crypto/tests", |
| ] |
| } |
| |
| if (matter_enable_java_compilation) { |
| group("java_controller_tests") { |
| deps = [ "${chip_root}/src/controller/java:unit_tests" ] |
| } |
| } |
| } |