Skip to content

Commit

Permalink
Add tests for commissionable node and dual (#8801)
Browse files Browse the repository at this point in the history
* Add tests for commissionable node and dual

Moves some of the operational definitions into the anonymous
namespace so they can be shared among tests. Adds tests
for commissionable node, and node that is advertising two
operational fabrics and a commissionable node. This is required
in order to properly test mdns stop commands on minimal impl.

Also fix a weird bug in the advertiser where we bail early on
setting up the subtypes if we don't have a vendor ID. Not sure
where that came from, but it looks like something got misplaced
as we were refactoring.

* Remove debug line.
  • Loading branch information
cecille authored and pull[bot] committed Aug 11, 2021
1 parent a398eec commit 5815028
Show file tree
Hide file tree
Showing 3 changed files with 307 additions and 73 deletions.
5 changes: 0 additions & 5 deletions src/lib/mdns/Advertiser_ImplMinimalMdns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,6 @@ FullQName AdvertiserMinMdns::GetCommisioningTextEntries(const CommissionAdvertis
snprintf(txtDiscriminator, sizeof(txtDiscriminator), "D=%d", params.GetLongDiscriminator());
txtFields[numTxtFields++] = txtDiscriminator;

if (!params.GetVendorId().HasValue())
{
return allocator->AllocateQName(txtDiscriminator);
}

char txtCommissioningMode[chip::Mdns::kKeyCommissioningModeMaxLength + 4];
snprintf(txtCommissioningMode, sizeof(txtCommissioningMode), "CM=%d", params.GetCommissioningMode() ? 1 : 0);
txtFields[numTxtFields++] = txtCommissioningMode;
Expand Down
1 change: 1 addition & 0 deletions src/lib/mdns/ServiceNaming.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ constexpr char kOperationalProtocol[] = "_tcp";
constexpr char kCommissionProtocol[] = "_udp";
constexpr char kLocalDomain[] = "local";
constexpr size_t kOperationalServiceNamePrefix = 16 + 1 + 16; // 2 * 64-bit value in HEX + hyphen
constexpr size_t kCommissionServiceNamePrefix = 16;

// each includes space for a null terminator, which becomes a . when the names are appended.
constexpr size_t kMaxCommisisonableServiceNameSize =
Expand Down
Loading

0 comments on commit 5815028

Please sign in to comment.