goconvey icon indicating copy to clipboard operation
goconvey copied to clipboard

Strip file name when stripping symbol in goroutine snapshot

Open maruel opened this issue 5 years ago • 0 comments

Sample code:

package main

import (
  "testing"

  . "github.com/smartystreets/goconvey/convey"
)

func TestSpec(t *testing.T) {
  Convey("Foo", t, func() {
    So(1, ShouldEqual, 2)
  })
}

Output looks like:

$ go test
x
Failures:

  * /home/maruel/src/foo/main_test.go
  Line 11:
  Expected: '2'
  Actual:   '1'
  (Should be equal)
  goroutine 18 [running]:
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/reporting/reports.go:143
+0x6f
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/reporting/reports.go:103
+0x71
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/context.go:176 +0xe6
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/doc.go:125 +0x66
  maruel%2eca.TestSpec.func1()
        /home/maruel/src/foo/main_test.go:11 +0x7f
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/discovery.go:80 +0x24
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/context.go:261 +0x125
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/context.go:110 +0xf0
  github.com/jtolds/gls.(*ContextManager).SetValues.func1(0x0)
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/context.go:97 +0x462
  github.com/jtolds/gls.EnsureGoroutineId.func1()
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/gid.go:24 +0x2e
  github.com/jtolds/gls._m(0x0, 0xc00018c160)
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/stack_tags.go:108 +0x31
  github.com/jtolds/gls.github_com_jtolds_gls_markS(0x0, 0xc00018c160)
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/stack_tags.go:56 +0x35
  github.com/jtolds/gls.addStackTag(...)
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/stack_tags.go:49
  github.com/jtolds/gls.EnsureGoroutineId(0xc00018e3f0)
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/gid.go:24 +0xfd
  github.com/jtolds/gls.(*ContextManager).SetValues(0xc00018a330, 0xc00018e390, 0xc00018c120)
        /home/maruel/go/pkg/mod/github.com/jtolds/[email protected]+incompatible/context.go:63 +0x153
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/context.go:105 +0x231
        /home/maruel/go/pkg/mod/github.com/smartystreets/[email protected]/convey/doc.go:75 +0xbe
  maruel%2eca.TestSpec(0xc000186300)
        /home/maruel/src/foo/main_test.go:10 +0x99
  testing.tRunner(0xc000186300, 0x5c6480)
        /home/maruel/src/golang/src/testing/testing.go:1108 +0xef
  created by testing.(*T).Run
        /home/maruel/src/golang/src/testing/testing.go:1159 +0x386



1 total assertion

--- FAIL: TestSpec (0.00s)
FAIL
exit status 1
FAIL    maruel.ca       0.005s

Notice the consecutive files in the stack trace. This is because of https://github.com/smartystreets/goconvey/blob/master/convey/reporting/reports.go#L155 which filters the private symbol but not the next line, the associated file path.

I just released panicparse v2.0.1 and if this would be fixed, by hiding lines in pairs, that would make panicparse be able to process goconvey output.

maruel avatar Aug 10 '20 23:08 maruel