(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func resolveXrayBinary(t *testing.T) string { |
| 59 | t.Helper() |
| 60 | |
| 61 | candidates := []string{} |
| 62 | if envPath := os.Getenv("XRAY_EXECUTABLE_PATH"); envPath != "" { |
| 63 | candidates = append(candidates, envPath) |
| 64 | } |
| 65 | candidates = append(candidates, "/usr/local/bin/xray") |
| 66 | |
| 67 | for _, path := range candidates { |
| 68 | if path == "" { |
| 69 | continue |
| 70 | } |
| 71 | info, err := os.Stat(path) |
| 72 | if err != nil { |
| 73 | continue |
| 74 | } |
| 75 | if info.Mode().IsRegular() && info.Mode().Perm()&0111 != 0 { |
| 76 | return path |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | t.Skip("xray binary not found; set XRAY_EXECUTABLE_PATH to a valid xray executable") |
| 81 | return "" |
| 82 | } |
| 83 | |
| 84 | func startXrayProcess(t *testing.T, exe string) (pid int, waitCh <-chan error) { |
| 85 | t.Helper() |
no outgoing calls
no test coverage detected