summaryrefslogtreecommitdiff
path: root/integrationtests/parse.go
blob: cebb0ba32fffc6dce9c9c86255f5d513d609a276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package integrationtests

import (
	"fmt"
	"ior/internal/flamegraph"
)

// TestResult holds all captured I/O records from a single ior run.
type TestResult struct {
	Records []flamegraph.IterRecord
}

// LoadTestResult parses an .ior.zst file into a TestResult.
func LoadTestResult(iorZstFile string) (TestResult, error) {
	iter, err := flamegraph.LoadFromFile(iorZstFile)
	if err != nil {
		return TestResult{}, fmt.Errorf("load test result: %w", err)
	}

	var result TestResult
	for record := range iter {
		result.Records = append(result.Records, record)
	}
	return result, nil
}