Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stack backtrace: fix alignment and skipping
runtime.Stack() returns a stack that includes one additional line with goroutine information (tested with Go 1.12.6, probably was already done like that for quite a while). PruneStack then returned a pruned stack that started with a source code line instead of the function name and that did not skip all intermediate entries. Example: Stack: "runtime/debug.Stack(0x0, 0x0, 0x0)", "\t/nvme/gopath/go/src/runtime/debug/stack.go:24 +0xa1", "k8s.io/kubernetes/vendor/github.com/onsi/ginkgo/internal/codeloc...+39 more", "\t/nvme/gopath/src/k8s.io/kubernetes/vendor/github.com/onsi/ginkg...+49 more", "k8s.io/kubernetes/vendor/github.com/onsi/ginkgo.Fail(0xc00052677...+32 more", "\t/nvme/gopath/src/k8s.io/kubernetes/vendor/github.com/onsi/ginkg...+25 more", "k8s.io/kubernetes/test/e2e/framework/ginkgowrapper.Fail(0xc00052...+35 more", "\t/nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/ginkgowra...+25 more", "k8s.io/kubernetes/test/e2e/framework/log.Fail(0xc00038e1e0, 0x4f...+25 more", "\t/nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/log/logge...+14 more", "k8s.io/kubernetes/vendor/github.com/onsi/gomega/internal/asserti...+103 more", "\t/nvme/gopath/src/k8s.io/kubernetes/vendor/github.com/onsi/gomeg...+43 more", "k8s.io/kubernetes/vendor/github.com/onsi/gomega/internal/asserti...+95 more", "\t/nvme/gopath/src/k8s.io/kubernetes/vendor/github.com/onsi/gomeg...+42 more", "k8s.io/kubernetes/test/e2e/framework/log_test.glob..func1.5()", ... Skip: 5 Resulting stack (for some other example): /nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/log/logger.go:51 +0x143 k8s.io/kubernetes/test/e2e/framework/log.Failf(...) /nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/log/logger.go:43 => k8s.io/kubernetes/test/e2e/framework/log_test.glob..func1.2.1(...) /nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/log/logger_test.go:41 k8s.io/kubernetes/test/e2e/framework/log_test.glob..func1.2() /nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/log/logger_test.go:42 +0x52 k8s.io/kubernetes/vendor/github.com/onsi/ginkgo/internal/leafnodes.(*runner).runSync(0xc00029b020, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /nvme/gopath/src/k8s.io/kubernetes/test/e2e/framework/log/logger_test.go:65 +0x1c8 testing.tRunner(0xc000358600, 0x19818c0) /nvme/gopath/go/src/testing/testing.go:865 +0xc0 created by testing.(*T).Run /nvme/gopath/go/src/testing/testing.go:916 +0x35a It should start with the line marked with =>. To achieve that, the goroutine line must be removed and the caller must use the right skip count.
- Loading branch information