(output []byte)
| 495 | } |
| 496 | |
| 497 | func buildLabelMapFromOutput(output []byte) (map[string]string, error) { |
| 498 | labels := make(map[string]string) |
| 499 | |
| 500 | lines := strings.Split(strings.TrimRight(string(output), "\n"), "\n") |
| 501 | for _, line := range lines { |
| 502 | split := strings.Split(line, "=") |
| 503 | if len(split) != 2 { |
| 504 | return nil, fmt.Errorf("unexpected format in line: '%v'", line) |
| 505 | } |
| 506 | key := split[0] |
| 507 | value := split[1] |
| 508 | |
| 509 | if v, ok := labels[key]; ok { |
| 510 | return nil, fmt.Errorf("duplicate label '%v': %v (overwrites %v)", key, v, value) |
| 511 | } |
| 512 | labels[key] = value |
| 513 | } |
| 514 | |
| 515 | return labels, nil |
| 516 | } |
| 517 | |
| 518 | func checkResult(result []byte, expectedOutputPath string, isVGPU bool) error { |
| 519 | expected, err := os.ReadFile(expectedOutputPath) |
no test coverage detected