2015-09-23 00:10:03 +00:00
|
|
|
package testutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"syscall"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ExecCompatible(t *testing.T) {
|
|
|
|
if runtime.GOOS != "windows" && syscall.Geteuid() != 0 {
|
|
|
|
t.Skip("Must be root on non-windows environments to run test")
|
|
|
|
}
|
|
|
|
}
|
2015-09-23 04:56:29 +00:00
|
|
|
|
2015-09-25 23:49:14 +00:00
|
|
|
func QemuCompatible(t *testing.T) {
|
|
|
|
if runtime.GOOS != "windows" && syscall.Geteuid() != 0 {
|
|
|
|
t.Skip("Must be root on non-windows environments to run test")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-29 22:55:23 +00:00
|
|
|
func RktCompatible(t *testing.T) bool {
|
|
|
|
if runtime.GOOS == "windows" || syscall.Geteuid() != 0 {
|
2015-09-29 22:33:25 +00:00
|
|
|
t.Skip("Must be root on non-windows environments to run test")
|
|
|
|
}
|
2015-09-29 22:55:23 +00:00
|
|
|
// else see if rkt exists
|
|
|
|
_, err := exec.Command("rkt", "version").CombinedOutput()
|
|
|
|
return err == nil
|
2015-09-29 22:33:25 +00:00
|
|
|
}
|
|
|
|
|
2015-09-23 04:56:29 +00:00
|
|
|
func MountCompatible(t *testing.T) {
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
t.Skip("Windows does not support mount")
|
|
|
|
}
|
|
|
|
|
|
|
|
if syscall.Geteuid() != 0 {
|
|
|
|
t.Skip("Must be root to run test")
|
|
|
|
}
|
|
|
|
}
|