summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/ginkgo/internal/codelocation
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2019-09-30 12:43:59 +0000
committerValentin Rothberg <rothberg@redhat.com>2019-09-30 15:11:28 +0200
commit427b71f147afd9d624aeb3b7fc6a26b55567d1b7 (patch)
treef0a4a6a102ecfe12ea92ce5e7afe3bd7b62181a8 /vendor/github.com/onsi/ginkgo/internal/codelocation
parent01b7af8ee9b3df1439c4da109ba11e7410108dab (diff)
downloadpodman-427b71f147afd9d624aeb3b7fc6a26b55567d1b7.tar.gz
podman-427b71f147afd9d624aeb3b7fc6a26b55567d1b7.tar.bz2
podman-427b71f147afd9d624aeb3b7fc6a26b55567d1b7.zip
Bump github.com/onsi/ginkgo from 1.8.0 to 1.10.1
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.8.0 to 1.10.1. - [Release notes](https://github.com/onsi/ginkgo/releases) - [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md) - [Commits](https://github.com/onsi/ginkgo/compare/v1.8.0...v1.10.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/onsi/ginkgo/internal/codelocation')
-rw-r--r--vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go b/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
index fa2f0bf73..aa89d6cba 100644
--- a/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
+++ b/vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
@@ -11,19 +11,35 @@ import (
func New(skip int) types.CodeLocation {
_, file, line, _ := runtime.Caller(skip + 1)
- stackTrace := PruneStack(string(debug.Stack()), skip)
+ stackTrace := PruneStack(string(debug.Stack()), skip+1)
return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace}
}
+// PruneStack removes references to functions that are internal to Ginkgo
+// and the Go runtime from a stack string and a certain number of stack entries
+// at the beginning of the stack. The stack string has the format
+// as returned by runtime/debug.Stack. The leading goroutine information is
+// optional and always removed if present. Beware that runtime/debug.Stack
+// adds itself as first entry, so typically skip must be >= 1 to remove that
+// entry.
func PruneStack(fullStackTrace string, skip int) string {
stack := strings.Split(fullStackTrace, "\n")
+ // Ensure that the even entries are the method names and the
+ // the odd entries the source code information.
+ if len(stack) > 0 && strings.HasPrefix(stack[0], "goroutine ") {
+ // Ignore "goroutine 29 [running]:" line.
+ stack = stack[1:]
+ }
+ // The "+1" is for skipping over the initial entry, which is
+ // runtime/debug.Stack() itself.
if len(stack) > 2*(skip+1) {
stack = stack[2*(skip+1):]
}
prunedStack := []string{}
re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`)
for i := 0; i < len(stack)/2; i++ {
- if !re.Match([]byte(stack[i*2])) {
+ // We filter out based on the source code file name.
+ if !re.Match([]byte(stack[i*2+1])) {
prunedStack = append(prunedStack, stack[i*2])
prunedStack = append(prunedStack, stack[i*2+1])
}