(exe string, children []struct {
pid int
waitCh <-chan error
}, t *testing.T)
| 179 | } |
| 180 | |
| 181 | func waitForProcesses(exe string, children []struct { |
| 182 | pid int |
| 183 | waitCh <-chan error |
| 184 | }, t *testing.T) { |
| 185 | t.Helper() |
| 186 | |
| 187 | want := make(map[int]struct{}, len(children)) |
| 188 | for _, c := range children { |
| 189 | want[c.pid] = struct{}{} |
| 190 | } |
| 191 | |
| 192 | for i := 0; i < 20 && len(want) > 0; i++ { |
| 193 | procs, err := findXrayProcesses(exe) |
| 194 | if err != nil { |
| 195 | t.Fatalf("findXrayProcesses returned error: %v", err) |
| 196 | } |
| 197 | for _, p := range procs { |
| 198 | delete(want, p.PID) |
| 199 | } |
| 200 | |
| 201 | if len(want) == 0 { |
| 202 | return |
| 203 | } |
| 204 | time.Sleep(100 * time.Millisecond) |
| 205 | } |
| 206 | |
| 207 | if len(want) > 0 { |
| 208 | t.Fatalf("missing xray PIDs in process list after wait: %v", keys(want)) |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | func TestFindXrayProcessesReturnsEmptyWhenNoMatch(t *testing.T) { |
| 213 | // Use a clearly non-existent executable path; expect empty results, no error. |
no test coverage detected