diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-21 19:59:28 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-21 19:59:28 +0200 |
| commit | 5824a1959b27643575c5b1335f211687566b8449 (patch) | |
| tree | 480ae8244efc014aa51e151a9dfb1ee59b0ee8db /integrationtests | |
| parent | 5234ae813b60b823bc984ca8862f078ed4fe71a6 (diff) | |
Fix integration test harness: symlink BPF object, increase grace period, improve assertions
- Symlink ior.bpf.o into output dir so ior finds it when run from temp dir
- Increase iorShutdownGrace from 3s to 30s for BPF tracepoint unloading
- Skip records with empty comm in AssertNoUnexpectedComm (BPF race condition)
- Add diagnostic logging (up to 5 samples) in both AssertNoUnexpectedComm
and AssertNoUnexpectedPID for easier debugging of test failures
Amp-Thread-ID: https://ampcode.com/threads/T-019c814e-d6b6-72fb-aaf0-c49f5b3fd04e
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/expectations.go | 14 | ||||
| -rw-r--r-- | integrationtests/harness.go | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/integrationtests/expectations.go b/integrationtests/expectations.go index ed155bc..6a816e6 100644 --- a/integrationtests/expectations.go +++ b/integrationtests/expectations.go @@ -39,13 +39,21 @@ func AssertEventsPresent(t *testing.T, result TestResult, expected []ExpectedEve } // AssertNoUnexpectedComm verifies all records have the expected comm name. -// Fails fast on the first mismatch and reports the total count of unexpected records. +// Records with empty comm are skipped because BPF may capture events before +// the process name is set in the task struct. func AssertNoUnexpectedComm(t *testing.T, result TestResult, expectedComm string) { t.Helper() var count int for _, rec := range result.Records { + if rec.Comm == "" { + continue + } if rec.Comm != expectedComm { count++ + if count <= 5 { + t.Logf("unexpected comm %q (pid=%d tracepoint=%s path=%q)", + rec.Comm, rec.Pid, rec.TraceID.String(), rec.Path) + } } } if count > 0 { @@ -62,6 +70,10 @@ func AssertNoUnexpectedPID(t *testing.T, result TestResult, expectedPID int) { for _, rec := range result.Records { if rec.Pid != pid { count++ + if count <= 5 { + t.Logf("unexpected PID %d (tracepoint=%s path=%q comm=%q)", + rec.Pid, rec.TraceID.String(), rec.Path, rec.Comm) + } } } if count > 0 { diff --git a/integrationtests/harness.go b/integrationtests/harness.go index 315fec4..7edde44 100644 --- a/integrationtests/harness.go +++ b/integrationtests/harness.go @@ -13,7 +13,7 @@ import ( const ( workloadStartupTimeout = 5 * time.Second - iorShutdownGrace = 3 * time.Second + iorShutdownGrace = 30 * time.Second ) // TestHarness orchestrates integration tests by starting an ior trace @@ -109,6 +109,11 @@ func (h *TestHarness) startWorkload(scenario string) (*exec.Cmd, int, error) { } func (h *TestHarness) startIor(pid int, scenario string, duration int) (*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) + } + cmd := exec.Command(h.IorBinary, "-pid", strconv.Itoa(pid), "-flamegraph", |
