runner and all_tests should exit with failure on failing tests.
Otherwise the bots don't notice.
BUG=473924
Change-Id: Idb8cc4c255723ebbe2d52478040a70648910bf37
Reviewed-on: https://boringssl-review.googlesource.com/4232
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go
index f14833b..084ae46 100644
--- a/ssl/test/runner/runner.go
+++ b/ssl/test/runner/runner.go
@@ -3404,4 +3404,8 @@
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
}
}
+
+ if !testOutput.allPassed {
+ os.Exit(1)
+ }
}
diff --git a/ssl/test/runner/test_output.go b/ssl/test/runner/test_output.go
index f06da6f..bcb7a93 100644
--- a/ssl/test/runner/test_output.go
+++ b/ssl/test/runner/test_output.go
@@ -29,6 +29,7 @@
SecondsSinceEpoch float64 `json:"seconds_since_epoch"`
NumFailuresByType map[string]int `json:"num_failures_by_type"`
Tests map[string]testResult `json:"tests"`
+ allPassed bool
}
type testResult struct {
@@ -44,6 +45,7 @@
SecondsSinceEpoch: float64(time.Now().UnixNano()) / float64(time.Second/time.Nanosecond),
NumFailuresByType: make(map[string]int),
Tests: make(map[string]testResult),
+ allPassed: true,
}
}
@@ -57,6 +59,9 @@
IsUnexpected: result != "PASS",
}
t.NumFailuresByType[result]++
+ if result != "PASS" {
+ t.allPassed = false
+ }
}
func (t *testOutput) writeTo(name string) error {
diff --git a/util/all_tests.go b/util/all_tests.go
index 1a0651a..785e423 100644
--- a/util/all_tests.go
+++ b/util/all_tests.go
@@ -219,18 +219,19 @@
}
}
- if len(failed) == 0 {
- fmt.Printf("\nAll tests passed!\n")
- } else {
- fmt.Printf("\n%d of %d tests failed:\n", len(failed), len(tests))
- for _, test := range failed {
- fmt.Printf("\t%s\n", strings.Join([]string(test), " "))
- }
- }
-
if *jsonOutput != "" {
if err := testOutput.writeTo(*jsonOutput); err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err)
}
}
+
+ if len(failed) > 0 {
+ fmt.Printf("\n%d of %d tests failed:\n", len(failed), len(tests))
+ for _, test := range failed {
+ fmt.Printf("\t%s\n", strings.Join([]string(test), " "))
+ }
+ os.Exit(1)
+ }
+
+ fmt.Printf("\nAll tests passed!\n")
}