newRootfs creates a new tmp directory and copies the busybox root filesystem to it.
(t testing.TB)
| 97 | // newRootfs creates a new tmp directory and copies the busybox root |
| 98 | // filesystem to it. |
| 99 | func newRootfs(t testing.TB) string { |
| 100 | t.Helper() |
| 101 | dir := t.TempDir() |
| 102 | if err := copyBusybox(dir); err != nil { |
| 103 | t.Fatal(err) |
| 104 | } |
| 105 | |
| 106 | // Make sure others can read+exec, so all tests (inside userns too) can |
| 107 | // read the rootfs. |
| 108 | if err := traversePath(dir); err != nil { |
| 109 | t.Fatalf("Error making newRootfs path traversable by others: %v", err) |
| 110 | } |
| 111 | |
| 112 | return dir |
| 113 | } |
| 114 | |
| 115 | // traversePath gives read+execute permissions to others for all elements in tPath below |
| 116 | // os.TempDir() and errors out if elements above it don't have read+exec permissions for others. |
no test coverage detected
searching dependent graphs…