File: linux_cgroups_relative_devices.go

package info (click to toggle)
golang-github-opencontainers-runtime-tools 0.9.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,108 kB
  • sloc: sh: 557; makefile: 104
file content (28 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main

import (
	"github.com/mndrix/tap-go"
	"github.com/opencontainers/runtime-tools/cgroups"
	"github.com/opencontainers/runtime-tools/validation/util"
)

func main() {
	var major1, minor1, major2, minor2, major3, minor3 int64 = 10, 229, 8, 20, 10, 200

	t := tap.New()
	t.Header(0)
	defer t.AutoPlan()

	g, err := util.GetDefaultGenerator()
	if err != nil {
		util.Fatal(err)
	}
	g.SetLinuxCgroupsPath(cgroups.RelCgroupPath)
	g.AddLinuxResourcesDevice(true, "c", &major1, &minor1, "rwm")
	g.AddLinuxResourcesDevice(true, "b", &major2, &minor2, "rw")
	g.AddLinuxResourcesDevice(true, "b", &major3, &minor3, "r")
	err = util.RuntimeOutsideValidate(g, t, util.ValidateLinuxResourcesDevices)
	if err != nil {
		t.Fail(err.Error())
	}
}