Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(workflows/bpf-test): add BPF test to cover route logic #671

Merged
merged 21 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/bpf-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: BPF Test

on:
pull_request:
paths:
- "**/*.c"
- "**/*.h"
- "go.mod"
- "go.sum"
- ".github/workflows/bpf-test.yml"

permissions: read-all

jobs:
bpf_tests:
name: BPF Unit Test
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
persist-credentials: false
fetch-depth: 0
- name: Run BPF tests
run: |
git submodule update --init
sudo make ebpf-test || (echo "Run 'make ebpf-test' locally to investigate failures"; exit 1)

16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ clean-ebpf:
rm -f control/bpf_bpf*.o
@rm -f trace/bpf_bpf*.go && \
rm -f trace/bpf_bpf*.o
@rm -f control/kern/tests/bpftest_bpf*.go && \
rm -f control/kern/tests/bpftest_bpf*.o
fmt:
go fmt ./...

Expand All @@ -99,4 +101,18 @@ ebpf: submodule clean-ebpf
ebpf-lint:
./scripts/checkpatch.pl --no-tree --strict --no-summary --show-types --color=always control/kern/tproxy.c --ignore COMMIT_COMMENT_SYMBOL,NOT_UNIFIED_DIFF,COMMIT_LOG_LONG_LINE,LONG_LINE_COMMENT,VOLATILE,ASSIGN_IN_IF,PREFER_DEFINED_ATTRIBUTE_MACRO,CAMELCASE,LEADING_SPACE,OPEN_ENDED_LINE,SPACING,BLOCK_COMMENT_STYLE

ebpf-test: export BPF_CLANG := $(CLANG)
ebpf-test: export BPF_STRIP_FLAG := $(STRIP_FLAG)
ebpf-test: export BPF_CFLAGS := $(CFLAGS)
ebpf-test: export BPF_TARGET := $(TARGET)
ebpf-test: export BPF_TRACE_TARGET := $(GOARCH)
ebpf-test: submodule clean-ebpf
@unset GOOS && \
unset GOARCH && \
unset GOARM && \
echo $(STRIP_FLAG) && \
go generate ./control/kern/tests/bpf_test.go && \
go clean -testcache && \
go test -v ./control/kern/tests/...

## End Ebpf
Loading
Loading