summaryrefslogtreecommitdiff
path: root/integrationtests/cmd/ioworkload/main.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-21 16:13:40 +0200
committerPaul Buetow <paul@buetow.org>2026-02-21 16:13:40 +0200
commit2c2cbe07f5e10fdb996e2a039cde84be44866f18 (patch)
tree97654c2c9ba9fc91cb569ab0521c4c67247abc0b /integrationtests/cmd/ioworkload/main.go
parenteebc9cba272c1b20296ab998262298c5da99e047 (diff)
Add integration test framework: plan, workload binary, harness scaffolding
- INTEGRATIONTESTS-PLAN.md: full design for e2e integration tests - integrationtests/cmd/ioworkload: standalone binary with 13 I/O scenarios - integrationtests/expectations.go: ExpectedEvent type and assertion helpers - integrationtests/parse.go: .ior.zst parser producing TestResult - Export IterRecord and LoadFromFile in flamegraph package - Fix TraceId -> TraceID, StringByName returns error instead of panic Amp-Thread-ID: https://ampcode.com/threads/T-019c8031-c106-757a-95a0-7a5457163ce7 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'integrationtests/cmd/ioworkload/main.go')
-rw-r--r--integrationtests/cmd/ioworkload/main.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/integrationtests/cmd/ioworkload/main.go b/integrationtests/cmd/ioworkload/main.go
new file mode 100644
index 0000000..3ed9cb2
--- /dev/null
+++ b/integrationtests/cmd/ioworkload/main.go
@@ -0,0 +1,46 @@
+// ioworkload is a standalone binary that performs deterministic I/O operations
+// for integration testing of ior. It prints its PID to stdout, sleeps to allow
+// ior to attach BPF tracepoints, then executes the requested I/O scenario.
+package main
+
+import (
+ "flag"
+ "fmt"
+ "os"
+ "slices"
+ "time"
+)
+
+const startupDelay = 2 * time.Second
+
+func main() {
+ scenario := flag.String("scenario", "", "I/O scenario to execute")
+ flag.Parse()
+
+ if *scenario == "" {
+ fmt.Fprintln(os.Stderr, "usage: ioworkload --scenario=<name>")
+ os.Exit(2)
+ }
+
+ run, ok := scenarios[*scenario]
+ if !ok {
+ fmt.Fprintf(os.Stderr, "unknown scenario: %s\navailable scenarios:\n", *scenario)
+ var names []string
+ for name := range scenarios {
+ names = append(names, name)
+ }
+ slices.Sort(names)
+ for _, name := range names {
+ fmt.Fprintf(os.Stderr, " %s\n", name)
+ }
+ os.Exit(2)
+ }
+
+ fmt.Println(os.Getpid())
+ time.Sleep(startupDelay)
+
+ if err := run(); err != nil {
+ fmt.Fprintf(os.Stderr, "scenario %s failed: %v\n", *scenario, err)
+ os.Exit(1)
+ }
+}