Test: Make TestCaptureTestFunc pass in localunittest

TestCaptureTestFunc failed in localunittest:
 # make localunittest
 === RUN   TestCaptureTestFunc
 --- FAIL: TestCaptureTestFunc (0.00s)
         capture_test.go:26: expected package "github.com/opencontainers/runc/libcontainer/stacktrace" but received "_/root/runc/libcontainer/stacktrace"
 #

Reason: the path for stacktrace is a fixed string which
only valid for container environment.
And we can switch to relative path to make both in-container
and out-of-container test works.

After patch:
 # make localunittest
 === RUN   TestCaptureTestFunc
 --- PASS: TestCaptureTestFunc (0.00s)
 #

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
This commit is contained in:
Zhao Lei 2016-08-16 18:29:00 +08:00
parent e574996911
commit bb067f55aa
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ func TestCaptureTestFunc(t *testing.T) {
if expected := "captureFunc"; frame.Function != expected {
t.Fatalf("expteced function %q but recevied %q", expected, frame.Function)
}
expected := "github.com/opencontainers/runc/libcontainer/stacktrace"
expected := "/runc/libcontainer/stacktrace"
if !strings.HasSuffix(frame.Package, expected) {
t.Fatalf("expected package %q but received %q", expected, frame.Package)
}