Skip to content

Commit

Permalink
Link all unit tests with string adapters for CHIP_ERROR (project-chip…
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq authored and j-ororke committed Jul 31, 2024
1 parent 3ff32b2 commit a178001
Show file tree
Hide file tree
Showing 192 changed files with 497 additions and 250 deletions.
1 change: 1 addition & 0 deletions src/access/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ chip_test_suite("tests") {
cflags = [ "-Wconversion" ]
public_deps = [
"${chip_root}/src/access",
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/lib/support:test_utils",
"${dir_pw_unit_test}",
]
Expand Down
5 changes: 3 additions & 2 deletions src/access/tests/TestAccessControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include "access/AccessControl.h"
#include "access/examples/ExampleAccessControlDelegate.h"

#include <lib/core/CHIPCore.h>
#include <pw_unit_test/framework.h>

#include <gtest/gtest.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/StringBuilderAdapters.h>

namespace chip {
namespace Access {
Expand Down
1 change: 1 addition & 0 deletions src/app/cluster-building-blocks/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ chip_test_suite("tests") {
"${chip_root}/src/app/cluster-building-blocks",
"${chip_root}/src/app/data-model:nullable",
"${chip_root}/src/lib/core:error",
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/lib/support/tests:pw-test-macros",
"${chip_root}/src/system",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

#include <app/data-model/Nullable.h>
#include <lib/core/CHIPError.h>
#include <lib/core/StringBuilderAdapters.h>
#include <system/SystemClock.h>

#include <gtest/gtest.h>
#include <pw_unit_test/framework.h>

using namespace chip;
using namespace chip::app;
Expand Down
8 changes: 5 additions & 3 deletions src/app/codegen-data-model/tests/TestCodegenModelViaMocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <vector>

#include <pw_unit_test/framework.h>

#include "app/ConcreteCommandPath.h"
#include <app/codegen-data-model/CodegenDataModel.h>

Expand Down Expand Up @@ -54,9 +59,6 @@
#include <lib/core/TLVWriter.h>
#include <lib/support/Span.h>

#include <gtest/gtest.h>
#include <vector>

using namespace chip;
using namespace chip::Test;
using namespace chip::app;
Expand Down
5 changes: 4 additions & 1 deletion src/app/data-model-interface/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ chip_test_suite("tests") {

cflags = [ "-Wconversion" ]

public_deps = [ "${chip_root}/src/app/data-model-interface" ]
public_deps = [
"${chip_root}/src/app/data-model-interface",
"${chip_root}/src/lib/core:string-builder-adapters",
]
}
3 changes: 2 additions & 1 deletion src/app/data-model-interface/tests/TestEventEmitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include <app-common/zap-generated/cluster-objects.h>
#include <app/data-model-interface/EventsGenerator.h>
#include <app/data-model/Decode.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CodeUtils.h>

#include <gtest/gtest.h>
#include <pw_unit_test/framework.h>

namespace {

Expand Down
1 change: 1 addition & 0 deletions src/app/icd/server/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ chip_test_suite("tests") {
public_deps = [
"${chip_root}/src/app/icd/server:manager",
"${chip_root}/src/app/icd/server:monitoring-table",
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/messaging/tests:helpers",
Expand Down
2 changes: 2 additions & 0 deletions src/app/icd/server/tests/TestICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <pw_unit_test/framework.h>

#include <app/SubscriptionsInfoProvider.h>
Expand All @@ -29,6 +30,7 @@
#include <lib/address_resolve/AddressResolve.h>
#include <lib/core/DataModelTypes.h>
#include <lib/core/NodeId.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/TestPersistentStorageDelegate.h>
#include <lib/support/TimeUtils.h>
#include <messaging/tests/MessagingContext.h>
Expand Down
4 changes: 3 additions & 1 deletion src/app/icd/server/tests/TestICDMonitoringTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
* limitations under the License.
*/

#include <pw_unit_test/framework.h>

#include <app/icd/server/ICDMonitoringTable.h>
#include <crypto/CHIPCryptoPAL.h>
#include <crypto/DefaultSessionKeystore.h>
#include <gtest/gtest.h>
#include <lib/core/CHIPError.h>
#include <lib/core/ClusterEnums.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/DefaultStorageKeyAllocator.h>
#include <lib/support/TestPersistentStorageDelegate.h>

Expand Down
3 changes: 2 additions & 1 deletion src/app/tests/TestAclEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include <type_traits>

#include <app/tests/test-interaction-model-api.h>
#include <pw_unit_test/framework.h>

#include <access/AccessControl.h>
Expand All @@ -27,11 +26,13 @@
#include <app/MessageDef/EventDataIB.h>
#include <app/reporting/tests/MockReportScheduler.h>
#include <app/tests/AppTestContext.h>
#include <app/tests/test-interaction-model-api.h>
#include <app/util/basic-types.h>
#include <app/util/mock/Constants.h>
#include <app/util/mock/Functions.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/core/TLV.h>
#include <lib/core/TLVDebug.h>
#include <lib/core/TLVUtilities.h>
Expand Down
1 change: 1 addition & 0 deletions src/app/tests/TestFailSafeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <pw_unit_test/framework.h>

#include <app/FailSafeContext.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CodeUtils.h>
#include <platform/CHIPDeviceLayer.h>
Expand Down
4 changes: 3 additions & 1 deletion src/app/tests/TestReportingEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@

#include <cinttypes>

#include <pw_unit_test/framework.h>

#include <app/ConcreteAttributePath.h>
#include <app/InteractionModelEngine.h>
#include <app/reporting/Engine.h>
#include <app/reporting/tests/MockReportScheduler.h>
#include <app/tests/AppTestContext.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/core/TLV.h>
#include <lib/core/TLVDebug.h>
#include <lib/core/TLVUtilities.h>
#include <lib/support/tests/ExtraPwTestMacros.h>
#include <messaging/ExchangeContext.h>
#include <messaging/Flags.h>
#include <pw_unit_test/framework.h>

namespace chip {

Expand Down
1 change: 1 addition & 0 deletions src/ble/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ chip_test_suite("tests") {

public_deps = [
"${chip_root}/src/ble",
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/platform",
]
}
4 changes: 2 additions & 2 deletions src/ble/tests/TestBleErrorStr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
#include <stdint.h>
#include <string.h>

#include <pw_unit_test/framework.h>

#include <lib/core/ErrorStr.h>

#define _CHIP_BLE_BLE_H
#include <ble/BleError.h>

#include <gtest/gtest.h>

using namespace chip;

// Test input data.
Expand Down
3 changes: 2 additions & 1 deletion src/ble/tests/TestBleLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
#include <type_traits>
#include <utility>

#include <gtest/gtest.h>
#include <pw_unit_test/framework.h>

#include <lib/core/CHIPError.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/Span.h>
#include <lib/support/TypeTraits.h>
Expand Down
2 changes: 1 addition & 1 deletion src/ble/tests/TestBleUUID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define _CHIP_BLE_BLE_H
#include <ble/BleUUID.h>

#include <gtest/gtest.h>
#include <pw_unit_test/framework.h>

using namespace chip;
using namespace chip::Ble;
Expand Down
5 changes: 3 additions & 2 deletions src/ble/tests/TestBtpEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
#include <cstdint>
#include <numeric>

#include <pw_unit_test/framework.h>

#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/logging/CHIPLogging.h>

#define _CHIP_BLE_BLE_H
#include <ble/BleLayer.h>
#include <ble/BtpEngine.h>

#include <gtest/gtest.h>

using namespace chip;
using namespace chip::Ble;

Expand Down
1 change: 1 addition & 0 deletions src/controller/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ chip_test_suite("tests") {
"${chip_root}/src/app/common:cluster-objects",
"${chip_root}/src/app/tests:helpers",
"${chip_root}/src/controller",
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/messaging/tests:helpers",
"${chip_root}/src/transport/raw/tests:helpers",
Expand Down
3 changes: 2 additions & 1 deletion src/controller/tests/TestCommissionableNodeController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
* limitations under the License.
*/

#include <gtest/gtest.h>
#include <pw_unit_test/framework.h>

#include <controller/CHIPCommissionableNodeController.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CHIPMemString.h>

using namespace chip;
Expand Down
3 changes: 3 additions & 0 deletions src/controller/tests/TestEventCaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

#include <pw_unit_test/framework.h>

#include "app-common/zap-generated/ids/Attributes.h"
#include "app-common/zap-generated/ids/Clusters.h"
#include "app/ClusterStateCache.h"
Expand All @@ -32,6 +34,7 @@
#include <app/util/attribute-storage.h>
#include <controller/InvokeInteraction.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/TimeUtils.h>
#include <lib/support/UnitTestUtils.h>
#include <lib/support/logging/CHIPLogging.h>
Expand Down
1 change: 1 addition & 0 deletions src/controller/tests/TestEventChunking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <controller/InvokeInteraction.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CHIPCounter.h>
#include <lib/support/TimeUtils.h>
#include <lib/support/logging/CHIPLogging.h>
Expand Down
1 change: 1 addition & 0 deletions src/controller/tests/TestEventNumberCaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <app/util/attribute-storage.h>
#include <controller/InvokeInteraction.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/TimeUtils.h>
#include <lib/support/logging/CHIPLogging.h>

Expand Down
1 change: 1 addition & 0 deletions src/controller/tests/TestReadChunking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <app/util/endpoint-config-api.h>
#include <controller/InvokeInteraction.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/TimeUtils.h>
#include <lib/support/UnitTestUtils.h>
#include <lib/support/logging/CHIPLogging.h>
Expand Down
1 change: 1 addition & 0 deletions src/controller/tests/TestServerCommandDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <controller/InvokeInteraction.h>
#include <controller/ReadInteraction.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/logging/CHIPLogging.h>

using namespace chip;
Expand Down
3 changes: 3 additions & 0 deletions src/controller/tests/TestWriteChunking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <memory>
#include <utility>

#include <pw_unit_test/framework.h>

#include "app-common/zap-generated/ids/Attributes.h"
#include "app-common/zap-generated/ids/Clusters.h"
#include "app/ConcreteAttributePath.h"
Expand All @@ -35,6 +37,7 @@
#include <app/util/attribute-storage.h>
#include <controller/InvokeInteraction.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/logging/CHIPLogging.h>

using namespace chip;
Expand Down
1 change: 1 addition & 0 deletions src/credentials/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ chip_test_suite("tests") {
"${chip_root}/src/credentials",
"${chip_root}/src/credentials:default_attestation_verifier",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/core:string-builder-adapters",
"${chip_root}/src/lib/support:testing",
]
}
Expand Down
5 changes: 3 additions & 2 deletions src/credentials/tests/TestCertificationDeclaration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
#include <inttypes.h>
#include <stddef.h>

#include <pw_unit_test/framework.h>

#include <credentials/CHIPCert.h>
#include <credentials/CertificationDeclaration.h>
#include <credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h>
#include <crypto/CHIPCryptoPAL.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/Span.h>

#include <gtest/gtest.h>

using namespace chip;
using namespace chip::ASN1;
using namespace chip::Crypto;
Expand Down
5 changes: 3 additions & 2 deletions src/credentials/tests/TestChipCert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
*
*/

#include <pw_unit_test/framework.h>

#include <credentials/CHIPCert.h>
#include <credentials/examples/LastKnownGoodTimeCertificateValidityPolicyExample.h>
#include <credentials/examples/StrictCertificateValidityPolicyExample.h>
#include <crypto/CHIPCryptoPAL.h>
#include <lib/core/ErrorStr.h>
#include <lib/core/PeerId.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/core/TLV.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CodeUtils.h>

#include <gtest/gtest.h>

#include "CHIPCert_error_test_vectors.h"
#include "CHIPCert_test_vectors.h"

Expand Down
6 changes: 4 additions & 2 deletions src/credentials/tests/TestCommissionerDUTVectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include <pw_unit_test/framework.h>

#include <crypto/CHIPCryptoPAL.h>

#include <app/tests/suites/credentials/TestHarnessDACProvider.h>
Expand All @@ -27,11 +30,10 @@
#include <credentials/examples/DeviceAttestationCredsExample.h>

#include <lib/core/CHIPError.h>
#include <lib/core/StringBuilderAdapters.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/Span.h>

#include <gtest/gtest.h>

#include <dirent.h>
#include <stdio.h>
#include <string>
Expand Down
Loading

0 comments on commit a178001

Please sign in to comment.