2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-13 00:36:35 +00:00

ci test: add message prefix

This commit is contained in:
Alexander Neumann 2015-08-19 20:29:06 +02:00
parent 5b21d67a49
commit 527593c6df

View File

@ -22,7 +22,7 @@ type TravisEnvironment struct {
} }
func (env *TravisEnvironment) Prepare() { func (env *TravisEnvironment) Prepare() {
fmt.Printf("preparing environment for Travis CI\n") msg("preparing environment for Travis CI\n")
run("go", "get", "github.com/mattn/goveralls") run("go", "get", "github.com/mattn/goveralls")
run("go", "get", "github.com/mitchellh/gox") run("go", "get", "github.com/mitchellh/gox")
@ -43,7 +43,7 @@ func (env *TravisEnvironment) Prepare() {
env.goxOS = []string{"linux", "darwin", "freebsd", "openbsd", "windows"} env.goxOS = []string{"linux", "darwin", "freebsd", "openbsd", "windows"}
} }
fmt.Printf("gox: OS %v, ARCH %v\n", env.goxOS, env.goxArch) msg("gox: OS %v, ARCH %v\n", env.goxOS, env.goxArch)
run("gox", "-build-toolchain", run("gox", "-build-toolchain",
"-os", strings.Join(env.goxOS, " "), "-os", strings.Join(env.goxOS, " "),
"-arch", strings.Join(env.goxArch, " ")) "-arch", strings.Join(env.goxArch, " "))
@ -52,7 +52,7 @@ func (env *TravisEnvironment) Prepare() {
func (env *TravisEnvironment) RunTests() { func (env *TravisEnvironment) RunTests() {
// run fuse tests on darwin // run fuse tests on darwin
if runtime.GOOS != "darwin" { if runtime.GOOS != "darwin" {
fmt.Printf("skip fuse integration tests on %v\n", runtime.GOOS) msg("skip fuse integration tests on %v\n", runtime.GOOS)
os.Setenv("RESTIC_TEST_FUSE", "0") os.Setenv("RESTIC_TEST_FUSE", "0")
} }
@ -96,6 +96,10 @@ func findGoFiles(dir string) (list []string, err error) {
return list, err return list, err
} }
func msg(format string, args ...interface{}) {
fmt.Printf("CI: "+format, args...)
}
func runGofmt() { func runGofmt() {
dir, err := os.Getwd() dir, err := os.Getwd()
if err != nil { if err != nil {
@ -109,7 +113,7 @@ func runGofmt() {
os.Exit(4) os.Exit(4)
} }
fmt.Printf("runGofmt() with %d files\n", len(files)) msg("runGofmt() with %d files\n", len(files))
args := append([]string{"-l"}, files...) args := append([]string{"-l"}, files...)
cmd := exec.Command("gofmt", args...) cmd := exec.Command("gofmt", args...)
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
@ -129,7 +133,7 @@ func runGofmt() {
} }
func run(command string, args ...string) { func run(command string, args ...string) {
fmt.Printf("run %v %v\n", command, strings.Join(args, " ")) msg("run %v %v\n", command, strings.Join(args, " "))
cmd := exec.Command(command, args...) cmd := exec.Command(command, args...)
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr