<h3>Contribution description</h3>
<p>To ensure that the bug I was trying to fix in <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="408698227" data-permission-text="Issue title is private" data-url="https://github.com/RIOT-OS/RIOT/issues/10985" data-hovercard-type="pull_request" data-hovercard-url="/RIOT-OS/RIOT/pull/10985/hovercard" href="https://github.com/RIOT-OS/RIOT/pull/10985">#10985</a> wasn't actually caused by the <code>gnrc_ndp</code> sending functions I enhanced the module's test coverage.</p>

<h3>Testing procedure</h3>
<p>To make sure the coverage is actually enhanced I applied the following patch</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c</span>
index 899d1de..e99b283 100644
<span class="pl-md">--- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c</span>
<span class="pl-mi1">+++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c</span>
<span class="pl-mdr">@@ -287,6 +287,7 @@</span> void gnrc_ndp_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
                 hdr = gnrc_ndp_opt_sl2a_build(l2src, l2src_len, pkt);
 
                 if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>                    puts("option failed");</span>
                     DEBUG("ndp: error allocating SL2AO.\n");
                     break;
                 }
<span class="pl-mdr">@@ -296,6 +297,7 @@</span> void gnrc_ndp_nbr_sol_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
         /* add neighbor solicitation header */
         hdr = gnrc_ndp_nbr_sol_build(tgt, pkt);
         if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>            puts("message failed");</span>
             DEBUG("ndp: error allocating neighbor solicitation.\n");
             break;
         }
<span class="pl-mdr">@@ -369,6 +371,7 @@</span> void gnrc_ndp_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
                 hdr = gnrc_ndp_opt_tl2a_build(l2tgt, l2tgt_len, pkt);
 
                 if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>                    puts("option failed");</span>
                     DEBUG("ndp: error allocating TL2AO.\n");
                     break;
                 }
<span class="pl-mdr">@@ -385,6 +388,7 @@</span> void gnrc_ndp_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif,
         /* add neighbor advertisement header */
         hdr = gnrc_ndp_nbr_adv_build(tgt, adv_flags, pkt);
         if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>            puts("message failed");</span>
             DEBUG("ndp: error allocating neighbor advertisement.\n");
             break;
         }
<span class="pl-mdr">@@ -434,6 +438,7 @@</span> void gnrc_ndp_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
                 /* add source address link-layer address option */
                 pkt = gnrc_ndp_opt_sl2a_build(l2src, l2src_len, NULL);
                 if (pkt == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>                    puts("option failed");</span>
                     DEBUG("ndp: error allocating SL2AO.\n");
                     break;
                 }
<span class="pl-mdr">@@ -442,6 +447,7 @@</span> void gnrc_ndp_rtr_sol_send(gnrc_netif_t *netif, const ipv6_addr_t *dst)
         /* add router solicitation header */
         hdr = gnrc_ndp_rtr_sol_build(pkt);
         if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>            puts("message failed");</span>
             DEBUG("ndp: error allocating router solicitation.\n");
             break;
         }
<span class="pl-mdr">@@ -518,6 +524,7 @@</span> void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
                 hdr = gnrc_ndp_opt_sl2a_build(l2src, l2src_len, pkt);
 
                 if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>                    puts("option failed");</span>
                     DEBUG("ndp: error allocating Source Link-layer address "
                           "option.\n");
                     break;
<span class="pl-mdr">@@ -556,6 +563,7 @@</span> void gnrc_ndp_rtr_adv_send(gnrc_netif_t *netif, const ipv6_addr_t *src,
         hdr = gnrc_ndp_rtr_adv_build(cur_hl, flags, adv_ltime, reach_time,
                                      retrans_timer, pkt);
         if (hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>            puts("message failed");</span>
             DEBUG("ndp: error allocating router advertisement.\n");
             break;
         }
<span class="pl-mdr">@@ -598,6 +606,7 @@</span> static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif,
     gnrc_pktsnip_t *iphdr = gnrc_ipv6_hdr_build(payload, src, dst);
 
     if (iphdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>        puts("IPv6 failed");</span>
         DEBUG("ndp: error allocating IPv6 header.\n");
         return NULL;
     }
<span class="pl-mdr">@@ -605,6 +614,7 @@</span> static gnrc_pktsnip_t *_build_headers(gnrc_netif_t *netif,
     /* add netif header for send interface specification */
     l2hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0);
     if (l2hdr == NULL) {
<span class="pl-mi1"><span class="pl-mi1">+</span>        puts("netif failed");</span>
         DEBUG("ndp: error allocating netif header.\n");
         gnrc_pktbuf_remove_snip(iphdr, iphdr);
         return NULL;</pre></div>
<p>The test should then show something like</p>
<pre><code>option failed
message failed
IPv6 failed
netif failed
</code></pre>
<p>4 times with varying numbers periods in-between with this PR, without it it probably won't show up at all (I did not test this case). I tested the first case on <code>native</code>, <code>samr21-xpro</code>, and <code>iotlab-m3</code></p>

<h3>Issues/PRs references</h3>
<p>Ensurance that <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="408698227" data-permission-text="Issue title is private" data-url="https://github.com/RIOT-OS/RIOT/issues/10985" data-hovercard-type="pull_request" data-hovercard-url="/RIOT-OS/RIOT/pull/10985/hovercard" href="https://github.com/RIOT-OS/RIOT/pull/10985">#10985</a> was the right hunch for the leak we've seen.</p>


<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/10987'>https://github.com/RIOT-OS/RIOT/pull/10987</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>tests/gnrc_ndp: enhance coverage</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/10987/files#diff-0">tests/gnrc_ndp/main.c</a>
    (264)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/10987.patch'>https://github.com/RIOT-OS/RIOT/pull/10987.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/10987.diff'>https://github.com/RIOT-OS/RIOT/pull/10987.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/10987">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AEn7YLMwujR_nKrGJrekdLlcqu8oCZoqks5vMXJbgaJpZM4a0M9z">mute the thread</a>.<img src="https://github.com/notifications/beacon/AEn7YO0aOnJNsizI9yIMifjF_mWeGW9-ks5vMXJbgaJpZM4a0M9z.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RIOT-OS/RIOT","title":"RIOT-OS/RIOT","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/RIOT-OS/RIOT"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"tests/gnrc_ndp: enhance coverage (#10987)"}],"action":{"name":"View Pull Request","url":"https://github.com/RIOT-OS/RIOT/pull/10987"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/10987",
"url": "https://github.com/RIOT-OS/RIOT/pull/10987",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>