2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-03 09:30:50 +00:00

CI: return directly after an error occurred

This commit is contained in:
Alexander Neumann 2017-11-26 18:42:44 +01:00
parent f178cbf93d
commit a2766ffe0c

View File

@ -484,16 +484,21 @@ func main() {
os.Exit(1) os.Exit(1)
} }
foundError := false err := env.Prepare()
for _, f := range []func() error{env.Prepare, env.RunTests, env.Teardown} { if err != nil {
err := f() fmt.Fprintf(os.Stderr, "error preparing: %v\n", err)
if err != nil {
foundError = true
fmt.Fprintf(os.Stderr, "error: %v\n", err)
}
}
if foundError {
os.Exit(1) os.Exit(1)
} }
err = env.RunTests()
if err != nil {
fmt.Fprintf(os.Stderr, "error running tests: %v\n", err)
os.Exit(2)
}
err = env.Teardown()
if err != nil {
fmt.Fprintf(os.Stderr, "error during teardown: %v\n", err)
os.Exit(3)
}
} }