forked from TrueCloudLab/rclone
vfs: make mount tests run on OpenBSD
This commit is contained in:
parent
7dcbebf9bc
commit
a910ec398d
4 changed files with 29 additions and 4 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/rclone/rclone/vfs"
|
||||
"github.com/rclone/rclone/vfs/vfscommon"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -15,7 +16,7 @@ func TestWriteFileNoWrite(t *testing.T) {
|
|||
run.skipIfNoFUSE(t)
|
||||
|
||||
fd, err := osCreate(run.path("testnowrite"))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = fd.Close()
|
||||
assert.NoError(t, err)
|
||||
|
@ -110,6 +111,9 @@ func TestWriteFileDup(t *testing.T) {
|
|||
|
||||
var dupFd uintptr
|
||||
dupFd, err = writeTestDup(fh.Fd())
|
||||
if err == vfs.ENOSYS {
|
||||
t.Skip("dup not supported on this platform")
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
dupFile := os.NewFile(dupFd, fh.Name())
|
||||
|
|
20
vfs/vfstest/write_other.go
Normal file
20
vfs/vfstest/write_other.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
// +build !linux,!darwin,!freebsd,!openbsd,!windows
|
||||
|
||||
package vfstest
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/rclone/rclone/vfs"
|
||||
)
|
||||
|
||||
// TestWriteFileDoubleClose tests double close on write
|
||||
func TestWriteFileDoubleClose(t *testing.T) {
|
||||
t.Skip("not supported on " + runtime.GOOS)
|
||||
}
|
||||
|
||||
// writeTestDup performs the platform-specific implementation of the dup() syscall
|
||||
func writeTestDup(oldfd uintptr) (uintptr, error) {
|
||||
return oldfd, vfs.ENOSYS
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// +build linux darwin freebsd
|
||||
// +build linux darwin freebsd openbsd
|
||||
|
||||
package vfstest
|
||||
|
||||
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/rclone/rclone/vfs/vfscommon"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
|
@ -20,7 +21,7 @@ func TestWriteFileDoubleClose(t *testing.T) {
|
|||
}
|
||||
|
||||
out, err := osCreate(run.path("testdoubleclose"))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
fd := out.Fd()
|
||||
|
||||
fd1, err := unix.Dup(int(fd))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// +build !linux,!darwin,!freebsd
|
||||
// +build windows
|
||||
|
||||
package vfstest
|
||||
|
Loading…
Add table
Reference in a new issue