Skip to content

Commit

Permalink
Enable asan for unit tests when compiling with clang.
Browse files Browse the repository at this point in the history
This immediately caught two bugs in things that were being unit-tested.
  • Loading branch information
bzbarsky-apple committed Nov 16, 2021
1 parent 10be5f6 commit 7158e12
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
for BUILD_TYPE in gcc_release clang mbedtls; do
case $BUILD_TYPE in
"gcc_release") GN_ARGS='is_debug=false';;
"clang") GN_ARGS='is_clang=true';;
"clang") GN_ARGS='is_clang=true is_asan=true';;
"mbedtls") GN_ARGS='chip_crypto="mbedtls"';;
esac
Expand Down 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/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 7158e12

Please sign in to comment.