OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [lookup_test.go] - Blame information for rev 861

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2009 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.
4
 
5
// TODO It would be nice to use a mock DNS server, to eliminate
6
// external dependencies.
7
 
8
package net
9
 
10
import (
11
        "runtime"
12
        "testing"
13
)
14
 
15
var avoidMacFirewall = runtime.GOOS == "darwin"
16
 
17
func TestGoogleSRV(t *testing.T) {
18
        if testing.Short() || avoidMacFirewall {
19
                t.Logf("skipping test to avoid external network")
20
                return
21
        }
22
        _, addrs, err := LookupSRV("xmpp-server", "tcp", "google.com")
23
        if err != nil {
24
                t.Errorf("failed: %s", err)
25
        }
26
        if len(addrs) == 0 {
27
                t.Errorf("no results")
28
        }
29
 
30
        // Non-standard back door.
31
        _, addrs, err = LookupSRV("", "", "_xmpp-server._tcp.google.com")
32
        if err != nil {
33
                t.Errorf("back door failed: %s", err)
34
        }
35
        if len(addrs) == 0 {
36
                t.Errorf("back door no results")
37
        }
38
}
39
 
40
func TestGmailMX(t *testing.T) {
41
        if testing.Short() || avoidMacFirewall {
42
                t.Logf("skipping test to avoid external network")
43
                return
44
        }
45
        mx, err := LookupMX("gmail.com")
46
        if err != nil {
47
                t.Errorf("failed: %s", err)
48
        }
49
        if len(mx) == 0 {
50
                t.Errorf("no results")
51
        }
52
}
53
 
54
func TestGmailTXT(t *testing.T) {
55
        if testing.Short() || avoidMacFirewall {
56
                t.Logf("skipping test to avoid external network")
57
                return
58
        }
59
        txt, err := LookupTXT("gmail.com")
60
        if err != nil {
61
                t.Errorf("failed: %s", err)
62
        }
63
        if len(txt) == 0 || len(txt[0]) == 0 {
64
                t.Errorf("no results")
65
        }
66
}
67
 
68
func TestGoogleDNSAddr(t *testing.T) {
69
        if testing.Short() || avoidMacFirewall {
70
                t.Logf("skipping test to avoid external network")
71
                return
72
        }
73
        names, err := LookupAddr("8.8.8.8")
74
        if err != nil {
75
                t.Errorf("failed: %s", err)
76
        }
77
        if len(names) == 0 {
78
                t.Errorf("no results")
79
        }
80
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.