summaryrefslogtreecommitdiff
path: root/integrationtests/harness.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-12 22:39:06 +0200
committerPaul Buetow <paul@buetow.org>2026-03-12 22:39:06 +0200
commit13e7970afb3eeac69f82df833f030711e5cf12ec (patch)
tree098c4fb8c5a8c8f27547f03f40c9fee0be63fe35 /integrationtests/harness.go
parent1b21e818a69bf73fde3ca60f89d2dc82a79fd605 (diff)
internal: embed BPF object into ior binary
Diffstat (limited to 'integrationtests/harness.go')
-rw-r--r--integrationtests/harness.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/integrationtests/harness.go b/integrationtests/harness.go
index 17ae994..e3ee900 100644
--- a/integrationtests/harness.go
+++ b/integrationtests/harness.go
@@ -15,6 +15,7 @@ import (
const (
workloadStartupTimeout = 5 * time.Second
iorShutdownGrace = 30 * time.Second
+ bpfObjectOverrideEnv = "IOR_BPF_OBJECT"
)
// TestHarness orchestrates integration tests by starting an ior trace
@@ -22,7 +23,7 @@ const (
type TestHarness struct {
IorBinary string // path to built ior binary
WorkloadBinary string // path to built ioworkload binary
- BpfObject string // path to ior.bpf.o
+ BpfObject string // optional path to external BPF object override
OutputDir string // temp dir for .ior.zst output
}
@@ -120,11 +121,6 @@ func (h *TestHarness) startWorkload(scenario string) (*exec.Cmd, int, error) {
}
func (h *TestHarness) startIor(pid int, scenario string, duration int, extraArgs []string) (*exec.Cmd, error) {
- bpfLink := filepath.Join(h.OutputDir, "ior.bpf.o")
- if err := os.Symlink(h.BpfObject, bpfLink); err != nil {
- return nil, fmt.Errorf("symlink bpf object: %w", err)
- }
-
args := []string{
"-pid", strconv.Itoa(pid),
"-flamegraph",
@@ -136,6 +132,9 @@ func (h *TestHarness) startIor(pid int, scenario string, duration int, extraArgs
cmd.Dir = h.OutputDir
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
+ if h.BpfObject != "" {
+ cmd.Env = append(os.Environ(), bpfObjectOverrideEnv+"="+h.BpfObject)
+ }
if err := cmd.Start(); err != nil {
return nil, fmt.Errorf("start ior: %w", err)