summaryrefslogtreecommitdiff
path: root/Magefile.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 /Magefile.go
parent1b21e818a69bf73fde3ca60f89d2dc82a79fd605 (diff)
internal: embed BPF object into ior binary
Diffstat (limited to 'Magefile.go')
-rw-r--r--Magefile.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/Magefile.go b/Magefile.go
index cc1feeb..36db529 100644
--- a/Magefile.go
+++ b/Magefile.go
@@ -70,19 +70,23 @@ func All() error {
return nil
}
-// BpfBuild builds the BPF object and copies it to the repo root.
+// BpfBuild builds the embedded BPF object used by the Go binary.
func BpfBuild() error {
if err := ensureVMLINUX(); err != nil {
return err
}
- if err := buildBPFObject(); err != nil {
- return err
- }
+ return buildBPFObject()
+}
+
+// BpfExport copies the built BPF object to the repo root for debug workflows.
+func BpfExport() error {
+ mg.Deps(BpfBuild)
return sh.RunV("cp", "-v", bpfObjectPath, bpfOutputPath)
}
// Test runs the full test suite.
func Test() error {
+ mg.Deps(BpfBuild)
if err := sh.RunWithV(goEnv(), "go", "clean", "-testcache"); err != nil {
return err
}
@@ -91,6 +95,7 @@ func Test() error {
// TestRace runs the full test suite with the race detector enabled.
func TestRace() error {
+ mg.Deps(BpfBuild)
if err := sh.RunWithV(goEnv(), "go", "clean", "-testcache"); err != nil {
return err
}
@@ -99,6 +104,7 @@ func TestRace() error {
// TestWithName runs a specific test by name.
func TestWithName() error {
+ mg.Deps(BpfBuild)
if err := sh.RunWithV(goEnv(), "go", "clean", "-testcache"); err != nil {
return err
}
@@ -132,6 +138,7 @@ func TestWithName() error {
// Bench runs benchmarks.
func Bench() error {
+ mg.Deps(BpfBuild)
if err := sh.RunWithV(goEnv(), "go", "test", "./...", "-v", "-bench=.", "-run", "xxx"); err != nil {
return err
}
@@ -150,6 +157,7 @@ func PrReview() error {
// BenchProf runs pipeline benchmarks and writes timestamped pprof artifacts.
func BenchProf() error {
+ mg.Deps(BpfBuild)
if err := ensureBenchProfilesDir(); err != nil {
return err
}
@@ -244,6 +252,7 @@ func BenchFlameCmp() error {
// BenchCompare runs all benchmarks repeatedly and stores output for benchstat.
func BenchCompare() error {
+ mg.Deps(BpfBuild)
if err := ensureBenchProfilesDir(); err != nil {
return err
}