-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from yonch:main
add timestamp-sorted perf ring reader
- Loading branch information
Showing
26 changed files
with
2,056 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Test Go Packages | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'pkg/**/*.go' | ||
- 'go.mod' | ||
- 'go.sum' | ||
- '.github/workflows/test-go-packages.yaml' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'pkg/**/*.go' | ||
- 'go.mod' | ||
- 'go.sum' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Run Go Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
check-latest: true | ||
cache: true | ||
|
||
- name: Install dependencies | ||
run: go mod download | ||
|
||
- name: Install libcap | ||
run: sudo apt-get update && sudo apt-get install -y libcap2-bin | ||
|
||
- name: Run perf-related package tests | ||
run: | | ||
# Compile the test binaries for perf and perf_ebpf packages | ||
go test -c ./pkg/perf ./pkg/perf_ebpf -race -o . | ||
# Add CAP_PERFMON capability to the test binary | ||
sudo setcap cap_perfmon+ep perf.test | ||
sudo setcap cap_perfmon,cap_bpf+ep perf_ebpf.test | ||
# Verify capability | ||
getcap perf.test | ||
getcap perf_ebpf.test | ||
# Check if perf_event_paranoid is restricting access | ||
cat /proc/sys/kernel/perf_event_paranoid | ||
# Set perf_event_paranoid to 1 | ||
echo 1 | sudo tee /proc/sys/kernel/perf_event_paranoid | ||
# Verify perf_event_paranoid | ||
cat /proc/sys/kernel/perf_event_paranoid | ||
# Run the perf tests with the permissioned binary | ||
./perf.test -test.v | ||
./perf_ebpf.test -test.v | ||
- name: Run other package tests | ||
run: | | ||
# Run tests for all packages except perf and perf_ebpf | ||
if [ -n "$(go list ./pkg/... | grep -v 'pkg/perf\|pkg/perf_ebpf')" ]; then | ||
go test -v -race $(go list ./pkg/... | grep -v 'pkg/perf\|pkg/perf_ebpf') | ||
fi | ||
- name: Run linter | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: latest | ||
args: --timeout=5m | ||
working-directory: pkg/ | ||
|
||
- name: Check formatting | ||
run: | | ||
# Check if any .go files are not properly formatted | ||
if [ -n "$(gofmt -l ./pkg)" ]; then | ||
echo "The following files are not properly formatted:" | ||
gofmt -l ./pkg | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.