mirror of
https://github.com/eunomia-bpf/bpf-developer-tutorial.git
synced 2026-04-09 21:59:35 +08:00
Add CI for libbpf base examples and kprobe (#45)
* add ci for profile * fix unnecessary code in 7 * fix exit code 124 * fix llvm-strip * fix trailing space
This commit is contained in:
38
.github/workflows/test-eunomia.yaml
vendored
Normal file
38
.github/workflows/test-eunomia.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Test eunomia-bpf example CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 0'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: 'recursive'
|
||||||
|
- name: install deps
|
||||||
|
run: sudo apt install clang llvm-14-dev llvm
|
||||||
|
- name: install ecc and ecli
|
||||||
|
run: |
|
||||||
|
wget https://github.com/eunomia-bpf/eunomia-bpf/releases/latest/download/ecc && chmod +x ./ecc
|
||||||
|
wget https://aka.pw/bpf-ecli -O ecli && chmod +x ./ecli
|
||||||
|
- name: test 1 hello world
|
||||||
|
run: |
|
||||||
|
./ecc src/1-helloworld/minimal.bpf.c
|
||||||
|
sudo timeout -s 2 3 ./ecli run src/1-helloworld/package.json || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
||||||
|
- name: test 2 kprobe
|
||||||
|
run: |
|
||||||
|
./ecc src/2-kprobe-unlink/kprobe-link.bpf.c
|
||||||
|
sudo timeout -s 2 3 ./ecli run src/2-kprobe-unlink/package.json || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
||||||
|
- name: test 3 fentry
|
||||||
|
run: |
|
||||||
|
./ecc src/2-kprobe-unlink/kprobe-link.bpf.c
|
||||||
|
sudo timeout -s 2 3 ./ecli run src/2-kprobe-unlink/package.json || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
||||||
|
- name: test 7 execsnoop
|
||||||
|
run: |
|
||||||
|
./ecc src/7-execsnoop/execsnoop.bpf.c src/7-execsnoop/execsnoop.h
|
||||||
|
sudo timeout -s 2 3 ./ecli run src/7-execsnoop/package.json || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Test example CI
|
name: Test eunomia-bpf example CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -14,16 +14,16 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: 'recursive'
|
submodules: 'recursive'
|
||||||
- name: install deps
|
|
||||||
run: sudo apt install clang llvm
|
|
||||||
- name: test hello world
|
|
||||||
run: |
|
|
||||||
wget https://github.com/eunomia-bpf/eunomia-bpf/releases/latest/download/ecc && chmod +x ./ecc
|
|
||||||
wget https://aka.pw/bpf-ecli -O ecli && chmod +x ./ecli
|
|
||||||
./ecc src/1-helloworld/minimal.bpf.c
|
|
||||||
sudo timeout -s 2 3 ./ecli run src/1-helloworld/package.json || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
|
||||||
- name: install deps
|
- name: install deps
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -y --no-install-recommends \
|
sudo apt-get install -y --no-install-recommends \
|
||||||
libelf1 libelf-dev zlib1g-dev libclang-13-dev \
|
libelf1 libelf-dev zlib1g-dev libclang-13-dev \
|
||||||
make git clang llvm pkg-config build-essential
|
make git clang llvm pkg-config build-essential
|
||||||
|
- name: test 11 bootstrap
|
||||||
|
run: |
|
||||||
|
make -C src/11-bootstrap
|
||||||
|
sudo timeout -s 2 3 src/11-bootstrap/bootstrap || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
||||||
|
- name: test 12 profile
|
||||||
|
run: |
|
||||||
|
make -C src/12-profile
|
||||||
|
# sudo timeout -s 2 3 src/12-profile/profile || if [ $? = 124 ]; then exit 0; else exit $?; fi
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -64,3 +64,6 @@ src/12-profile/profile
|
|||||||
/sockfilter
|
/sockfilter
|
||||||
/tc
|
/tc
|
||||||
/ksyscall
|
/ksyscall
|
||||||
|
|
||||||
|
ecc
|
||||||
|
ecli
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ int tracepoint__syscalls__sys_enter_execve(struct trace_event_raw_sys_enter* ctx
|
|||||||
|
|
||||||
uid_t uid = (u32)bpf_get_current_uid_gid();
|
uid_t uid = (u32)bpf_get_current_uid_gid();
|
||||||
id = bpf_get_current_pid_tgid();
|
id = bpf_get_current_pid_tgid();
|
||||||
pid = (pid_t)id;
|
|
||||||
tgid = id >> 32;
|
tgid = id >> 32;
|
||||||
|
|
||||||
event.pid = tgid;
|
event.pid = tgid;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ int tracepoint__syscalls__sys_enter_execve(struct trace_event_raw_sys_enter* ctx
|
|||||||
|
|
||||||
uid_t uid = (u32)bpf_get_current_uid_gid();
|
uid_t uid = (u32)bpf_get_current_uid_gid();
|
||||||
id = bpf_get_current_pid_tgid();
|
id = bpf_get_current_pid_tgid();
|
||||||
pid = (pid_t)id;
|
|
||||||
tgid = id >> 32;
|
tgid = id >> 32;
|
||||||
|
|
||||||
event.pid = tgid;
|
event.pid = tgid;
|
||||||
|
|||||||
Reference in New Issue
Block a user