diff options
Diffstat (limited to 'container/container_test.go')
| -rw-r--r-- | container/container_test.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/container/container_test.go b/container/container_test.go index 41d39f68..1bdc28a1 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -16,6 +16,7 @@ import ( "strings" "syscall" "testing" + _ "unsafe" // for go:linkname "hakurei.app/check" "hakurei.app/command" @@ -233,6 +234,9 @@ func earlyMnt(mnt ...*vfs.MountInfoEntry) func(*testing.T, context.Context) []*v return func(*testing.T, context.Context) []*vfs.MountInfoEntry { return mnt } } +//go:linkname toHost hakurei.app/container.toHost +func toHost(name string) string + var containerTestCases = []struct { name string filter bool @@ -332,13 +336,15 @@ var containerTestCases = []struct { func(t *testing.T, ctx context.Context) []*vfs.MountInfoEntry { return []*vfs.MountInfoEntry{ ent("/", hst.PrivateTmp, "rw", "overlay", "overlay", - "rw,lowerdir="+ - container.InternalToHostOvlEscape(ctx.Value(testVal("lower0")).(*check.Absolute).String())+":"+ - container.InternalToHostOvlEscape(ctx.Value(testVal("lower1")).(*check.Absolute).String())+ + "rw"+ + ",lowerdir+="+ + toHost(ctx.Value(testVal("lower0")).(*check.Absolute).String())+ + ",lowerdir+="+ + toHost(ctx.Value(testVal("lower1")).(*check.Absolute).String())+ ",upperdir="+ - container.InternalToHostOvlEscape(ctx.Value(testVal("upper")).(*check.Absolute).String())+ + toHost(ctx.Value(testVal("upper")).(*check.Absolute).String())+ ",workdir="+ - container.InternalToHostOvlEscape(ctx.Value(testVal("work")).(*check.Absolute).String())+ + toHost(ctx.Value(testVal("work")).(*check.Absolute).String())+ ",redirect_dir=nofollow,uuid=on,userxattr"), } }, @@ -388,9 +394,11 @@ var containerTestCases = []struct { func(t *testing.T, ctx context.Context) []*vfs.MountInfoEntry { return []*vfs.MountInfoEntry{ ent("/", hst.PrivateTmp, "rw", "overlay", "overlay", - "ro,lowerdir="+ - container.InternalToHostOvlEscape(ctx.Value(testVal("lower0")).(*check.Absolute).String())+":"+ - container.InternalToHostOvlEscape(ctx.Value(testVal("lower1")).(*check.Absolute).String())+ + "ro"+ + ",lowerdir+="+ + toHost(ctx.Value(testVal("lower0")).(*check.Absolute).String())+ + ",lowerdir+="+ + toHost(ctx.Value(testVal("lower1")).(*check.Absolute).String())+ ",redirect_dir=nofollow,userxattr"), } }, |
