Move detach flags to platform specific
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
parent
f74cea71dd
commit
96a75ab1ab
5
snapshot/testsuite/helpers_linux.go
Normal file
5
snapshot/testsuite/helpers_linux.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package testsuite
|
||||||
|
|
||||||
|
import "golang.org/x/sys/unix"
|
||||||
|
|
||||||
|
const umountflags int = unix.MNT_DETACH
|
5
snapshot/testsuite/helpers_other.go
Normal file
5
snapshot/testsuite/helpers_other.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// +build !linux
|
||||||
|
|
||||||
|
package testsuite
|
||||||
|
|
||||||
|
const umountflags int = 0
|
@ -2,13 +2,7 @@
|
|||||||
|
|
||||||
package testsuite
|
package testsuite
|
||||||
|
|
||||||
import (
|
import "syscall"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
|
||||||
|
|
||||||
const umountflags int = unix.MNT_DETACH
|
|
||||||
|
|
||||||
func clearMask() func() {
|
func clearMask() func() {
|
||||||
oldumask := syscall.Umask(0)
|
oldumask := syscall.Umask(0)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package testsuite
|
package testsuite
|
||||||
|
|
||||||
const umountflags int = 0
|
|
||||||
|
|
||||||
func clearMask() func() {
|
func clearMask() func() {
|
||||||
return func() {}
|
return func() {}
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,12 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/mount"
|
"github.com/containerd/containerd/mount"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"golang.org/x/sys/unix"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Unmount unmounts a given mountPoint and sets t.Error if it fails
|
// Unmount unmounts a given mountPoint and sets t.Error if it fails
|
||||||
func Unmount(t *testing.T, mountPoint string) {
|
func Unmount(t *testing.T, mountPoint string) {
|
||||||
t.Log("unmount", mountPoint)
|
t.Log("unmount", mountPoint)
|
||||||
if err := mount.UnmountAll(mountPoint, unix.MNT_DETACH); err != nil {
|
if err := mount.UnmountAll(mountPoint, umountflags); err != nil {
|
||||||
t.Error("Could not umount", mountPoint, err)
|
t.Error("Could not umount", mountPoint, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
testutil/mount_linux.go
Normal file
5
testutil/mount_linux.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package testutil
|
||||||
|
|
||||||
|
import "golang.org/x/sys/unix"
|
||||||
|
|
||||||
|
const umountflags int = unix.MNT_DETACH
|
5
testutil/mount_other.go
Normal file
5
testutil/mount_other.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// +build !linux
|
||||||
|
|
||||||
|
package testutil
|
||||||
|
|
||||||
|
const umountflags int = 0
|
Loading…
Reference in New Issue
Block a user