...
1
6 package fs
7
8 import (
9 "os"
10 "path/filepath"
11 "testing"
12
13 "github.com/opencontainers/runc/libcontainer/cgroups"
14 )
15
16 func init() {
17 cgroups.TestMode = true
18 }
19
20
21 func tempDir(t *testing.T, subsystem string) string {
22 path := filepath.Join(t.TempDir(), subsystem)
23
24 if err := os.Mkdir(path, 0o755); err != nil {
25 t.Fatal(err)
26 }
27 return path
28 }
29
30
31
32 func writeFileContents(t *testing.T, path string, fileContents map[string]string) {
33 for file, contents := range fileContents {
34 err := cgroups.WriteFile(path, file, contents)
35 if err != nil {
36 t.Fatal(err)
37 }
38 }
39 }
40
View as plain text