| # 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/pigweed.gni") |
| |
| import("${chip_root}/build/chip/chip_test_suite.gni") |
| import("${chip_root}/src/app/icd/icd.gni") |
| import("${chip_root}/src/crypto/crypto.gni") |
| import("${chip_root}/src/platform/device.gni") |
| |
| static_library("helpers") { |
| output_name = "libAppTestHelpers" |
| output_dir = "${root_out_dir}/lib" |
| |
| sources = [ |
| "${chip_root}/src/app/reporting/tests/MockReportScheduler.cpp", |
| "AppTestContext.cpp", |
| "AppTestContext.h", |
| ] |
| |
| cflags = [ "-Wconversion" ] |
| |
| deps = [ |
| "${chip_root}/src/access", |
| "${chip_root}/src/app", |
| "${chip_root}/src/lib/support", |
| "${chip_root}/src/transport/raw/tests:helpers", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/lib/support/tests:pw-test-macros", |
| "${chip_root}/src/messaging/tests:helpers", |
| ] |
| } |
| |
| source_set("binding-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/bindings/PendingNotificationMap.cpp", |
| "${chip_root}/src/app/clusters/bindings/PendingNotificationMap.h", |
| "${chip_root}/src/app/util/binding-table.cpp", |
| "${chip_root}/src/app/util/binding-table.h", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/util/mock:mock_codegen_data_model", |
| "${chip_root}/src/app/util/mock:mock_ember", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("ota-requestor-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp", |
| "${chip_root}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.h", |
| "${chip_root}/src/app/clusters/ota-requestor/OTARequestorStorage.h", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("thread-network-directory-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.cpp", |
| "${chip_root}/src/app/clusters/thread-network-directory-server/DefaultThreadNetworkDirectoryStorage.h", |
| "${chip_root}/src/app/clusters/thread-network-directory-server/ThreadNetworkDirectoryStorage.h", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("time-sync-data-provider-test-srcs") { |
| sources = [ "${chip_root}/src/app/clusters/time-synchronization-server/TimeSyncDataProvider.cpp" ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("power-cluster-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/power-source-server/power-source-server.cpp", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/app/util/mock:mock_codegen_data_model", |
| "${chip_root}/src/app/util/mock:mock_ember", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("scenes-table-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/scenes-server/ExtensionFieldSets.h", |
| "${chip_root}/src/app/clusters/scenes-server/ExtensionFieldSetsImpl.cpp", |
| "${chip_root}/src/app/clusters/scenes-server/ExtensionFieldSetsImpl.h", |
| "${chip_root}/src/app/clusters/scenes-server/SceneHandlerImpl.cpp", |
| "${chip_root}/src/app/clusters/scenes-server/SceneHandlerImpl.h", |
| "${chip_root}/src/app/clusters/scenes-server/SceneTable.h", |
| "${chip_root}/src/app/clusters/scenes-server/SceneTableImpl.cpp", |
| "${chip_root}/src/app/clusters/scenes-server/SceneTableImpl.h", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app", |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/app/util/mock:mock_codegen_data_model", |
| "${chip_root}/src/app/util/mock:mock_ember", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("operational-state-test-srcs") { |
| sources = [ "${chip_root}/src/app/clusters/operational-state-server/operational-state-cluster-objects.h" ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("thread-border-router-management-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.cpp", |
| "${chip_root}/src/app/clusters/thread-border-router-management-server/thread-border-router-management-server.h", |
| "${chip_root}/src/app/clusters/thread-border-router-management-server/thread-br-delegate.h", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app", |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/app/util/mock:mock_ember", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("ecosystem-information-test-srcs") { |
| sources = [ |
| "${chip_root}/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp", |
| "${chip_root}/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h", |
| ] |
| public_deps = [ |
| "${chip_root}/src/app:interaction-model", |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/lib/core", |
| ] |
| } |
| |
| source_set("app-test-stubs") { |
| sources = [ |
| "test-ember-api.cpp", |
| "test-ember-api.h", |
| |
| # The overrides in these files are overrides from ember generated code |
| # and the data model interface is NOT aware of such functionality |
| # |
| # TODO: ideally tests should have been written via mock ember, however mock ember did |
| # not exist at that time. We should completely re-write how these tests access |
| # the data via the DataModel interface |
| "test-interaction-model-api.cpp", |
| "test-interaction-model-api.h", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/app/util/mock:mock_codegen_data_model", |
| "${chip_root}/src/app/util/mock:mock_ember", |
| "${chip_root}/src/lib/core", |
| "${chip_root}/src/lib/support", |
| ] |
| } |
| |
| chip_test_suite("tests") { |
| output_name = "libAppTests" |
| |
| test_sources = [ |
| "TestAclAttribute.cpp", |
| "TestAclEvent.cpp", |
| "TestAttributeAccessInterfaceCache.cpp", |
| "TestAttributePathExpandIterator.cpp", |
| "TestAttributePathParams.cpp", |
| "TestAttributePersistenceProvider.cpp", |
| "TestAttributeValueDecoder.cpp", |
| "TestAttributeValueEncoder.cpp", |
| "TestBasicCommandPathRegistry.cpp", |
| "TestBindingTable.cpp", |
| "TestBuilderParser.cpp", |
| "TestCheckInHandler.cpp", |
| "TestCommandHandlerInterfaceRegistry.cpp", |
| "TestCommandInteraction.cpp", |
| "TestCommandPathParams.cpp", |
| "TestConcreteAttributePath.cpp", |
| "TestDataModelSerialization.cpp", |
| "TestDefaultOTARequestorStorage.cpp", |
| "TestDefaultThreadNetworkDirectoryStorage.cpp", |
| "TestEcosystemInformationCluster.cpp", |
| "TestEventLoggingNoUTCTime.cpp", |
| "TestEventOverflow.cpp", |
| "TestEventPathParams.cpp", |
| "TestFabricScopedEventLogging.cpp", |
| "TestInteractionModelEngine.cpp", |
| "TestMessageDef.cpp", |
| "TestNumericAttributeTraits.cpp", |
| "TestOperationalStateClusterObjects.cpp", |
| "TestPendingNotificationMap.cpp", |
| "TestPendingResponseTrackerImpl.cpp", |
| "TestPowerSourceCluster.cpp", |
| "TestReadInteraction.cpp", |
| "TestReportScheduler.cpp", |
| "TestReportingEngine.cpp", |
| "TestStatusIB.cpp", |
| "TestStatusResponseMessage.cpp", |
| "TestTestEventTriggerDelegate.cpp", |
| "TestTimeSyncDataProvider.cpp", |
| "TestTimedHandler.cpp", |
| "TestWriteInteraction.cpp", |
| ] |
| |
| cflags = [ "-Wconversion" ] |
| |
| public_deps = [ |
| ":app-test-stubs", |
| ":binding-test-srcs", |
| ":ecosystem-information-test-srcs", |
| ":operational-state-test-srcs", |
| ":ota-requestor-test-srcs", |
| ":power-cluster-test-srcs", |
| ":thread-network-directory-test-srcs", |
| ":time-sync-data-provider-test-srcs", |
| "${chip_root}/src/app", |
| "${chip_root}/src/app/codegen-data-model-provider:instance-header", |
| "${chip_root}/src/app/common:cluster-objects", |
| "${chip_root}/src/app/data-model-provider/tests:encode-decode", |
| "${chip_root}/src/app/icd/client:handler", |
| "${chip_root}/src/app/icd/client:manager", |
| "${chip_root}/src/app/tests:helpers", |
| "${chip_root}/src/app/util/mock:mock_codegen_data_model", |
| "${chip_root}/src/app/util/mock:mock_ember", |
| "${chip_root}/src/lib/core", |
| "${chip_root}/src/lib/core:string-builder-adapters", |
| "${chip_root}/src/lib/support:test_utils", |
| "${chip_root}/src/lib/support:testing", |
| "${chip_root}/src/lib/support/tests:pw-test-macros", |
| ] |
| |
| if (chip_device_platform != "android") { |
| test_sources += [ |
| "TestExtensionFieldSets.cpp", |
| "TestSceneTable.cpp", |
| ] |
| public_deps += [ |
| ":power-cluster-test-srcs", |
| ":scenes-table-test-srcs", |
| ] |
| } |
| |
| if (chip_config_network_layer_ble && |
| (chip_device_platform == "linux" || chip_device_platform == "darwin")) { |
| test_sources += [ "TestCommissioningWindowManager.cpp" ] |
| public_deps += [ |
| "${chip_root}/src/app/server", |
| "${chip_root}/src/messaging/tests/echo:common", |
| ] |
| } else if (!chip_fake_platform) { |
| test_sources += [ "TestThreadBorderRouterManagementCluster.cpp" ] |
| public_deps += [ ":thread-border-router-management-test-srcs" ] |
| } |
| |
| if (!chip_fake_platform) { |
| test_sources += [ "TestFailSafeContext.cpp" ] |
| } |
| |
| # DefaultICDClientStorage assumes that raw AES key is used by the application |
| if (chip_crypto != "psa") { |
| test_sources += [ "TestDefaultICDClientStorage.cpp" ] |
| } |
| |
| if (chip_persist_subscriptions) { |
| test_sources += [ "TestSimpleSubscriptionResumptionStorage.cpp" ] |
| } |
| |
| # On NRF platforms, the allocation of a large number of pbufs in this test |
| # to exercise chunking causes it to run out of memory. For now, disable it there. |
| # |
| if (chip_device_platform != "nrfconnect") { |
| test_sources += [ "TestBufferedReadCallback.cpp" ] |
| test_sources += [ "TestClusterStateCache.cpp" ] |
| } |
| |
| # On NRF, Open IoT SDK and fake platforms we do not have a realtime clock available, so |
| # TestEventLogging.cpp would be testing the same thing as |
| # TestEventLoggingNoUTCTime, but it's not set up to deal with the timestamps |
| # being that low. |
| if (chip_device_platform != "nrfconnect" && |
| chip_device_platform != "openiotsdk" && chip_device_platform != "fake") { |
| test_sources += [ "TestEventLogging.cpp" ] |
| } |
| } |