Update build.go and run_integration_tests.go

This commit is contained in:
Alexander Neumann 2016-02-14 17:39:51 +01:00
parent 841326d713
commit 96e66bb3e9
2 changed files with 40 additions and 20 deletions

View file

@ -154,27 +154,31 @@ func (env *TravisEnvironment) RunTests() {
os.Setenv("RESTIC_TEST_FUSE", "0")
}
cwd, err := os.Getwd()
if err != nil {
fmt.Fprintf(os.Stderr, "Getwd() returned error: %v", err)
os.Exit(9)
}
envWithGOPATH := make(map[string]string)
envWithGOPATH["GOPATH"] = cwd + ":" + filepath.Join(cwd, "vendor")
if *runCrossCompile {
// compile for all target architectures with tags
for _, tags := range []string{"release", "debug"} {
run("gox", "-verbose",
runWithEnv(envWithGOPATH, "gox", "-verbose",
"-os", strings.Join(env.goxOS, " "),
"-arch", strings.Join(env.goxArch, " "),
"-tags", tags,
"-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}",
"./cmd/restic")
"restic/cmd/restic")
}
}
// run the build script
run("go", "run", "build.go")
var (
testEnv map[string]string
srv *MinioServer
err error
)
var srv *MinioServer
if env.minio != "" {
srv, err = NewMinioServer(env.minio)
if err != nil {
@ -182,11 +186,13 @@ func (env *TravisEnvironment) RunTests() {
os.Exit(8)
}
testEnv = minioEnv
for k, v := range minioEnv {
envWithGOPATH[k] = v
}
}
// run the tests and gather coverage information
runWithEnv(testEnv, "gotestcover", "-coverprofile", "all.cov", "./...")
runWithEnv(envWithGOPATH, "gotestcover", "-coverprofile", "all.cov", "restic/...")
runGofmt()