From cc7b781bb34d6ca7463b7cd3cef98f932200573b Mon Sep 17 00:00:00 2001 From: Paul Bellamy Date: Fri, 31 Jul 2015 12:12:33 +0100 Subject: [PATCH 1/2] have testrunner summarize failed tests so they are easier to find --- testing/runner/runner.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing/runner/runner.go b/testing/runner/runner.go index 5ee67f617b..755d97d75e 100644 --- a/testing/runner/runner.go +++ b/testing/runner/runner.go @@ -178,6 +178,9 @@ func getTests(testNames []string) (tests, error) { func summary(tests, failed tests) { if len(failed) > 0 { fmt.Printf("%s>>> Ran %d tests, %d failed%s\n", fail, len(tests), len(failed), reset) + for _, test := range failed { + fmt.Printf("%s>>> Fail %s%s\n", fail, test.name, reset) + } } else { fmt.Printf("%s>>> Ran %d tests, all succeeded%s\n", succ, len(tests), reset) } From 5a37f652c25f50a3f85e9fef3ec7f5cca8ff733d Mon Sep 17 00:00:00 2001 From: Paul Bellamy Date: Fri, 31 Jul 2015 12:25:50 +0100 Subject: [PATCH 2/2] add -v to testrunner, and less output in happy path --- testing/runner/runner.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/testing/runner/runner.go b/testing/runner/runner.go index 755d97d75e..fe4f7efe7d 100644 --- a/testing/runner/runner.go +++ b/testing/runner/runner.go @@ -31,6 +31,7 @@ var ( useScheduler = false runParallel = false + verbose = false consoleLock = sync.Mutex{} ) @@ -103,8 +104,10 @@ func (t test) run(hosts []string) bool { } else { fmt.Printf("%s>>> Test %s finished with success after %0.1f secs%s\n", succ, t.name, duration, reset) } - fmt.Print(out.String()) - fmt.Println() + if err != nil || verbose { + fmt.Print(out.String()) + fmt.Println() + } consoleLock.Unlock() if err != nil && useScheduler { @@ -237,8 +240,13 @@ func sequential(ts tests, hosts []string) bool { func main() { mflag.BoolVar(&useScheduler, []string{"scheduler"}, false, "Use scheduler to distribute tests across shards") mflag.BoolVar(&runParallel, []string{"parallel"}, false, "Run tests in parallel on hosts where possible") + mflag.BoolVar(&verbose, []string{"v"}, false, "Print output from all tests (Also enabled via DEBUG=1)") mflag.Parse() + if len(os.Getenv("DEBUG")) > 0 { + verbose = true + } + tests, err := getTests(mflag.Args()) if err != nil { fmt.Printf("Error parsing tests: %v\n", err)