Skip to content

Commit

Permalink
Merge pull request #1250 from paulbellamy/testrunner-summarize-fails
Browse files Browse the repository at this point in the history
Some usability tweaks to the test runner
  • Loading branch information
tomwilkie committed Jul 31, 2015
2 parents 55051f0 + 5a37f65 commit ca89cfe
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions testing/runner/runner.go
Expand Up @@ -31,6 +31,7 @@ var (

useScheduler = false
runParallel = false
verbose = false

consoleLock = sync.Mutex{}
)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -178,6 +181,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)
}
Expand Down Expand Up @@ -234,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)
Expand Down

0 comments on commit ca89cfe

Please sign in to comment.