Files
Nim/tests/stdlib/tgetaddrinfo.nim
Euan c5c6bae2a4 #12103 - CI for FreeBSD (#12179)
* Ref #12103 - adds FreeBSD CI
* Fix getApplFreebsd - length of the string includes the null terminator byte, so minus 1 for result length
* Show last commit in setup task.
* Remove .git from repository URL
* Don't include noisy details showing last commit.
* Add FreeBSD build status badge
* Fix #12182 - disable tconsole on FreeBSD
* Disable tgetaddrinfo on FreebSD as getaddrinfo doesn't support the ICMP protocol.
* Install boehm-gc-threaded
* Use libgc-threaded.so on FreeBSD rather than libgc.so.
* Simplify build failure handling. Update alt text for CI badge.
* Disable test on FreeBSD
* Simplify build config

- use GNU make to build csources
- set PATH variable using the environment key
- remove modification of config to set CC as this is already set

* Install git which seems to be missing from current freebsd images
* Revert change to how path is set
* Add a comment explaining why the length is truncated
* Fix tconsole.
2019-11-29 21:00:54 +01:00

37 lines
1.1 KiB
Nim

discard """
exitcode: 0
output: ""
"""
# bug: https://github.com/nim-lang/Nim/issues/10198
import nativesockets
block DGRAM_UDP:
let aiList = getAddrInfo("127.0.0.1", 999.Port, AF_INET, SOCK_DGRAM, IPPROTO_UDP)
doAssert aiList != nil
doAssert aiList.ai_addr != nil
doAssert aiList.ai_addrlen.SockLen == sizeof(Sockaddr_in).SockLen
doAssert aiList.ai_next == nil
freeAddrInfo aiList
when defined(posix) and not defined(haiku) and not defined(freebsd):
block RAW_ICMP:
# the port will be ignored
let aiList = getAddrInfo("127.0.0.1", 999.Port, AF_INET, SOCK_RAW, IPPROTO_ICMP)
doAssert aiList != nil
doAssert aiList.ai_addr != nil
doAssert aiList.ai_addrlen.SockLen == sizeof(Sockaddr_in).SockLen
doAssert aiList.ai_next == nil
freeAddrInfo aiList
block RAW_ICMPV6:
# the port will be ignored
let aiList = getAddrInfo("::1", 999.Port, AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)
doAssert aiList != nil
doAssert aiList.ai_addr != nil
doAssert aiList.ai_addrlen.SockLen == sizeof(Sockaddr_in6).SockLen
doAssert aiList.ai_next == nil
freeAddrInfo aiList