Skip to content

testing: cannot print many-linestrings #3830

Description

@remyoudompheng
What steps will reproduce the problem?
1. Run "go test -v" on this file:

package p

import (
      "bytes"
      "fmt"
      "testing"
)

func TestTest(t *testing.T) {
      buf := new(bytes.Buffer)
      for i := 1; i < 50000; i++ {
            fmt.Fprintf(buf, "number %d\n", i)
      }
      t.Log(buf.String())
}

What is the expected output? What do you see instead?

Expected:
=== RUN TestTest
--- PASS: TestTest (0.06 seconds)
pkg_test.go:14:         number 1
                number 2
                number 3
                ...
                number 49997
                number 49998
                number 49999

                PASS
ok      testmap 10.129s

Got:
=== RUN TestTest
throw: runtime: out of memory

goroutine 3 [running]:
----- stack segment boundary -----
testing.decorate(0xf8b095f00d, 0x9400d, 0x9401a00000000, 0xf8b095f00d, 0x9400d, ...)
    /usr/lib/go/src/pkg/testing/testing.go:149 +0x21a
testing.decorate(0xf8b095f000, 0x9401a, 0x9402600000000, 0xf8b08ca00d, 0x94019, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
testing.decorate(0xf8b08ca000, 0x94026, 0x9403200000000, 0xf8b082400d, 0x94025, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
...
testing.decorate(0xf8ad642000, 0x943f2, 0x943fe00000000, 0xf8ad5ad00d, 0x943f1, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
testing.decorate(0xf8ad5ad000, 0x943fe, 0x9440a00000000, 0xf8ad50700d, 0x943fd, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
created by testing.RunTests
    /usr/lib/go/src/pkg/testing/testing.go:349 +0x782

goroutine 1 [chan receive]:
testing.RunTests(0x400c00, 0x5604a8, 0x100000001, 0x1, 0x5564a0, ...)
    /usr/lib/go/src/pkg/testing/testing.go:350 +0x7a5
testing.Main(0x400c00, 0x5604a8, 0x100000001, 0x5657c0, 0x0, ...)
    /usr/lib/go/src/pkg/testing/testing.go:285 +0x7a
main.main()
    /tmp/go-build554597359/testmap/_test/_testmain.go:43 +0x91

goroutine 2 [syscall]:
created by runtime.main
    /build/src/go/src/pkg/runtime/proc.c:221
exit status 2
FAIL    testmap 1.840s

Please use labels and text to provide additional information.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions