mirror of
https://github.com/rclone/rclone.git
synced 2024-11-21 16:03:29 +01:00
nfsmount: allow tests to run on any unix where sudo mount/umount works
This commit is contained in:
parent
62b76b631c
commit
13ea77dd71
@ -1,14 +1,32 @@
|
||||
//go:build darwin && !cmount
|
||||
//go:build unix
|
||||
|
||||
package nfsmount
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/rclone/rclone/vfs/vfscommon"
|
||||
"github.com/rclone/rclone/vfs/vfstest"
|
||||
)
|
||||
|
||||
// Return true if the command ran without error
|
||||
func commandOK(name string, arg ...string) bool {
|
||||
cmd := exec.Command(name, arg...)
|
||||
_, err := cmd.CombinedOutput()
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func TestMount(t *testing.T) {
|
||||
if runtime.GOOS != "darwin" {
|
||||
if !commandOK("sudo", "-n", "mount", "--help") {
|
||||
t.Skip("Can't run sudo mount without a password")
|
||||
}
|
||||
if !commandOK("sudo", "-n", "umount", "--help") {
|
||||
t.Skip("Can't run sudo umount without a password")
|
||||
}
|
||||
sudo = true
|
||||
}
|
||||
vfstest.RunTests(t, false, vfscommon.CacheModeMinimal, false, mount)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user