]> Cypherpunks repositories - gostls13.git/commitdiff
cgi: extra failure debugging in host_test
authorBrad Fitzpatrick <bradfitz@golang.org>
Mon, 21 Mar 2011 21:43:38 +0000 (14:43 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 21 Mar 2011 21:43:38 +0000 (14:43 -0700)
Trying to track down why this fails on some
people's machines.

R=rsc, adg, dsymonds
CC=golang-dev
https://golang.org/cl/4304041

src/pkg/http/cgi/host_test.go

index 9980356736c5d2d4e25211ba06cb6233bac3e44d..e8084b1134e3e8f8235933b106238c525e376e22 100644 (file)
@@ -48,6 +48,7 @@ func runCgiTest(t *testing.T, h *Handler, httpreq string, expectedMap map[string
 
        // Make a map to hold the test map that the CGI returns.
        m := make(map[string]string)
+       linesRead := 0
 readlines:
        for {
                line, err := rw.Body.ReadString('\n')
@@ -57,10 +58,12 @@ readlines:
                case err != nil:
                        t.Fatalf("unexpected error reading from CGI: %v", err)
                }
-               line = strings.TrimRight(line, "\r\n")
-               split := strings.Split(line, "=", 2)
+               linesRead++
+               trimmedLine := strings.TrimRight(line, "\r\n")
+               split := strings.Split(trimmedLine, "=", 2)
                if len(split) != 2 {
-                       t.Fatalf("Unexpected %d parts from invalid line: %q", len(split), line)
+                       t.Fatalf("Unexpected %d parts from invalid line number %v: %q; existing map=%v",
+                               len(split), linesRead, line, m)
                }
                m[split[0]] = split[1]
        }