Skip to content

Commit

Permalink
Helpers in its own mod followup (#255)
Browse files Browse the repository at this point in the history
* Update usage in selftests

* Update helpers dependencies to version of libbpfgo that knows about new helpers module

* Clean top level go.sum

* fix rwarray unit tests

* Add go.work file

Signed-off-by: grantseltzer <[email protected]>
  • Loading branch information
grantseltzer authored Oct 5, 2022
1 parent b398b6e commit 9eb6002
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
go-version: "1.18"
- name: Install Compilers & Formatters
run: |
sudo apt-get update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
Expand All @@ -19,7 +19,7 @@ jobs:
make helpers-test-static-run
self-tests:
name: Selftests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion builder/prepare-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# variables

[ -z "${GO_VERSION}" ] && GO_VERSION="1.17"
[ -z "${GO_VERSION}" ] && GO_VERSION="1.18"
[ -z "${CLANG_VERSION}" ] && CLANG_VERSION="12"
[ -z "${ARCH}" ] && ARCH="amd64"

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/aquasecurity/libbpfgo

go 1.19
go 1.18
Empty file removed go.sum
Empty file.
6 changes: 6 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.18

use (
.
./helpers
)
14 changes: 13 additions & 1 deletion helpers/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
module github.com/aquasecurity/libbpfgo/helpers

go 1.19
go 1.18

require (
github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f
github.com/stretchr/testify v1.8.0
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
19 changes: 19 additions & 0 deletions helpers/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f h1:8vfY/LaTk096KJ6pi6IdOzIIjZxQqP/jhH4CtZ4rM7I=
github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f/go.mod h1:BUFy1KtlXJD5rWElGW+jOl3FD167uDx9+02zIuH2v1A=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10 changes: 5 additions & 5 deletions rwArray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestRWArrayWrite(t *testing.T) {
t.Fatalf("slot1 (%v) < slot2 (%v)", slot1, slot2)
}

a.Remove(uint(slot2))
a.remove(uint(slot2))

last = slot2
}
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestRWArrayRead(t *testing.T) {
}

for i := 0; i < 1000; i++ {
v := a.Get(uint(i)).(*int)
v := a.get(uint(i)).(*int)
if *v != i {
t.Errorf("Get returned wrong valuue; expected=%v, got=%v", i, *v)
}
Expand All @@ -92,7 +92,7 @@ func TestRWArrayConcurrent(t *testing.T) {
a.put(&v)
}
for i := uint(1); i < capacity; i += 2 {
a.Remove(i)
a.remove(i)
}

writer := func() {
Expand All @@ -104,7 +104,7 @@ func TestRWArrayConcurrent(t *testing.T) {

// make some holes
for i := uint(1); i < capacity; i += 2 {
a.Remove(i)
a.remove(i)
}

// time to exit?
Expand All @@ -119,7 +119,7 @@ func TestRWArrayConcurrent(t *testing.T) {
reader := func() {
for rounds := 0; rounds < 10; rounds++ {
for i := uint(0); i < capacity; i += 2 {
a.Get(i)
a.get(i)
}
}

Expand Down
12 changes: 7 additions & 5 deletions selftest/tracing/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module github.com/aquasecurity/libbpfgo/selftest/perfbuffers
module github.com/aquasecurity/libbpfgo/selftest/tracing

go 1.18

require github.com/aquasecurity/libbpfgo v0.2.1-libbpf-0.4.0

require (
github.com/aquasecurity/libbpfgo/helpers v0.0.0-20220919184217-8ef1425cccdf // indirect
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f
github.com/aquasecurity/libbpfgo/helpers v0.0.0-20221004153638-7139cb41036f
)

require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect

replace github.com/aquasecurity/libbpfgo => ../../

replace github.com/aquasecurity/libbpfgo/helpers => ../../helpers
18 changes: 5 additions & 13 deletions selftest/tracing/go.sum
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/aquasecurity/libbpfgo/helpers v0.0.0-20220919184217-8ef1425cccdf h1:HNzXWDHFjYZ8jP6vCHW1R8NLblm7vKIM3Y0y+r4OX9E=
github.com/aquasecurity/libbpfgo/helpers v0.0.0-20220919184217-8ef1425cccdf/go.mod h1:oCaNN2RsEVEErc1PyvJn1ttVoxAKAGRKPrHY9n3QqS0=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
9 changes: 7 additions & 2 deletions selftest/uprobe/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ module github.com/aquasecurity/libbpfgo/selftest/uprobe

go 1.18

require github.com/aquasecurity/libbpfgo v0.2.1-libbpf-0.4.0
require (
github.com/aquasecurity/libbpfgo v0.4.0-libbpf-1.0.0.0.20221004153638-7139cb41036f
github.com/aquasecurity/libbpfgo/helpers v0.0.0-20221004153638-7139cb41036f
)

require golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
require golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect

replace github.com/aquasecurity/libbpfgo => ../../

replace github.com/aquasecurity/libbpfgo/helpers => ../../helpers
16 changes: 5 additions & 11 deletions selftest/uprobe/go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 comments on commit 9eb6002

Please sign in to comment.