summaryrefslogtreecommitdiff
path: root/integrationtests/parse.go
blob: bf4f0bf8cf898fa65e0b75afd32b98d56313ed66 (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
26
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
}