-
-
Notifications
You must be signed in to change notification settings - Fork 84
83 lines (80 loc) · 3.06 KB
/
test-examples.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Build and run all integrated tests (examples)
on:
push:
branches: "*"
pull_request:
branches: "*"
jobs:
build-and-test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
examples:
- path: libbpf-tools/opensnoop
executable: opensnoop
victim: ./victim
syscall_trace: true
- path: libbpf-tools/statsnoop
executable: statsnoop
victim: ./victim
syscall_trace: true
- path: malloc
executable: malloc
victim: ./victim
syscall_trace: false
- path: opensnoop
executable: opensnoop
victim: ./victim
syscall_trace: false
- path: sslsniff
executable: sslsniff
victim: /bin/wget https://www.google.com
syscall_trace: false
- path: libbpf-tools/bashreadline
executable: readline
victim: /bin/bash
syscall_trace: false
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install dependencies
run: |
sudo apt-get install binutils-dev libboost1.74-all-dev libelf-dev zlib1g-dev libyaml-cpp-dev gcc-12 g++-12 llvm
- name: Build and install runtime
run: |
CC=gcc-12 CXX=g++-12 make release -j
- name: Build and install CLI
run: |
cd tools/cli-rs
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-gnu
mkdir -p ~/.bpftime
cp ./target/x86_64-unknown-linux-gnu/release/bpftime ~/.bpftime
- name: Build test assets
run: |
make -C example/${{matrix.examples.path}} -j
- name: Test CLI - show help
run: |
export PATH=$PATH:~/.bpftime
bpftime --help
- name: Test CLI - attach by running (syscall_trace)
if: matrix.examples.syscall_trace
shell: "sudo /bin/bash -e {0}"
run: |
cd example/${{matrix.examples.path}}
timeout -s 2 30s sudo -E /home/runner/.bpftime/bpftime -i /home/runner/.bpftime load ./${{matrix.examples.executable}} || if [ $? = 124 ]; then exit 0; else exit $?; fi &
sleep 3s
ID1=$!
timeout -s 2 15s /home/runner/.bpftime/bpftime -i /home/runner/.bpftime start -s ${{matrix.examples.victim}} || if [ $? = 124 ]; then exit 0; else exit $?; fi
fg $ID1 || true
- name: Test CLI - attach by running (uprobe)
if: '!matrix.examples.syscall_trace'
shell: "sudo /bin/bash -e {0}"
run: |
cd example/${{matrix.examples.path}}
timeout -s 2 30s sudo -E /home/runner/.bpftime/bpftime -i /home/runner/.bpftime load ./${{matrix.examples.executable}} || if [ $? = 124 ]; then exit 0; else exit $?; fi &
sleep 3s
ID1=$!
timeout -s 2 15s /home/runner/.bpftime/bpftime -i /home/runner/.bpftime start ${{matrix.examples.victim}} || if [ $? = 124 ]; then exit 0; else exit $?; fi
fg $ID1 || true