mirror of
https://github.com/docker/cli.git
synced 2026-01-18 08:21:31 +03:00
Signed-off-by: David Calavera <david.calavera@gmail.com> Upstream-commit: a9141012966db62b36b7d3d1df7af877bbd2d172 Component: engine
40 lines
851 B
Go
40 lines
851 B
Go
// +build !windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"path"
|
|
|
|
"github.com/docker/libcontainer/cgroups"
|
|
)
|
|
|
|
var (
|
|
CpuCfsPeriod = TestRequirement{
|
|
func() bool {
|
|
cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if _, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_period_us")); err != nil {
|
|
return false
|
|
}
|
|
return true
|
|
},
|
|
"Test requires an environment that supports cgroup cfs period.",
|
|
}
|
|
CpuCfsQuota = TestRequirement{
|
|
func() bool {
|
|
cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if _, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us")); err != nil {
|
|
return false
|
|
}
|
|
return true
|
|
},
|
|
"Test requires an environment that supports cgroup cfs quota.",
|
|
}
|
|
)
|