summaryrefslogtreecommitdiff
path: root/Magefile.go
diff options
context:
space:
mode:
Diffstat (limited to 'Magefile.go')
-rw-r--r--Magefile.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/Magefile.go b/Magefile.go
index 4a49f42..d5c454e 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -38,6 +38,9 @@ const (
typesGoPath = "internal/types/generated_types.go"
typesHeaderPath = "internal/c/types.h"
VMLINUXPath = "internal/c/vmlinux.h"
+ integrationParallel = "INTEGRATION_PARALLEL"
+ integrationParallelN = "8"
+ integrationParallelE = "IOR_INTEGRATION_PARALLEL"
)
// Default builds the project.
@@ -281,6 +284,33 @@ func IntegrationTest() error {
)
}
+// IntegrationTestParallel builds everything and runs integration tests in parallel.
+// Set INTEGRATION_PARALLEL to tune `go test -parallel` (default: 8).
+func IntegrationTestParallel() error {
+ mg.SerialDeps(All)
+ if err := buildWorkloadBinary(); err != nil {
+ return err
+ }
+ fmt.Println("Running integration tests in parallel (requires root)...")
+ env := goEnv()
+ forwardEnv(env, "HOME", "GOPATH", "GOMODCACHE")
+ env[integrationParallelE] = "1"
+
+ parallel := os.Getenv(integrationParallel)
+ if parallel == "" {
+ parallel = integrationParallelN
+ }
+
+ return runGoTestWithProgress(env,
+ "./integrationtests/...",
+ "-failfast",
+ "-timeout=30m",
+ "-count=1",
+ "-parallel", parallel,
+ "-json",
+ )
+}
+
func buildWorkloadBinary() error {
fmt.Println("Building ioworkload binary...")
if err := sh.RunWithV(goEnv(), "go", "build", "-o", workloadBinaryName, workloadSourcePath); err != nil {