-
-
Notifications
You must be signed in to change notification settings - Fork 84
164 lines (160 loc) · 5.64 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Build and run all integrated tests (examples)
on:
push:
branches: "*"
pull_request:
branches: "*"
jobs:
build-runtime:
strategy:
matrix:
enable_jit:
- true
- false
runs-on: ubuntu-22.04
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 (with llvm-jit)
if: ${{matrix.enable_jit}}
run: |
CC=gcc-12 CXX=g++-12 make release-with-llvm-jit-without-cli -j
- name: Build and install runtime (without llvm-jit)
if: ${{!matrix.enable_jit}}
run: |
CC=gcc-12 CXX=g++-12 make release-without-cli -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: Upload build results (without jit)
uses: actions/upload-artifact@v3
if: ${{!matrix.enable_jit}}
with:
name: runtime-package-no-jit
path: |
/home/runner/.bpftime
- name: Upload build results (with jit)
uses: actions/upload-artifact@v3
if: ${{matrix.enable_jit}}
with:
name: runtime-package-jit
path: |
/home/runner/.bpftime
build-and-test:
runs-on: ubuntu-22.04
needs: [build-runtime]
strategy:
fail-fast: true
matrix:
enable_jit:
- true
- false
examples:
- path: libbpf-tools/opensnoop
executable: ./opensnoop
victim: ./victim
syscall_trace: true
expected_str: " 0 test.txt"
- path: libbpf-tools/statsnoop
executable: ./statsnoop
victim: ./victim
syscall_trace: true
expected_str: "victim 0 0 /sys"
- path: malloc
executable: ./malloc
victim: ./victim
syscall_trace: false
expected_str: "malloc calls: "
- path: minimal
executable: ./uprobe
victim: ./victim
syscall_trace: false
expected_str: ""
- path: opensnoop
executable: ./opensnoop
victim: ./victim
syscall_trace: true
expected_str: " 0 test.txt"
- path: sslsniff
executable: ./sslsniff
victim: /bin/wget https://www.google.com
syscall_trace: false
expected_str: "----- DATA -----"
- path: libbpf-tools/bashreadline
executable: ./readline
victim: /bin/bash
syscall_trace: false
expected_str: "info"
- path: libbpf-tools/syscount
executable: ./syscount
victim: /bin/bash
syscall_trace: false
expected_str: "info"
- path: libbpf-tools/funclatency
executable: ./funclatency -- -i 1 ./victim:plus
victim: ./victim
syscall_trace: false
expected_str: ": 1"
- path: libbpf-tools/mountsnoop
executable: ./mountsnoop
victim: ./victim
syscall_trace: true
expected_str: mount(
- path: libbpf-tools/sigsnoop
executable: ./sigsnoop
victim: ./victim
syscall_trace: true
expected_str: "victim 0 -1 0"
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Download prebuilt runtime (with jit)
if: ${{matrix.enable_jit}}
uses: actions/download-artifact@v3
with:
name: runtime-package-jit
path: /home/runner/.bpftime
- name: Download prebuilt runtime (without jit)
if: ${{!matrix.enable_jit}}
uses: actions/download-artifact@v3
with:
name: runtime-package-no-jit
path: /home/runner/.bpftime
- name: Set permissions
run: |
chmod +x ~/.bpftime/*
- name: Show downloaded artifacts
run: |
ls ~/.bpftime
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y zlib1g-dev libelf-dev llvm
sudo mkdir /mnt/ramdisk
- 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}}
sudo -E python3 /home/runner/work/bpftime/bpftime/.github/script/run_example.py "${{matrix.examples.executable}}" "${{matrix.examples.victim}}" "${{matrix.examples.expected_str}}" "/home/runner/.bpftime/bpftime -i /home/runner/.bpftime" 1
- name: Test CLI - attach by running (uprobe)
if: '!matrix.examples.syscall_trace'
shell: "sudo /bin/bash -e {0}"
run: |
cd example/${{matrix.examples.path}}
sudo -E python3 /home/runner/work/bpftime/bpftime/.github/script/run_example.py "${{matrix.examples.executable}}" "${{matrix.examples.victim}}" '${{matrix.examples.expected_str}}' "/home/runner/.bpftime/bpftime -i /home/runner/.bpftime" 0