summaryrefslogtreecommitdiff
path: root/Magefile.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-22 22:31:35 +0200
committerPaul Buetow <paul@buetow.org>2026-02-22 22:31:35 +0200
commit4cd2c4e818a1438bf63d1ca05a6cf134f39bc06b (patch)
tree40b4ad1ab60a6f50973a66c4e273c91e0d8d265b /Magefile.go
parent8e52ba5a8661c717f45e00608ad64f0adc6de3e1 (diff)
Add copy_file_range support and tracepoint attach tests
Diffstat (limited to 'Magefile.go')
-rw-r--r--Magefile.go40
1 files changed, 37 insertions, 3 deletions
diff --git a/Magefile.go b/Magefile.go
index 00d2be7..33db267 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -89,6 +89,20 @@ func TestWithName() error {
if testName == "" {
testName = "TestEventloop"
}
+ isIntegration, err := isIntegrationTest(testName)
+ if err != nil {
+ return err
+ }
+ if isIntegration {
+ mg.SerialDeps(All)
+ if err := buildWorkloadBinary(); err != nil {
+ return err
+ }
+ fmt.Println("Running integration test", testName, "(requires root)...")
+ env := goEnv()
+ forwardEnv(env, "HOME", "GOPATH", "GOMODCACHE", "PATH")
+ return sudoRunWithEnv(env, "go", "test", "./integrationtests/...", "-run", "^"+testName+"$", "-v", "-failfast", "-count=1")
+ }
return sh.RunWithV(goEnv(), "go", "test", "./...", "-run", "^"+testName+"$", "-v", "-failfast")
}
@@ -243,9 +257,8 @@ func World() error {
// IntegrationTest builds everything and runs integration tests with sudo.
func IntegrationTest() error {
mg.SerialDeps(All)
- fmt.Println("Building ioworkload binary...")
- if err := sh.RunV("go", "build", "-o", workloadBinaryName, workloadSourcePath); err != nil {
- return fmt.Errorf("build ioworkload: %w", err)
+ if err := buildWorkloadBinary(); err != nil {
+ return err
}
fmt.Println("Running integration tests (requires root)...")
env := goEnv()
@@ -253,6 +266,14 @@ func IntegrationTest() error {
return sudoRunWithEnv(env, "go", "test", "./integrationtests/...", "-v", "-failfast", "-count=1")
}
+func buildWorkloadBinary() error {
+ fmt.Println("Building ioworkload binary...")
+ if err := sh.RunWithV(goEnv(), "go", "build", "-o", workloadBinaryName, workloadSourcePath); err != nil {
+ return fmt.Errorf("build ioworkload: %w", err)
+ }
+ return nil
+}
+
// Prof generates CPU and memory profiling PDFs.
func Prof() error {
if err := runShellCommand("go tool pprof -pdf ./ior ior.cpuprofile > cpuprofile.pdf"); err != nil {
@@ -512,3 +533,16 @@ func sortLinesWithLocale(lines []string) (string, error) {
}
return string(output), nil
}
+
+func isIntegrationTest(testName string) (bool, error) {
+ out, err := sh.OutputWith(goEnv(), "go", "test", "./integrationtests/...", "-list", ".")
+ if err != nil {
+ return false, fmt.Errorf("list integration tests: %w", err)
+ }
+ for _, line := range strings.Split(out, "\n") {
+ if strings.TrimSpace(line) == testName {
+ return true, nil
+ }
+ }
+ return false, nil
+}