From 3e46977ec15093ff8fcf84bf5d3e339c17a06630 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Mon, 29 Feb 2016 06:45:33 -0800 Subject: [PATCH] Fix to allow for build in different path The path in the stacktrace might not be: "github.com/opencontainers/runc/libcontainer/stacktrace" For example, for me its: "_/go/src/github.com/opencontainers/runc/libcontainer/stacktrace" so I changed the check to make sure the tail end of the path matches instead of the entire thing Signed-off-by: Doug Davis --- libcontainer/stacktrace/capture_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libcontainer/stacktrace/capture_test.go b/libcontainer/stacktrace/capture_test.go index 83379302..7e99a266 100644 --- a/libcontainer/stacktrace/capture_test.go +++ b/libcontainer/stacktrace/capture_test.go @@ -1,6 +1,9 @@ package stacktrace -import "testing" +import ( + "strings" + "testing" +) func captureFunc() Stacktrace { return Capture(0) @@ -18,7 +21,8 @@ func TestCaptureTestFunc(t *testing.T) { if expected := "captureFunc"; frame.Function != expected { t.Fatalf("expteced function %q but recevied %q", expected, frame.Function) } - if expected := "github.com/opencontainers/runc/libcontainer/stacktrace"; frame.Package != expected { + expected := "github.com/opencontainers/runc/libcontainer/stacktrace" + if !strings.HasSuffix(frame.Package, expected) { t.Fatalf("expected package %q but received %q", expected, frame.Package) } if expected := "capture_test.go"; frame.File != expected {