Skip to content

Commit

Permalink
add cgroup hugetlb test for runtime
Browse files Browse the repository at this point in the history
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
  • Loading branch information
Ma Shimiao committed Dec 5, 2017
1 parent 4a57b0f commit 432615a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions validation/linux_cgroups_hugetlb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"

"github.com/opencontainers/runtime-tools/cgroups"
"github.com/opencontainers/runtime-tools/validation/util"
)

func main() {
page := "1GB"
var limit uint64 = 56892210544640
g := util.GetDefaultGenerator()
g.SetLinuxCgroupsPath("/test")
g.AddLinuxResourcesHugepageLimit(page, limit)
err := util.RuntimeOutsideValidate(g, func(path string) error {
cg, err := cgroups.FindCgroup()
if err != nil {
return err
}
lhd, err := cg.GetHugepageLimitData(path)
if err != nil {
return err
}
for _, lhl := range lhd {
if lhl.Pagesize == page && lhl.Limit != limit {
return fmt.Errorf("hugepage %s limit is not set correctly, expect: %d, actual: %d", page, limit, lhl.Limit)
}
}
return nil
})
if err != nil {
util.Fatal(err)
}
}

0 comments on commit 432615a

Please sign in to comment.