Skip to content

Commit

Permalink
Enable asan for unit tests on Darwin when compiling with clang. (#11824)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Aug 16, 2023
1 parent cbebbc6 commit 2be4b9f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:
run: |
for BUILD_TYPE in clang python_lib; do
case $BUILD_TYPE in
"clang") GN_ARGS='is_clang=true target_os="all"';;
"clang") GN_ARGS='is_clang=true target_os="all" is_asan=true';;
"python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';;
esac
scripts/build/gn_gen.sh --args="$GN_ARGS"
Expand Down
2 changes: 1 addition & 1 deletion src/access/tests/TestAccessControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void TestDeleteEntry(nlTestSuite * inSuite, void * inContext)
NL_TEST_ASSERT(inSuite, ClearAccessControl(accessControl) == CHIP_NO_ERROR);
NL_TEST_ASSERT(inSuite, LoadAccessControl(accessControl, data, ArraySize(data)) == CHIP_NO_ERROR);

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

for (size_t i = 0; i < count; ++i)
{
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/bdx/BdxMessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ size_t TransferInit::MessageSize() const
void TransferInit::LogMessage(bdx::MessageType messageType) const
{
char fd[kMaxFileDesignatorLen];
snprintf(fd, sizeof(fd), "%s", FileDesignator);
snprintf(fd, sizeof(fd), "%.*s", static_cast<int>(FileDesLength), FileDesignator);

switch (messageType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class DLL_EXPORT UserDirectedCommissioningServer : public TransportMgrDelegate
* Get the cache of UDC Clients
*
*/
UDCClients<kMaxUDCClients> GetUDCClients() { return mUdcClients; }
UDCClients<kMaxUDCClients> & GetUDCClients() { return mUdcClients; }

/**
* Print the cache of UDC Clients
Expand Down

0 comments on commit 2be4b9f

Please sign in to comment.