1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 //go:build cgo && !netgo && (aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris)
14 func TestCgoLookupIP(t
*testing
.T
) {
15 defer dnsWaitGroup
.Wait()
16 ctx
:= context
.Background()
17 _
, err
, ok
:= cgoLookupIP(ctx
, "ip", "localhost")
19 t
.Errorf("cgoLookupIP must not be a placeholder")
26 func TestCgoLookupIPWithCancel(t
*testing
.T
) {
27 defer dnsWaitGroup
.Wait()
28 ctx
, cancel
:= context
.WithCancel(context
.Background())
30 _
, err
, ok
:= cgoLookupIP(ctx
, "ip", "localhost")
32 t
.Errorf("cgoLookupIP must not be a placeholder")
39 func TestCgoLookupPort(t
*testing
.T
) {
40 defer dnsWaitGroup
.Wait()
41 ctx
:= context
.Background()
42 _
, err
, ok
:= cgoLookupPort(ctx
, "tcp", "smtp")
44 t
.Errorf("cgoLookupPort must not be a placeholder")
51 func TestCgoLookupPortWithCancel(t
*testing
.T
) {
52 defer dnsWaitGroup
.Wait()
53 ctx
, cancel
:= context
.WithCancel(context
.Background())
55 _
, err
, ok
:= cgoLookupPort(ctx
, "tcp", "smtp")
57 t
.Errorf("cgoLookupPort must not be a placeholder")
64 func TestCgoLookupPTR(t
*testing
.T
) {
65 defer dnsWaitGroup
.Wait()
66 ctx
:= context
.Background()
67 _
, err
, ok
:= cgoLookupPTR(ctx
, "127.0.0.1")
69 t
.Errorf("cgoLookupPTR must not be a placeholder")
76 func TestCgoLookupPTRWithCancel(t
*testing
.T
) {
77 defer dnsWaitGroup
.Wait()
78 ctx
, cancel
:= context
.WithCancel(context
.Background())
80 _
, err
, ok
:= cgoLookupPTR(ctx
, "127.0.0.1")
82 t
.Errorf("cgoLookupPTR must not be a placeholder")