blob: f5ae90573cdef833fe684562456ec75684e52217 [file] [log] [blame]
diff -u original/runner.go bogo/runner.go
--- original/runner.go 2018-09-13 21:07:29.000000000 +0100
+++ bogo/runner.go 2019-01-20 11:51:00.705040230 +0000
@@ -84,6 +84,14 @@
// like “SSL_ERROR_NO_CYPHER_OVERLAP”.
ErrorMap map[string]string
+ // TestErrorMap maps from full test names to the correct error
+ // string for the shim in question.
+ TestErrorMap map[string]string
+
+ // TestLocalErrorMap maps from full test names to the correct local
+ // error string for the shim in question.
+ TestLocalErrorMap map[string]string
+
// HalfRTTTickets is the number of half-RTT tickets the client should
// expect before half-RTT data when testing 0-RTT.
HalfRTTTickets int
@@ -986,7 +994,11 @@
}
}
-func translateExpectedError(errorStr string) string {
+func translateExpectedError(testName string, errorStr string) string {
+ if translated, ok := shimConfig.TestErrorMap[testName]; ok {
+ return translated
+ }
+
if translated, ok := shimConfig.ErrorMap[errorStr]; ok {
return translated
}
@@ -998,6 +1010,14 @@
return errorStr
}
+func translateExpectedLocalError(testName string, localError string) string {
+ if translated, ok := shimConfig.TestLocalErrorMap[testName]; ok {
+ return translated
+ }
+
+ return localError
+}
+
func runTest(test *testCase, shimPath string, mallocNumToFail int64) error {
// Help debugging panics on the Go side.
defer func() {
@@ -1275,18 +1295,20 @@
}
failed := err != nil || childErr != nil
- expectedError := translateExpectedError(test.expectedError)
+ expectedError := translateExpectedError(test.name, test.expectedError)
correctFailure := len(expectedError) == 0 || strings.Contains(stderr, expectedError)
+ shouldFail := test.shouldFail || expectedError != ""
+ var expectedLocalError = translateExpectedLocalError(test.name, test.expectedLocalError)
localError := "none"
if err != nil {
localError = err.Error()
}
- if len(test.expectedLocalError) != 0 {
- correctFailure = correctFailure && strings.Contains(localError, test.expectedLocalError)
+ if len(expectedLocalError) != 0 {
+ correctFailure = correctFailure && strings.Contains(localError, expectedLocalError)
}
- if failed != test.shouldFail || failed && !correctFailure || mustFail {
+ if failed != shouldFail || failed && !correctFailure || mustFail {
childError := "none"
if childErr != nil {
childError = childErr.Error()
@@ -1294,9 +1316,9 @@
var msg string
switch {
- case failed && !test.shouldFail:
+ case failed && !shouldFail:
msg = "unexpected failure"
- case !failed && test.shouldFail:
+ case !failed && shouldFail:
msg = "unexpected success"
case failed && !correctFailure:
msg = "bad error (wanted '" + expectedError + "' / '" + test.expectedLocalError + "')"
Only in bogo/: runner.go.orig