From 5b007183d0e3c5b4493ea82853000b0c7ce6c553 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Mon, 11 Nov 2024 13:57:04 +0200 Subject: [PATCH] tests: posix: headers: net: Convert to use zexpect Use zexpect instead of zassert so that the failed tests do not stop the test execution but we run all the tests. Signed-off-by: Jukka Rissanen --- tests/posix/headers/src/netinet_in_h.c | 90 +++++++++++++------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/posix/headers/src/netinet_in_h.c b/tests/posix/headers/src/netinet_in_h.c index 25cceb6aa97..141e2eb69fc 100644 --- a/tests/posix/headers/src/netinet_in_h.c +++ b/tests/posix/headers/src/netinet_in_h.c @@ -21,27 +21,27 @@ */ ZTEST(posix_headers, test_netinet_in_h) { - zassert_equal(sizeof(in_port_t), sizeof(uint16_t)); - zassert_equal(sizeof(in_addr_t), sizeof(uint32_t)); + zexpect_equal(sizeof(in_port_t), sizeof(uint16_t)); + zexpect_equal(sizeof(in_addr_t), sizeof(uint32_t)); - zassert_not_equal(-1, offsetof(struct in_addr, s_addr)); + zexpect_not_equal(-1, offsetof(struct in_addr, s_addr)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_family)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_port)); - zassert_not_equal(-1, offsetof(struct sockaddr_in, sin_addr)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_family)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_port)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in, sin_addr)); - zassert_not_equal(-1, offsetof(struct in6_addr, s6_addr)); - zassert_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t)); + zexpect_not_equal(-1, offsetof(struct in6_addr, s6_addr)); + zexpect_equal(sizeof(((struct in6_addr *)NULL)->s6_addr), 16 * sizeof(uint8_t)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_family)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_port)); /* not implemented */ - /* zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); - zassert_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); + /* zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_flowinfo)); */ + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_addr)); + zexpect_not_equal(-1, offsetof(struct sockaddr_in6, sin6_scope_id)); - zassert_not_null(&in6addr_any); - zassert_not_null(&in6addr_loopback); + zexpect_not_null(&in6addr_any); + zexpect_not_null(&in6addr_loopback); struct in6_addr any6 = IN6ADDR_ANY_INIT; struct in6_addr lo6 = IN6ADDR_LOOPBACK_INIT; @@ -62,42 +62,42 @@ ZTEST(posix_headers, test_netinet_in_h) struct in6_addr mcg6 = { { { 0xff, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 } } }; - zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); - zassert_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); + zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_multiaddr)); + zexpect_not_equal(-1, offsetof(struct ipv6_mreq, ipv6mr_ifindex)); - zassert_not_equal(-1, IPPROTO_IP); - zassert_not_equal(-1, IPPROTO_IPV6); - zassert_not_equal(-1, IPPROTO_ICMP); - zassert_not_equal(-1, IPPROTO_RAW); - zassert_not_equal(-1, IPPROTO_TCP); - zassert_not_equal(-1, IPPROTO_UDP); + zexpect_not_equal(-1, IPPROTO_IP); + zexpect_not_equal(-1, IPPROTO_IPV6); + zexpect_not_equal(-1, IPPROTO_ICMP); + zexpect_not_equal(-1, IPPROTO_RAW); + zexpect_not_equal(-1, IPPROTO_TCP); + zexpect_not_equal(-1, IPPROTO_UDP); - zassert_not_equal(-1, INADDR_ANY); - zassert_equal(0xffffffff, INADDR_BROADCAST); + zexpect_not_equal(-1, INADDR_ANY); + zexpect_equal(0xffffffff, INADDR_BROADCAST); - zassert_equal(INET_ADDRSTRLEN, 16); - zassert_equal(INET6_ADDRSTRLEN, 46); + zexpect_equal(INET_ADDRSTRLEN, 16); + zexpect_equal(INET6_ADDRSTRLEN, 46); - zassert_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); - zassert_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); - zassert_not_equal(-1, IPV6_MULTICAST_HOPS); - /* zassert_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ - /* zassert_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ - zassert_not_equal(-1, IPV6_UNICAST_HOPS); - zassert_not_equal(-1, IPV6_V6ONLY); + zexpect_equal(IPV6_ADD_MEMBERSHIP, IPV6_JOIN_GROUP); + zexpect_equal(IPV6_DROP_MEMBERSHIP, IPV6_LEAVE_GROUP); + zexpect_not_equal(-1, IPV6_MULTICAST_HOPS); + /* zexpect_not_equal(-1, IPV6_MULTICAST_IF); */ /* not implemented */ + /* zexpect_not_equal(-1, IPV6_MULTICAST_LOOP); */ /* not implemented */ + zexpect_not_equal(-1, IPV6_UNICAST_HOPS); + zexpect_not_equal(-1, IPV6_V6ONLY); - zassert_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); - zassert_true(IN6_IS_ADDR_LOOPBACK(&lo6)); + zexpect_true(IN6_IS_ADDR_UNSPECIFIED(&any6)); + zexpect_true(IN6_IS_ADDR_LOOPBACK(&lo6)); - zassert_true(IN6_IS_ADDR_MULTICAST(&mcast6)); - zassert_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); - zassert_true(IN6_IS_ADDR_SITELOCAL(&sl6)); - zassert_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); + zexpect_true(IN6_IS_ADDR_MULTICAST(&mcast6)); + zexpect_true(IN6_IS_ADDR_LINKLOCAL(&ll6)); + zexpect_true(IN6_IS_ADDR_SITELOCAL(&sl6)); + zexpect_true(IN6_IS_ADDR_V4MAPPED(&v4mapped)); /* IN6_IS_ADDR_V4COMPAT(&lo6); */ /* not implemented */ - zassert_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); - zassert_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); - zassert_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); - zassert_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); - zassert_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); + zexpect_true(IN6_IS_ADDR_MC_NODELOCAL(&mcnl6)); + zexpect_true(IN6_IS_ADDR_MC_LINKLOCAL(&mcll6)); + zexpect_true(IN6_IS_ADDR_MC_SITELOCAL(&mcsl6)); + zexpect_true(IN6_IS_ADDR_MC_ORGLOCAL(&mcol6)); + zexpect_true(IN6_IS_ADDR_MC_GLOBAL(&mcg6)); } #pragma GCC diagnostic pop