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: add CI for runtime tests #338

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3d20f7f
update CI sripts
yunwei37 Aug 21, 2024
753905c
fix compile in github codespace
yunwei37 Aug 21, 2024
c3f6be0
Change headers to <> brackets
hp77-creator Aug 23, 2024
9f65906
Add check for BUILD_WITH_LIBBPF wherever bpf libraries are used
hp77-creator Aug 23, 2024
a0e7fc9
Fix header issue and add guard properly
hp77-creator Aug 24, 2024
40fb57f
Add missing functions
hp77-creator Aug 24, 2024
dac0245
Fix variable and comment other tests
hp77-creator Aug 24, 2024
c18000f
Change syscall function impl
hp77-creator Aug 24, 2024
637c45e
uncomment other workflows
hp77-creator Aug 24, 2024
21a210d
Add libc_handle
hp77-creator Aug 24, 2024
56da42d
Add gnu libnames header
hp77-creator Aug 24, 2024
036f066
Upgrade ubuntu to 24.04
hp77-creator Aug 24, 2024
7202f4b
change arch from amd64 to arm64
hp77-creator Aug 24, 2024
fc0e89e
Fix version back to amd
hp77-creator Aug 24, 2024
cade0ce
Change ubuntu to 22.04
hp77-creator Aug 24, 2024
96e981e
Downgrade version for ubuntu in verifier
hp77-creator Aug 24, 2024
c0c3413
Revert container images
hp77-creator Aug 24, 2024
6624e75
Add linux kernel guards
hp77-creator Aug 24, 2024
4d4bd53
Fix guard
hp77-creator Aug 24, 2024
962508a
remove new syscall variable
hp77-creator Aug 30, 2024
1e5dab7
add xdp-counter example (#339)
yunwei37 Aug 30, 2024
9f6f027
fix: compile on old cmake version and add PATH (#346)
yunwei37 Sep 5, 2024
ddbf20a
Docs: update readme ffor network
yunwei37 Sep 11, 2024
68b6b89
Docs: rewrite Components and Design
yunwei37 Sep 11, 2024
30a993e
docs: add notice (#349)
yunwei37 Sep 21, 2024
4ccf5b3
feat:add lcov and codecov support (#352)
kenlig Sep 28, 2024
af53f97
fix runtime ci
yunwei37 Sep 30, 2024
d3993e1
update readme
yunwei37 Sep 30, 2024
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
22 changes: 22 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:noble"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
60 changes: 56 additions & 4 deletions .github/workflows/test-attach.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,76 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Install dependencies
if: "matrix.container == 'ubuntu-2204'"
run: |
apt-get install -y lcov libzstd-dev libboost-all-dev gpg
- name: Install lcov
if: "matrix.container == 'fedora-39'"
run: |
dnf install -y lcov

- name: Build for frida uprobe attach tests
run: |
cmake -B build
cmake -DTEST_LCOV=ON -B build
cmake --build build --config Debug --target bpftime_frida_uprobe_attach_tests -j$(nproc)

- name: Run frida uprobe attach tests
run: |
./build/attach/frida_uprobe_attach_impl/bpftime_frida_uprobe_attach_tests

- name: Generate frida uprobe attach test coverage (Fedora)
if: "matrix.container == 'fedora-39'"
run: |
lcov --capture --directory . --output-file coverage-uprobe.info
lcov --remove coverage-uprobe.info '/usr/*' --output-file coverage-uprobe.info
lcov --list coverage-uprobe.info
- name: Generate frida uprobe attach test coverage (Ubuntu)
if: "matrix.container == 'ubuntu-2204'"
run: |
lcov --capture --directory . --output-file coverage-uprobe.info --gcov-tool $(which gcov-12)
lcov --remove coverage-uprobe.info '/usr/*' --output-file coverage-uprobe.info
lcov --list coverage-uprobe.info
- name: Upload uprobe coverage
uses: actions/upload-artifact@v4
with:
name: coverage-uprobe-${{matrix.container}}
include-hidden-files: false
path: |
./coverage-uprobe.info
- name: Remove the build
run: rm -rf build

- name: Build syscall trace uprobe attach tests
run: |
cmake -B build
cmake -DTEST_LCOV=ON -B build
cmake --build build --config Debug --target bpftime_syscall_trace_attach_tests -j$(nproc)

- name: Run syscall trace uprobe attach tests
run: |
./build/attach/syscall_trace_attach_impl/bpftime_syscall_trace_attach_tests
- name: Generate syscall trace uprobe attach coverage (Ubuntu)
if: "matrix.container == 'ubuntu-2204'"
run: |
lcov --capture --directory . --output-file coverage-syscall-trace.info --gcov-tool $(which gcov-12)
lcov --remove coverage-syscall-trace.info '/usr/*' --output-file coverage-syscall-trace.info
lcov --list coverage-syscall-trace.info
- name: Generate syscall trace uprobe attach coverage (Fedora)
if: "matrix.container == 'fedora-39'"
run: |
lcov --capture --directory . --output-file coverage-syscall-trace.info
lcov --remove coverage-syscall-trace.info '/usr/*' --output-file coverage-syscall-trace.info
lcov --list coverage-syscall-trace.info
- name: Upload uprobe coverage
uses: actions/upload-artifact@v4
with:
name: coverage-syscall-trace-${{matrix.container}}
include-hidden-files: false
path: |
./coverage-syscall-trace.info
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # optional (default = false)
files: ./coverage-syscall-trace.info, ./coverage-uprobe.info # optional
flags: attach tests (uprobe & syscall trace)
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
15 changes: 10 additions & 5 deletions .github/workflows/test-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,31 @@ jobs:
-DBUILD_BPFTIME_DAEMON=1 \
-DCMAKE_CXX_FLAGS="-DDEFAULT_LOGGER_OUTPUT_PATH='\"console\"'"
cmake --build build --config RelWithDebInfo --target install -j
- name: Build basic examples
run: |
make -C example -j
- name: Upload build results (without jit)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{!matrix.enable_jit}}
with:
name: runtime-package-no-jit-${{matrix.container.name}}
include-hidden-files: true
path: |
~/.bpftime
- name: Upload build results (with jit)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{matrix.enable_jit}}
with:
name: runtime-package-jit-${{matrix.container.name}}
include-hidden-files: true
path: |
~/.bpftime
build-and-test:
runs-on: ubuntu-22.04
needs: [build-runtime]
container:
image: "manjusakalza/bpftime-base-image:${{matrix.container.image}}"
options: " ${{matrix.privilege_options.options}}"
options: --privileged -v /sys/kernel/debug/:/sys/kernel/debug:rw -v /sys/kernel/tracing:/sys/kernel/tracing:rw
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -159,13 +164,13 @@ jobs:
steps:
- name: Download prebuilt runtime (with jit)
if: ${{matrix.enable_jit}}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: runtime-package-jit-${{matrix.container.name}}
path: ~/.bpftime
- name: Download prebuilt runtime (without jit)
if: ${{!matrix.enable_jit}}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: runtime-package-no-jit-${{matrix.container.name}}
path: ~/.bpftime
Expand Down
86 changes: 84 additions & 2 deletions .github/workflows/test-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,101 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install lcov
if: "matrix.container == 'ubuntu-2204'"
run: |
apt-get install -y lcov libzstd-dev libboost-all-dev
- name: Install lcov
if: "matrix.container == 'fedora-39'"
run: |
dnf install -y lcov

- name: Build
run: |
cmake -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Debug -B build
cmake -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Debug -B build
cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc)
- name: Test Runtime
run: ./build/runtime/unit-test/bpftime_runtime_tests
- name: Generate runtime coverage (Ubuntu)
if: "matrix.container == 'ubuntu-2204'"
run: |
lcov --capture --directory . --output-file coverage-runtime.info --gcov-tool $(which gcov-12)
lcov --remove coverage-runtime.info '/usr/*' --output-file coverage-runtime.info
lcov --list coverage-runtime.info
- name: Generate runtime coverage (Fedora)
if: "matrix.container == 'fedora-39'"
run: |
lcov --capture --directory . --output-file coverage-runtime.info
lcov --remove coverage-runtime.info '/usr/*' --output-file coverage-runtime.info
lcov --list coverage-runtime.info
- name: Generate runtime coverage
run: |
lcov --capture --directory . --output-file coverage-runtime.info --gcov-tool $(which gcov-12)
lcov --remove coverage-runtime.info '/usr/*' --output-file coverage-runtime.info
lcov --list coverage-runtime.info
- name: Upload runtime coverage
uses: actions/upload-artifact@v4
with:
name: coverage-runtime-${{matrix.container}}
include-hidden-files: false
path: |
./coverage-runtime.info


- name: build runtime with mpk enable
run: |
rm -rf build
cmake -Bbuild -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_ENABLE_MPK=YES -DCMAKE_BUILD_TYPE=Debug
cmake -Bbuild -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_ENABLE_MPK=YES -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc)

- name: test runtime with mpk
run: ./build/runtime/unit-test/bpftime_runtime_tests

- name: build runtime with ubpf and verifier enable
run: |
rm -rf build
cmake -Bbuild -DBPFTIME_LLVM_JIT=0 -DBPFTIME_ENABLE_UNIT_TESTING=1 -DCMAKE_BUILD_TYPE=Release -DBPFTIME_ENABLE_LTO=1 \
-DBUILD_BPFTIME_DAEMON=1
cmake --build build --config Release

- name: build runtime without libbpf
run: |
rm -rf build
cmake -Bbuild -DBPFTIME_BUILD_WITH_LIBBPF=0
cmake --build build --config Release

- name: build runtime static lib
run: |
rm -rf build
cmake -Bbuild -DBPFTIME_BUILD_STATIC_LIB=1
cmake --build build --config Release
- name: test runtime with mpk
run: ./build/runtime/unit-test/bpftime_runtime_tests
- name: Generate runtime with mpk enable coverage (Ubuntu)
if: "matrix.container == 'ubuntu-2204'"
run: |
lcov --capture --directory . --output-file coverage-runtime-mpk.info --gcov-tool $(which gcov-12)
lcov --remove coverage-runtime-mpk.info '/usr/*' --output-file coverage-runtime-mpk.info
lcov --list coverage-runtime-mpk.info
- name: Generate runtime with mpk enable coverage (Fedora)
if: "matrix.container == 'fedora-39'"
run: |
lcov --capture --directory . --output-file coverage-runtime-mpk.info
lcov --remove coverage-runtime-mpk.info '/usr/*' --output-file coverage-runtime-mpk.info
lcov --list coverage-runtime-mpk.info
- name: Upload runtime-mpk coverage
uses: actions/upload-artifact@v4
with:
name: coverage-runtime-mpk-${{matrix.container}}
include-hidden-files: false
path: |
./coverage-runtime-mpk.info

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # optional (default = false)
files: ./coverage-runtime.info
flags: runtime tests
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)

11 changes: 10 additions & 1 deletion .github/workflows/test-verifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ jobs:
run: |
sudo apt-get update -y
sudo apt-get install binutils-dev libboost1.74-all-dev libelf-dev zlib1g-dev ninja-build libyaml-cpp-dev -y
- name: Install lcov
run: |
sudo apt install -y lcov libzstd-dev
- name: Build test target
run: |
cmake -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_LLVM_JIT=NO -DENABLE_EBPF_VERIFIER=YES -DCMAKE_BUILD_TYPE:STRING=Release -S . -B build -G Ninja
cmake -DTEST_LCOV=ON -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_LLVM_JIT=NO -DENABLE_EBPF_VERIFIER=YES -DCMAKE_BUILD_TYPE:STRING=Release -S . -B build -G Ninja
cmake --build build --config Release --target bpftime_verifier_tests
- name: Run tests
run: |
./build/bpftime-verifier/bpftime_verifier_tests
- name: upload runtime coverage
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info

2 changes: 1 addition & 1 deletion .github/workflows/test-vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- ubuntu-2204
- fedora-39
container:
image: "manjusakalza/bpftime-base-image:${{matrix.container}}"
image: "hp77creator/bpftime-base-image:${{matrix.container}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about getting these images to account eunomia-bpf? Do you have permission to do that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the ghci images, will have to configure i guess, For the time being, I focussed more on making the existing setup pass. We can create an issue to migrate these to eunomia ones. Works @Officeyutong ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#341 addresses this. You can add more requirements on the issue if I am missing something.

options: --privileged
steps:

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

RUN apt-get update && apt-get install -y g++-aarch64-linux-gnu make libyaml-cpp-dev wget pkg-config zlib1g-dev gcc-arm-linux-gnueabi clang llvm-15-dev gcc-12 libelf-dev python3-pytest g++ systemtap-sdt-dev llvm git qemu-user cmake binutils-dev g++-12 gcc-aarch64-linux-gnu libboost1.74-all-dev python3 gcc

Expand Down
Loading
Loading