1
// -*- Mode: Go; indent-tabs-mode: t -*-
4
* Copyright (C) 2015 Canonical Ltd
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 3 as
8
* published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26
"launchpad.net/snappy/_integration-tests/testutils"
30
// IntegrationTestName is the name of the test binary.
31
IntegrationTestName = "integration.test"
33
testsBinDir = "_integration-tests/bin/"
36
// Assets builds the snappy and integration tests binaries for the target
38
func Assets(useSnappyFromBranch bool, arch string) {
39
testutils.PrepareTargetDir(testsBinDir)
41
if useSnappyFromBranch {
42
// FIXME We need to build an image that has the snappy from the branch
43
// installed. --elopio - 2015-06-25.
49
func buildSnappyCLI(arch string) {
50
fmt.Println("Building snappy CLI...")
51
// On the root of the project we have a directory called snappy, so we
52
// output the binary for the tests in the tests directory.
53
goCall(arch, "build", "-o", testsBinDir+"snappy", "./cmd/snappy")
56
func buildTests(arch string) {
57
fmt.Println("Building tests...")
59
goCall(arch, "test", "-c", "./_integration-tests/tests")
60
// XXX Go test 1.3 does not have the output flag, so we move the
61
// binaries after they are generated.
62
os.Rename("tests.test", testsBinDir+IntegrationTestName)
65
func goCall(arch string, cmds ...string) {
67
defer os.Setenv("GOARCH", os.Getenv("GOARCH"))
68
os.Setenv("GOARCH", arch)
70
defer os.Setenv("GOARM", os.Getenv("GOARM"))
71
os.Setenv("GOARM", defaultGoArm)
74
goCmd := append([]string{"go"}, cmds...)
75
testutils.ExecCommand(goCmd...)