diff --git a/tests/net/arp/src/main.c b/tests/net/arp/src/main.c index 088e380d32d..8c43d8a7ae4 100644 --- a/tests/net/arp/src/main.c +++ b/tests/net/arp/src/main.c @@ -14,11 +14,9 @@ #include #include #include -#include #include #include #include -#include #include #include #include @@ -107,7 +105,7 @@ static int tester_send(struct net_if *iface, struct net_buf *buf) if (!req_test && memcmp(&hdr->dst, &hwaddr, sizeof(struct net_eth_addr))) { char out[sizeof("xx:xx:xx:xx:xx:xx")]; - snprintf(out, sizeof(out), + snprintk(out, sizeof(out), "%s", net_sprint_ll_addr( (uint8_t *)&hdr->dst, sizeof(struct net_eth_addr))); @@ -124,7 +122,7 @@ static int tester_send(struct net_if *iface, struct net_buf *buf) if (memcmp(&hdr->src, &hwaddr, sizeof(struct net_eth_addr))) { char out[sizeof("xx:xx:xx:xx:xx:xx")]; - snprintf(out, sizeof(out), + snprintk(out, sizeof(out), "%s", net_sprint_ll_addr( (uint8_t *)&hdr->src, sizeof(struct net_eth_addr))); @@ -464,7 +462,7 @@ static bool run_tests(void) if (!net_ipv4_addr_cmp(&arp_hdr->dst_ipaddr, &NET_IPV4_BUF(buf)->dst)) { char out[sizeof("xxx.xxx.xxx.xxx")]; - snprintf(out, sizeof(out), + snprintk(out, sizeof(out), "%s", net_sprint_ipv4_addr(&arp_hdr->dst_ipaddr)); printk("ARP IP dest invalid %s, should be %s", out, net_sprint_ipv4_addr(&NET_IPV4_BUF(buf)->dst)); @@ -474,7 +472,7 @@ static bool run_tests(void) if (!net_ipv4_addr_cmp(&arp_hdr->src_ipaddr, &NET_IPV4_BUF(buf)->src)) { char out[sizeof("xxx.xxx.xxx.xxx")]; - snprintf(out, sizeof(out), + snprintk(out, sizeof(out), "%s", net_sprint_ipv4_addr(&arp_hdr->src_ipaddr)); printk("ARP IP src invalid %s, should be %s", out, net_sprint_ipv4_addr(&NET_IPV4_BUF(buf)->src)); @@ -510,7 +508,7 @@ static bool run_tests(void) if (!net_ipv4_addr_cmp(&arp_hdr->dst_ipaddr, &iface->ipv4.gw)) { char out[sizeof("xxx.xxx.xxx.xxx")]; - snprintf(out, sizeof(out), + snprintk(out, sizeof(out), "%s", net_sprint_ipv4_addr(&arp_hdr->dst_ipaddr)); printk("ARP IP dst invalid %s, should be %s\n", out, net_sprint_ipv4_addr(&iface->ipv4.gw)); diff --git a/tests/net/ip-addr/src/main.c b/tests/net/ip-addr/src/main.c index 13a36f20eff..439b87064dc 100644 --- a/tests/net/ip-addr/src/main.c +++ b/tests/net/ip-addr/src/main.c @@ -9,11 +9,9 @@ #include #include #include -#include #include #include #include -#include #include #include @@ -70,10 +68,11 @@ uint8_t ll1[] = { a, b, c, d, e, f }; \ uint8_t ll2[] = { f, e, d, c, b, a }; \ char out[2 * sizeof("xx:xx:xx:xx:xx:xx") + 1 + 1]; \ - sprintf(out, "%s ", \ - net_sprint_ll_addr(ll1, sizeof(ll1))); \ - sprintf(out + sizeof("xx:xx:xx:xx:xx:xx"), "%s", \ - net_sprint_ll_addr(ll2, sizeof(ll2))); \ + snprintk(out, sizeof(out), "%s ", \ + net_sprint_ll_addr(ll1, sizeof(ll1))); \ + snprintk(out + sizeof("xx:xx:xx:xx:xx:xx"), \ + sizeof(out), "%s", \ + net_sprint_ll_addr(ll2, sizeof(ll2))); \ if (strcmp(out, expected)) { \ printk("Test %s failed, got %s\n", expected, out); \ return false; \ diff --git a/tests/net/nbuf/src/main.c b/tests/net/nbuf/src/main.c index f46a1579a76..0291e59b299 100644 --- a/tests/net/nbuf/src/main.c +++ b/tests/net/nbuf/src/main.c @@ -11,7 +11,6 @@ #include #include #include -#include #include @@ -285,23 +284,23 @@ static void hexdump(const char *str, const uint8_t *packet, size_t length) while (length--) { if (n % 16 == 0) { - printf("%s %08X ", str, n); + printk("%s %08X ", str, n); } - printf("%02X ", *packet++); + printk("%02X ", *packet++); n++; if (n % 8 == 0) { if (n % 16 == 0) { - printf("\n"); + printk("\n"); } else { - printf(" "); + printk(" "); } } } if (n % 16) { - printf("\n"); + printk("\n"); } }