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 <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2016-02-29 06:45:33 -08:00
parent 8f7d5fe376
commit 3e46977ec1
1 changed files with 6 additions and 2 deletions

View File

@ -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 {