Skip to content

Commit 050a023

Browse files
authored
veb, vweb: update unit tests to deal with net.inet.ip.connect_inaddr_wild on FreeBSD (fix 25935) (#25972)
1 parent ae66145 commit 050a023

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

vlib/veb/tests/veb_should_listen_on_both_ipv4_and_ipv6_by_default_test.v

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ fn test_net_http_connecting_through_ipv6_works() {
8282
log.warn('skipping test ${@FN} on windows for now')
8383
return
8484
}
85+
$if freebsd {
86+
// if the sysctl net.inet.ip.connect_inaddr_wild doesn't exist or
87+
// if it axists and is non-zero, we should expect the IPv6 socket to be open.
88+
result := os.execute('sysctl net.inet.ip.connect_inaddr_wild')
89+
if result.exit_code == 0
90+
&& result.output.trim_space() == 'net.inet.ip.connect_inaddr_wild: 0' {
91+
log.warn('skipping test ${@FN} on FreeBSD because sysctl setting net.inet.ip.connect_inaddr_wild=0')
92+
return
93+
}
94+
}
8595
res := http.get('http://[::1]:${port}/')!
8696
assert res.status_code == 200, res.str()
8797
assert res.status_msg == 'OK', res.str()

vlib/vweb/tests/vweb_should_listen_on_both_ipv4_and_ipv6_by_default_test.v

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ fn test_net_http_connecting_through_ipv6_works() {
8181
log.warn('skipping test ${@FN} on windows for now')
8282
return
8383
}
84+
$if freebsd {
85+
// if the sysctl net.inet.ip.connect_inaddr_wild doesn't exist or
86+
// if it axists and is non-zero, we should expect the IPv6 socket to be open.
87+
result := os.execute('sysctl net.inet.ip.connect_inaddr_wild')
88+
if result.exit_code == 0
89+
&& result.output.trim_space() == 'net.inet.ip.connect_inaddr_wild: 0' {
90+
log.warn('skipping test ${@FN} on FreeBSD because sysctl setting net.inet.ip.connect_inaddr_wild=0')
91+
return
92+
}
93+
}
8494
res := http.get('http://[::1]:${port}/')!
8595
assert res.status_code == 200, res.str()
8696
assert res.status_msg == 'OK', res.str()

0 commit comments

Comments
 (0)