~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/net/interface_linux_test.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
package net
6
6
 
7
 
import "testing"
 
7
import (
 
8
        "fmt"
 
9
        "os/exec"
 
10
        "testing"
 
11
)
 
12
 
 
13
func (ti *testInterface) setBroadcast(suffix int) error {
 
14
        ti.name = fmt.Sprintf("gotest%d", suffix)
 
15
        xname, err := exec.LookPath("ip")
 
16
        if err != nil {
 
17
                return err
 
18
        }
 
19
        ti.setupCmds = append(ti.setupCmds, &exec.Cmd{
 
20
                Path: xname,
 
21
                Args: []string{"ip", "link", "add", ti.name, "type", "dummy"},
 
22
        })
 
23
        ti.teardownCmds = append(ti.teardownCmds, &exec.Cmd{
 
24
                Path: xname,
 
25
                Args: []string{"ip", "link", "delete", ti.name, "type", "dummy"},
 
26
        })
 
27
        return nil
 
28
}
 
29
 
 
30
func (ti *testInterface) setPointToPoint(suffix int, local, remote string) error {
 
31
        ti.name = fmt.Sprintf("gotest%d", suffix)
 
32
        ti.local = local
 
33
        ti.remote = remote
 
34
        xname, err := exec.LookPath("ip")
 
35
        if err != nil {
 
36
                return err
 
37
        }
 
38
        ti.setupCmds = append(ti.setupCmds, &exec.Cmd{
 
39
                Path: xname,
 
40
                Args: []string{"ip", "tunnel", "add", ti.name, "mode", "gre", "local", local, "remote", remote},
 
41
        })
 
42
        ti.teardownCmds = append(ti.teardownCmds, &exec.Cmd{
 
43
                Path: xname,
 
44
                Args: []string{"ip", "tunnel", "del", ti.name, "mode", "gre", "local", local, "remote", remote},
 
45
        })
 
46
        xname, err = exec.LookPath("ifconfig")
 
47
        if err != nil {
 
48
                return err
 
49
        }
 
50
        ti.setupCmds = append(ti.setupCmds, &exec.Cmd{
 
51
                Path: xname,
 
52
                Args: []string{"ifconfig", ti.name, "inet", local, "dstaddr", remote},
 
53
        })
 
54
        return nil
 
55
}
8
56
 
9
57
const (
10
58
        numOfTestIPv4MCAddrs = 14