mirror of
https://github.com/criyle/go-sandbox.git
synced 2025-11-04 14:49:53 +08:00
fix unit test
This commit is contained in:
parent
c8d682f4b6
commit
a6c330b612
@ -148,22 +148,17 @@ func benchmarkRun(r *Runner, b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getMounts(dirs []string) []*mount.Mount {
|
func getMounts(dirs []string) []mount.SyscallParams {
|
||||||
ret := make([]*mount.Mount, 0, len(dirs))
|
builder := mount.NewBuilder()
|
||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
if _, err := os.Stat(d); !os.IsNotExist(err) {
|
builder.WithMount(mount.Mount{
|
||||||
ret = append(ret, getMount(d))
|
Source: d,
|
||||||
}
|
Target: d[1:],
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
|
|
||||||
func getMount(dir string) *mount.Mount {
|
|
||||||
return &mount.Mount{
|
|
||||||
Source: dir,
|
|
||||||
Target: dir[1:],
|
|
||||||
Flags: roBind,
|
Flags: roBind,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
m, _ := builder.Build(true)
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func openNull(b *testing.B) *os.File {
|
func openNull(b *testing.B) *os.File {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user