github.com/opencontainers/runc@v1.2.0-rc.1.0.20240520010911-492dc558cdd6/libcontainer/cgroups/cgroups_test.go (about) 1 package cgroups 2 3 import ( 4 "testing" 5 ) 6 7 func TestParseCgroups(t *testing.T) { 8 // We don't need to use /proc/thread-self here because runc always runs 9 // with every thread in the same cgroup. This lets us avoid having to do 10 // runtime.LockOSThread. 11 cgroups, err := ParseCgroupFile("/proc/self/cgroup") 12 if err != nil { 13 t.Fatal(err) 14 } 15 if IsCgroup2UnifiedMode() { 16 return 17 } 18 if _, ok := cgroups["cpu"]; !ok { 19 t.Fail() 20 } 21 }