Skip to content

Commit ec72e65

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Enable asan for unit tests on Darwin when compiling with clang. (#11824)
This immediately caught two bugs in things that were being unit-tested. The Linux version fails to link for some reason, hence this is Darwin-only.
1 parent 1072ac6 commit ec72e65

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ jobs:
301301
run: |
302302
for BUILD_TYPE in clang python_lib; do
303303
case $BUILD_TYPE in
304-
"clang") GN_ARGS='is_clang=true target_os="all"';;
304+
"clang") GN_ARGS='is_clang=true target_os="all" is_asan=true';;
305305
"python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';;
306306
esac
307307
scripts/build/gn_gen.sh --args="$GN_ARGS"

src/access/tests/TestAccessControl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ void TestDeleteEntry(nlTestSuite * inSuite, void * inContext)
671671
NL_TEST_ASSERT(inSuite, ClearAccessControl(accessControl) == CHIP_NO_ERROR);
672672
NL_TEST_ASSERT(inSuite, LoadAccessControl(accessControl, data, ArraySize(data)) == CHIP_NO_ERROR);
673673

674-
memcpy(&data[pos], &data[pos + count], (ArraySize(data) - count - pos) * sizeof(data[0]));
674+
memmove(&data[pos], &data[pos + count], (ArraySize(data) - count - pos) * sizeof(data[0]));
675675

676676
for (size_t i = 0; i < count; ++i)
677677
{

src/protocols/bdx/BdxMessages.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ size_t TransferInit::MessageSize() const
170170
void TransferInit::LogMessage(bdx::MessageType messageType) const
171171
{
172172
char fd[kMaxFileDesignatorLen];
173-
snprintf(fd, sizeof(fd), "%s", FileDesignator);
173+
snprintf(fd, sizeof(fd), "%.*s", static_cast<int>(FileDesLength), FileDesignator);
174174

175175
switch (messageType)
176176
{

src/protocols/user_directed_commissioning/UserDirectedCommissioning.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class DLL_EXPORT UserDirectedCommissioningServer : public TransportMgrDelegate
183183
* Get the cache of UDC Clients
184184
*
185185
*/
186-
UDCClients<kMaxUDCClients> GetUDCClients() { return mUdcClients; }
186+
UDCClients<kMaxUDCClients> & GetUDCClients() { return mUdcClients; }
187187

188188
/**
189189
* Print the cache of UDC Clients

0 commit comments

Comments
 (0)