Explicitly log how long each step of e2e setup/test/teardown takes.

This commit is contained in:
Jeff Grafton 2015-09-15 15:03:34 -07:00
parent f03a267089
commit 170962becb

View File

@ -31,6 +31,7 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"time"
) )
var ( var (
@ -84,6 +85,7 @@ type TestResult struct {
type ResultsByTest map[string]TestResult type ResultsByTest map[string]TestResult
func main() { func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
flag.Parse() flag.Parse()
if *isup { if *isup {
@ -297,6 +299,10 @@ func finishRunning(stepName string, cmd *exec.Cmd) bool {
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
} }
log.Printf("Running: %v", stepName) log.Printf("Running: %v", stepName)
defer func(start time.Time) {
log.Printf("Step '%s' finished in %s", stepName, time.Since(start))
}(time.Now())
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
log.Printf("Error running %v: %v", stepName, err) log.Printf("Error running %v: %v", stepName, err)
return false return false