net: tests: Fix printf modifiers in new IP stack unit tests
Because of printk fixes in master, some of the networking unit tests will fail in next merge. Change-Id: I3e28aae72c0c10b402b78c0f406ecb3513b967a7 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
b283640f10
commit
103a98d173
6 changed files with 26 additions and 25 deletions
|
@ -450,7 +450,7 @@ static bool run_tests(void)
|
|||
len = strlen(app_data);
|
||||
|
||||
if (net_nbuf_ll_reserve(buf) != sizeof(struct net_eth_hdr)) {
|
||||
printk("LL reserve invalid, should be %d was %d\n",
|
||||
printk("LL reserve invalid, should be %zd was %d\n",
|
||||
sizeof(struct net_eth_hdr),
|
||||
net_nbuf_ll_reserve(buf));
|
||||
return false;
|
||||
|
@ -537,13 +537,13 @@ static bool run_tests(void)
|
|||
}
|
||||
|
||||
if (arp_hdr->hwlen != sizeof(struct net_eth_addr)) {
|
||||
printk("ARP hwlen 0x%x, should be 0x%x\n",
|
||||
printk("ARP hwlen 0x%x, should be 0x%zx\n",
|
||||
arp_hdr->hwlen, sizeof(struct net_eth_addr));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arp_hdr->protolen != sizeof(struct in_addr)) {
|
||||
printk("ARP IP addr len 0x%x, should be 0x%x\n",
|
||||
printk("ARP IP addr len 0x%x, should be 0x%zx\n",
|
||||
arp_hdr->protolen, sizeof(struct in_addr));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ static bool compare_data(struct net_buf *buf, struct net_fragment_data *data)
|
|||
int remaining = data->len;
|
||||
|
||||
if (net_buf_frags_len(buf->frags) != (NET_IPV6UDPH_LEN + remaining)) {
|
||||
printk("mismatch lengths, expected %d received %d\n",
|
||||
printk("mismatch lengths, expected %d received %zd\n",
|
||||
NET_IPV6UDPH_LEN + remaining,
|
||||
net_buf_frags_len(buf->frags));
|
||||
return false;
|
||||
|
|
|
@ -79,7 +79,7 @@ static int test_ipv6_multi_frags(void)
|
|||
udp = (struct udp_hdr *)((void *)ipv6 + sizeof(*ipv6));
|
||||
if (net_buf_tailroom(frag) < sizeof(ipv6)) {
|
||||
printk("Not enough space for IPv6 header, "
|
||||
"needed %d bytes, has %d bytes\n",
|
||||
"needed %zd bytes, has %zd bytes\n",
|
||||
sizeof(ipv6), net_buf_tailroom(frag));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ static int test_ipv6_multi_frags(void)
|
|||
|
||||
if (net_buf_tailroom(frag) < sizeof(udp)) {
|
||||
printk("Not enough space for UDP header, "
|
||||
"needed %d bytes, has %d bytes\n",
|
||||
"needed %zd bytes, has %zd bytes\n",
|
||||
sizeof(udp), net_buf_tailroom(frag));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ static int test_ipv6_multi_frags(void)
|
|||
if (net_buf_tailroom(frag) -
|
||||
(CONFIG_NET_NBUF_DATA_SIZE - LL_RESERVE)) {
|
||||
printk("Invalid number of bytes available in the buf, "
|
||||
"should be 0 but was %d - %d\n",
|
||||
"should be 0 but was %zd - %d\n",
|
||||
net_buf_tailroom(frag),
|
||||
CONFIG_NET_NBUF_DATA_SIZE - LL_RESERVE);
|
||||
return -EINVAL;
|
||||
|
@ -111,7 +111,7 @@ static int test_ipv6_multi_frags(void)
|
|||
|
||||
if (((int)net_buf_tailroom(frag) - remaining) > 0) {
|
||||
printk("We should have been out of space now, "
|
||||
"tailroom %d user data len %d\n",
|
||||
"tailroom %zd user data len %zd\n",
|
||||
net_buf_tailroom(frag),
|
||||
strlen(example_data));
|
||||
return -EINVAL;
|
||||
|
@ -131,7 +131,7 @@ static int test_ipv6_multi_frags(void)
|
|||
remaining -= bytes;
|
||||
if (net_buf_tailroom(frag) - (bytes - copy)) {
|
||||
printk("There should have not been any tailroom left, "
|
||||
"tailroom %d\n",
|
||||
"tailroom %zd\n",
|
||||
net_buf_tailroom(frag) - (bytes - copy));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ static int test_ipv6_multi_frags(void)
|
|||
|
||||
bytes = net_buf_frags_len(buf->frags);
|
||||
if (bytes != strlen(example_data)) {
|
||||
printk("Invalid number of bytes in message, %d vs %d\n",
|
||||
printk("Invalid number of bytes in message, %zd vs %d\n",
|
||||
strlen(example_data), bytes);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ static int test_fragment_copy(void)
|
|||
udp = (struct udp_hdr *)((void *)ipv6 + sizeof(*ipv6));
|
||||
if (net_buf_tailroom(frag) < sizeof(*ipv6)) {
|
||||
printk("Not enough space for IPv6 header, "
|
||||
"needed %d bytes, has %d bytes\n",
|
||||
"needed %zd bytes, has %zd bytes\n",
|
||||
sizeof(ipv6), net_buf_tailroom(frag));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ static int test_fragment_copy(void)
|
|||
|
||||
if (net_buf_tailroom(frag) < sizeof(*udp)) {
|
||||
printk("Not enough space for UDP header, "
|
||||
"needed %d bytes, has %d bytes\n",
|
||||
"needed %zd bytes, has %zd bytes\n",
|
||||
sizeof(udp), net_buf_tailroom(frag));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ static int test_fragment_copy(void)
|
|||
|
||||
orig_len = net_buf_frags_len(buf);
|
||||
|
||||
printk("Total copy data len %d\n", orig_len);
|
||||
printk("Total copy data len %zd\n", orig_len);
|
||||
|
||||
linearize(buf, buf_orig, sizeof(orig_len));
|
||||
|
||||
|
@ -241,18 +241,18 @@ static int test_fragment_copy(void)
|
|||
new_buf = net_nbuf_get_reserve_tx(0);
|
||||
net_buf_frag_add(new_buf, new_frag);
|
||||
|
||||
printk("Total new data len %d\n", net_buf_frags_len(new_buf));
|
||||
printk("Total new data len %zd\n", net_buf_frags_len(new_buf));
|
||||
|
||||
if (net_buf_frags_len(buf) != 0) {
|
||||
printk("Fragment list missing data, %d bytes not copied\n",
|
||||
printk("Fragment list missing data, %zd bytes not copied\n",
|
||||
net_buf_frags_len(buf));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (net_buf_frags_len(new_buf) != (orig_len + sizeof(struct ipv6_hdr) +
|
||||
sizeof(struct icmp_hdr))) {
|
||||
printk("Fragment list missing data, new buf len %d "
|
||||
"should be %d\n", net_buf_frags_len(new_buf),
|
||||
printk("Fragment list missing data, new buf len %zd "
|
||||
"should be %zd\n", net_buf_frags_len(new_buf),
|
||||
orig_len + sizeof(struct ipv6_hdr) +
|
||||
sizeof(struct icmp_hdr));
|
||||
return -EINVAL;
|
||||
|
@ -345,7 +345,7 @@ static int test_fragment_push(void)
|
|||
bytes = net_buf_frags_len(buf);
|
||||
if (bytes != FRAG_COUNT * sizeof(test_data) * 2) {
|
||||
printk("Push test failed, fragments had %d bytes but "
|
||||
"should have had %d\n", bytes,
|
||||
"should have had %zd\n", bytes,
|
||||
FRAG_COUNT * sizeof(test_data) * 2);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,8 @@ static bool run_tests(void)
|
|||
sizeof(struct net_eth_addr))) {
|
||||
printk("Wrong lladdr %s in index %d\n",
|
||||
net_sprint_ll_addr(lladdr_ptr->addr,
|
||||
lladdr_ptr->len));
|
||||
lladdr_ptr->len),
|
||||
i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -413,14 +413,14 @@ static bool run_tests(void)
|
|||
ifaddr = net_if_ipv6_addr_add(iface, &in6addr_my, NET_ADDR_MANUAL, 0);
|
||||
if (!ifaddr) {
|
||||
printk("Cannot add %s to interface %p\n",
|
||||
net_sprint_ipv6_addr(&in6addr_my));
|
||||
net_sprint_ipv6_addr(&in6addr_my), iface);
|
||||
return false;
|
||||
}
|
||||
|
||||
ifaddr = net_if_ipv4_addr_add(iface, &in4addr_my, NET_ADDR_MANUAL, 0);
|
||||
if (!ifaddr) {
|
||||
printk("Cannot add %s to interface %p\n",
|
||||
net_sprint_ipv4_addr(&in4addr_my));
|
||||
net_sprint_ipv4_addr(&in4addr_my), iface);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ static bool run_tests(void)
|
|||
|
||||
memcpy(net_buf_add(frag, sizeof(pkt1)), pkt1, sizeof(pkt1));
|
||||
if (frag->len != sizeof(pkt1)) {
|
||||
printk("Fragment len %d invalid, should be %d\n",
|
||||
printk("Fragment len %d invalid, should be %zd\n",
|
||||
frag->len, sizeof(pkt1));
|
||||
return false;
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ static bool run_tests(void)
|
|||
frag = net_nbuf_get_reserve_data(10);
|
||||
net_buf_frag_add(buf, frag);
|
||||
memcpy(net_buf_add(frag, sizeof(pkt3) / 2), pkt3, sizeof(pkt3) / 2);
|
||||
printk("First fragment will have %d bytes\n", sizeof(pkt3) / 2);
|
||||
printk("First fragment will have %zd bytes\n", sizeof(pkt3) / 2);
|
||||
|
||||
net_nbuf_set_ip_hdr_len(buf, sizeof(struct net_ipv6_hdr));
|
||||
net_nbuf_set_family(buf, AF_INET6);
|
||||
|
@ -241,7 +241,7 @@ static bool run_tests(void)
|
|||
net_buf_frag_add(buf, frag);
|
||||
memcpy(net_buf_add(frag, sizeof(pkt3) - sizeof(pkt3) / 2),
|
||||
pkt3 + sizeof(pkt3) / 2, sizeof(pkt3) - sizeof(pkt3) / 2);
|
||||
printk("Second fragment will have %d bytes\n",
|
||||
printk("Second fragment will have %zd bytes\n",
|
||||
sizeof(pkt3) - sizeof(pkt3) / 2);
|
||||
|
||||
chksum = ntohs(~net_calc_chksum(buf, IPPROTO_ICMPV6));
|
||||
|
@ -302,7 +302,7 @@ static bool run_tests(void)
|
|||
(total + sizeof(struct net_ipv6_hdr)) !=
|
||||
net_buf_frags_len(buf->frags)) {
|
||||
printk("pkt3 size differs from fragment sizes, "
|
||||
"pkt3 size %d frags size %d calc total %d\n",
|
||||
"pkt3 size %zd frags size %zd calc total %zd\n",
|
||||
sizeof(pkt3), net_buf_frags_len(buf->frags),
|
||||
total + sizeof(struct net_ipv6_hdr));
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue