Remove testutil.ParseCgroupPaths

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2017-08-21 19:03:58 -04:00
parent 1455086c4b
commit e8bd671815
6 changed files with 20 additions and 47 deletions

View File

@@ -3,6 +3,8 @@ package main
import (
"os/exec"
"strings"
"github.com/docker/docker/pkg/testutil/cmd"
)
@@ -30,3 +32,17 @@ func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
Stdout: execCmd.Stdout,
}
}
// ParseCgroupPaths parses 'procCgroupData', which is output of '/proc/<pid>/cgroup', and returns
// a map which cgroup name as key and path as value.
func ParseCgroupPaths(procCgroupData string) map[string]string {
cgroupPaths := map[string]string{}
for _, line := range strings.Split(procCgroupData, "\n") {
parts := strings.Split(line, ":")
if len(parts) != 3 {
continue
}
cgroupPaths[parts[1]] = parts[2]
}
return cgroupPaths
}