diff --git a/examples/placeholder/templates/tests-commands.zapt b/examples/placeholder/templates/tests-commands.zapt index c1d87417bc5906..be0474f4632605 100644 --- a/examples/placeholder/templates/tests-commands.zapt +++ b/examples/placeholder/templates/tests-commands.zapt @@ -4,7 +4,7 @@ #include "TestCommand.h" -#include +#include {{>test_cluster tests="../linux/apps/app1/ciTests.json" credsIssuerConfigArg=false needsWaitDuration=false}} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp index 0d493965e21829..0cbfab8b5864b8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp @@ -22,6 +22,7 @@ #include "ConversionUtils.h" #include "JNIDACProvider.h" +#include #include #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm index b19d72097f7ecc..86a1976aed7d18 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm @@ -25,10 +25,10 @@ #import "MatterCallbacks.h" #import "OnboardingPayload.h" +#include #include #include #include -#include #include #include diff --git a/scripts/tools/check_includes_config.py b/scripts/tools/check_includes_config.py index abe2c0ed42f5af..b4e933f193583c 100644 --- a/scripts/tools/check_includes_config.py +++ b/scripts/tools/check_includes_config.py @@ -93,7 +93,7 @@ 'vector', # CHIP headers using STL containers. - 'lib/support/CHIPListUtils.h', # uses std::set + 'app/data-model/ListLargeSystemExtensions.h', # uses std::set 'src/platform/DeviceSafeQueue.h', # uses std::deque } @@ -113,7 +113,7 @@ 'src/lib/support/IniEscaping.h': {'string'}, # Itself in DENY. - 'src/lib/support/CHIPListUtils.h': {'set'}, + 'src/app/data-model/ListLargeSystemExtensions.h': {'set'}, 'src/platform/DeviceSafeQueue.h': {'queue'}, # Only uses for zero-cost types. diff --git a/src/lib/support/CHIPListUtils.h b/src/app/data-model/ListLargeSystemExtensions.h similarity index 90% rename from src/lib/support/CHIPListUtils.h rename to src/app/data-model/ListLargeSystemExtensions.h index 95e063a49581b7..fca49dd698939a 100644 --- a/src/lib/support/CHIPListUtils.h +++ b/src/app/data-model/ListLargeSystemExtensions.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2024 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. @@ -15,10 +15,12 @@ * limitations under the License. */ -#ifndef CHIP_LISTUTILS_INTERNAL_H -#define CHIP_LISTUTILS_INTERNAL_H +#pragma once +// NOTE: Functionality in this class uses HEAP and std::set. It is generally +// intended for large systems only #include + #include #include @@ -27,6 +29,7 @@ template struct ListMemberTypeGetter { }; + template struct ListMemberTypeGetter> { @@ -63,5 +66,3 @@ struct ListFreer std::set mListHolders; }; - -#endif /* CHIP_LISTUTILS_INTERNAL_H */ diff --git a/src/app/server/BUILD.gn b/src/app/server/BUILD.gn index 690da2354071cc..7e441518c9b133 100644 --- a/src/app/server/BUILD.gn +++ b/src/app/server/BUILD.gn @@ -62,6 +62,11 @@ static_library("server") { "${chip_root}/src/transport", ] + # TODO: Server.cpp uses TestGroupData.h. Unsure why test code would be in such a central place + # This dependency is split since it should probably be removed (or naming should + # be updated if this is not really "testing" even though headers are Test*.h) + public_deps += [ "${chip_root}/src/lib/support:testing" ] + if (chip_enable_icd_server) { public_deps += [ "${chip_root}/src/app/icd/server:notifier" ] } diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 88311e2b414e58..245e939fc39799 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -213,6 +213,7 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support:test_utils", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support:testing_nlunit", "${nlunit_test_root}:nlunit-test", ] diff --git a/src/controller/BUILD.gn b/src/controller/BUILD.gn index 435e405c299c97..9742bf05684b3c 100644 --- a/src/controller/BUILD.gn +++ b/src/controller/BUILD.gn @@ -81,5 +81,10 @@ static_library("controller") { deps = [ "${chip_root}/src/lib/address_resolve" ] + if (chip_controller && chip_build_controller) { + # ExampleOperationalCredentialsIssuer uses TestGroupData + deps += [ "${chip_root}/src/lib/support:testing" ] + } + defines = [] } diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index c8d2ac32779726..e14b7127dec68d 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -130,6 +130,7 @@ shared_library("ChipDeviceCtrl") { public_deps += [ "${chip_root}/src/controller/data_model", "${chip_root}/src/credentials:file_attestation_trust_store", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/tracing/json", "${chip_root}/src/tracing/perfetto", "${chip_root}/src/tracing/perfetto:file_output", diff --git a/src/credentials/tests/BUILD.gn b/src/credentials/tests/BUILD.gn index 101abc31dd890e..3b0458233ac757 100644 --- a/src/credentials/tests/BUILD.gn +++ b/src/credentials/tests/BUILD.gn @@ -70,6 +70,7 @@ chip_test_suite_using_nltest("tests") { "${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", ] diff --git a/src/crypto/tests/BUILD.gn b/src/crypto/tests/BUILD.gn index 55fc502484c681..1599b942269ae6 100644 --- a/src/crypto/tests/BUILD.gn +++ b/src/crypto/tests/BUILD.gn @@ -69,6 +69,7 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/crypto", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/platform", "${nlunit_test_root}:nlunit-test", diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index de92791826c666..9d6e786ce03149 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt index c58c75f77d9d38..783fe2aff9555f 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index cdb3a18b67c06b..9900b52d1c311f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -30,9 +30,9 @@ #import "NSStringSpanConversion.h" #include +#include #include #include -#include #include #include diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm index 6e7f500929877d..0e172b2118b5fc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm @@ -26,8 +26,8 @@ #import "NSStringSpanConversion.h" #include +#include #include -#include #include #include diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index eb66f46fd8aa8d..27611376c10069 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -101,6 +101,7 @@ source_set("error") { public_deps = [ ":chip_config_header", "${chip_root}/src/lib/support:attributes", + "${chip_root}/src/lib/support:type-traits", ] } diff --git a/src/lib/support/BUILD.gn b/src/lib/support/BUILD.gn index 410f3beaf21141..3e426746ad3d2b 100644 --- a/src/lib/support/BUILD.gn +++ b/src/lib/support/BUILD.gn @@ -160,6 +160,17 @@ source_set("chip_version_header") { deps = [ ":gen_chip_version" ] } +source_set("testing") { + sources = [ + "TestGroupData.h", + "TestPersistentStorageDelegate.h", + ] +} + +source_set("type-traits") { + sources = [ "TypeTraits.h" ] +} + static_library("support") { output_name = "libSupportLayer" @@ -179,6 +190,8 @@ static_library("support") { "CHIPArgParser.cpp", "CHIPCounter.h", "CHIPMemString.h", + "CommonIterator.h", + "CommonPersistentData.h", "DLLUtil.h", "DefaultStorageKeyAllocator.h", "Defer.h", @@ -186,21 +199,31 @@ static_library("support") { "FibonacciUtils.h", "FixedBufferAllocator.cpp", "FixedBufferAllocator.h", + "Fold.h", + "FunctionTraits.h", "IniEscaping.cpp", "IniEscaping.h", + "IntrusiveList.h", "Iterators.h", + "LambdaBridge.h", "LifetimePersistedCounter.h", "ObjectLifeCycle.h", + "OwnerOf.h", "PersistedCounter.h", + "PersistentData.h", "PersistentStorageAudit.cpp", "PersistentStorageAudit.h", "PersistentStorageMacros.h", "Pool.cpp", "Pool.h", + "PoolWrapper.h", "PrivateHeap.cpp", "PrivateHeap.h", "ReferenceCountedHandle.h", + "SafePointerCast.h", + "SafeString.h", "Scoped.h", + "ScopedBuffer.h", "SerializableIntegerSet.cpp", "SerializableIntegerSet.h", "SetupDiscriminator.h", @@ -252,6 +275,7 @@ static_library("support") { ":safeint", ":span", ":text_only_logging", + ":type-traits", ":verifymacros", ":verifymacros_no_logging", "${chip_root}/src/lib/core:chip_config_header", @@ -335,6 +359,7 @@ static_library("testing_nlunit") { output_dir = "${root_out_dir}/lib" sources = [ + "UnitTestContext.h", "UnitTestExtendedAssertions.h", "UnitTestRegistration.cpp", "UnitTestRegistration.h", diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 7a3b738ef4491a..d0b91feeba7061 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -79,6 +79,7 @@ chip_test_suite_using_nltest("tests") { public_deps = [ "${chip_root}/src/credentials", "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/lib/support/jsontlv", "${chip_root}/src/platform", diff --git a/src/messaging/tests/BUILD.gn b/src/messaging/tests/BUILD.gn index b3f41b6bb08457..b6f1dcb02c5ce7 100644 --- a/src/messaging/tests/BUILD.gn +++ b/src/messaging/tests/BUILD.gn @@ -32,6 +32,7 @@ static_library("helpers") { deps = [ "${chip_root}/src/credentials/tests:cert_test_vectors", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/messaging", "${chip_root}/src/protocols", "${chip_root}/src/transport", diff --git a/src/protocols/secure_channel/BUILD.gn b/src/protocols/secure_channel/BUILD.gn index 2061b04e82b6d5..f596345474301e 100644 --- a/src/protocols/secure_channel/BUILD.gn +++ b/src/protocols/secure_channel/BUILD.gn @@ -12,6 +12,7 @@ static_library("type_definitions") { cflags = [ "-Wconversion" ] public_deps = [ + "${chip_root}/src/lib/support:type-traits", "${chip_root}/src/protocols:type_definitions", "${chip_root}/src/system", ] @@ -55,6 +56,7 @@ static_library("secure_channel") { "${chip_root}/src/crypto", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:type-traits", "${chip_root}/src/messaging", "${chip_root}/src/system", "${chip_root}/src/tracing", diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index b77fb6976734c6..9a0ec760950d3f 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -29,6 +29,7 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:test_utils", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/messaging/tests:helpers", "${chip_root}/src/protocols", diff --git a/src/transport/raw/BUILD.gn b/src/transport/raw/BUILD.gn index ae3aeb58f8e3e9..736b16cdb08477 100644 --- a/src/transport/raw/BUILD.gn +++ b/src/transport/raw/BUILD.gn @@ -44,6 +44,7 @@ static_library("raw") { "${chip_root}/src/inet", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:type-traits", "${chip_root}/src/platform", ] } diff --git a/src/transport/tests/BUILD.gn b/src/transport/tests/BUILD.gn index 6f454f4502e0c0..057065a3d1a1bc 100644 --- a/src/transport/tests/BUILD.gn +++ b/src/transport/tests/BUILD.gn @@ -54,6 +54,7 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/inet/tests:helpers", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:testing", "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/protocols", "${chip_root}/src/transport", diff --git a/zzz_generated/placeholder/app1/zap-generated/test/Commands.h b/zzz_generated/placeholder/app1/zap-generated/test/Commands.h index 35de801fb5d94d..fd7e5da8588d13 100644 --- a/zzz_generated/placeholder/app1/zap-generated/test/Commands.h +++ b/zzz_generated/placeholder/app1/zap-generated/test/Commands.h @@ -21,7 +21,7 @@ #include "TestCommand.h" -#include +#include class Test_TC_WNCV_5_1_SimulatedSuite : public TestCommand { diff --git a/zzz_generated/placeholder/app2/zap-generated/test/Commands.h b/zzz_generated/placeholder/app2/zap-generated/test/Commands.h index 35de801fb5d94d..fd7e5da8588d13 100644 --- a/zzz_generated/placeholder/app2/zap-generated/test/Commands.h +++ b/zzz_generated/placeholder/app2/zap-generated/test/Commands.h @@ -21,7 +21,7 @@ #include "TestCommand.h" -#include +#include class Test_TC_WNCV_5_1_SimulatedSuite : public TestCommand {