(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestRoot(t *testing.T) { |
| 172 | for _, tt := range []struct { |
| 173 | process int |
| 174 | want string |
| 175 | brokenLink bool |
| 176 | }{ |
| 177 | {process: 26231, want: "/"}, |
| 178 | {process: 26232, want: "/does/not/exist", brokenLink: true}, |
| 179 | {process: 26233, want: ""}, |
| 180 | } { |
| 181 | p, err := getProcFixtures(t).Proc(tt.process) |
| 182 | if err != nil { |
| 183 | t.Fatal(err) |
| 184 | } |
| 185 | rdir, err := p.RootDir() |
| 186 | if err != nil { |
| 187 | t.Fatal(err) |
| 188 | } |
| 189 | if diff := cmp.Diff(tt.want, rdir); diff != "" { |
| 190 | if rdir == "" && tt.brokenLink { |
| 191 | // Allow the result to be empty when can't os.Readlink broken links |
| 192 | continue |
| 193 | } |
| 194 | t.Fatalf("unexpected absolute path to rootdir (-want +got):\n%s", diff) |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | func TestFileDescriptors(t *testing.T) { |
| 200 | p1, err := getProcFixtures(t).Proc(26231) |
nothing calls this directly
no test coverage detected