~davidc3/snappy/oem-docs-formatting

« back to all changes in this revision

Viewing changes to _integration-tests/testutils/build/build.go

  • Committer: Snappy Tarmac
  • Author(s): Federico Gimenez
  • Date: 2015-09-16 11:23:45 UTC
  • mfrom: (644.16.13 snapd_integration_tests)
  • Revision ID: snappy_tarmac-20150916112345-3pqi7xek2ml642cp
snapd integration test by fgimenez approved by chipaca

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import (
23
23
        "fmt"
24
24
        "os"
 
25
        "path/filepath"
25
26
        "strings"
26
27
 
27
28
        "launchpad.net/snappy/_integration-tests/testutils"
28
29
)
29
30
 
30
31
const (
31
 
        buildTestCmd   = "go test -c ./_integration-tests/tests"
32
 
        buildSnappyCmd = "go build -o " + testsBinDir + "snappy ./cmd/snappy"
 
32
        buildTestCmd = "go test -c ./_integration-tests/tests"
33
33
 
34
34
        // IntegrationTestName is the name of the test binary.
35
35
        IntegrationTestName = "integration.test"
44
44
        osRename         = os.Rename
45
45
        osSetenv         = os.Setenv
46
46
        osGetenv         = os.Getenv
 
47
 
 
48
        // The output of the build commands for testing goes to the testsBinDir path,
 
49
        // which is under the _integration-tests directory. The
 
50
        // _integration-tests/reboot-wrapper script (Test-Command's entry point of
 
51
        // adt-run) takes care of including testsBinDir at the beginning of $PATH, so
 
52
        // that these binaries (if they exist) take precedence over the system ones
 
53
        buildSnappyCliCmd = "go build -o " +
 
54
                filepath.Join(testsBinDir, "snappy") + " ." + string(os.PathSeparator) + filepath.Join("cmd", "snappy")
 
55
        buildSnapdCmd = "go build -o " +
 
56
                filepath.Join(testsBinDir, "snapd") + " ." + string(os.PathSeparator) + filepath.Join("cmd", "snapd")
47
57
)
48
58
 
49
59
// Assets builds the snappy and integration tests binaries for the target
55
65
                // FIXME We need to build an image that has the snappy from the branch
56
66
                // installed. --elopio - 2015-06-25.
57
67
                buildSnappyCLI(arch)
 
68
                buildSnapd(arch)
58
69
        }
59
70
        buildTests(arch)
60
71
}
61
72
 
62
73
func buildSnappyCLI(arch string) {
63
74
        fmt.Println("Building snappy CLI...")
64
 
        // On the root of the project we have a directory called snappy, so we
65
 
        // output the binary for the tests in the tests directory.
66
 
        goCall(arch, buildSnappyCmd)
 
75
        goCall(arch, buildSnappyCliCmd)
 
76
}
 
77
 
 
78
func buildSnapd(arch string) {
 
79
        fmt.Println("Building snapd...")
 
80
        goCall(arch, buildSnapdCmd)
67
81
}
68
82
 
69
83
func buildTests(arch string) {