Skip to content

Commit

Permalink
test: optional IPv6 for tcp/udp tos test
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Jan 3, 2025
1 parent af43021 commit 1f802b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static bool ipv6_handler(const char *ifname, const struct sa *sa, void *arg)
}


static bool ipv6_supported(void)
bool test_ipv6_supported(void)
{
bool supp = false;

Expand All @@ -51,7 +51,7 @@ int test_net_dst_source_addr_get(void)

TEST_ASSERT(sa_is_loopback(&ip));

if (ipv6_supported()) {
if (test_ipv6_supported()) {

sa_init(&dst, AF_INET6);
sa_init(&ip, AF_UNSPEC);
Expand Down
6 changes: 4 additions & 2 deletions test/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,10 @@ int test_tcp_tos(void)
err = tcp_tos("127.0.0.1");
TEST_ERR(err);

err = tcp_tos("::1");
TEST_ERR(err);
if (test_ipv6_supported()) {
err = tcp_tos("::1");
TEST_ERR(err);
}

out:
return err;
Expand Down
1 change: 1 addition & 0 deletions test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ int test_load_file(struct mbuf *mb, const char *filename);
int test_write_file(struct mbuf *mb, const char *filename);
void test_set_datapath(const char *path);
const char *test_datapath(void);
bool test_ipv6_supported(void);


/*
Expand Down
6 changes: 4 additions & 2 deletions test/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,10 @@ int test_udp_tos(void)
err = udp_tos("127.0.0.1");
TEST_ERR(err);

err = udp_tos("::1");
TEST_ERR(err);
if (test_ipv6_supported()) {
err = udp_tos("::1");
TEST_ERR(err);
}

out:
return err;
Expand Down

0 comments on commit 1f802b3

Please sign in to comment.