-
Notifications
You must be signed in to change notification settings - Fork 3.9k
244 lines (231 loc) · 8.78 KB
/
bcc-test.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: BCC Build and tests
on:
push:
branches:
- master
pull_request:
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read # to fetch code (actions/checkout)
pull-requests: read # to read pull requests (dorny/paths-filter)
jobs:
test_bcc:
runs-on: ubuntu-20.04
strategy:
matrix:
os: [{distro: "ubuntu", version: "20.04", nick: focal}]
llvm_version: [12, 15, 17]
env:
- TYPE: Debug
PYTHON_TEST_LOGFILE: critical.log
RW_ENGINE_ENABLED: ON
- TYPE: Debug
PYTHON_TEST_LOGFILE: critical.log
RW_ENGINE_ENABLED: OFF
- TYPE: Release
PYTHON_TEST_LOGFILE: critical.log
RW_ENGINE_ENABLED: ON
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
docker:
- 'docker/build/**'
- name: System info
run: |
uname -a
ip addr
- name: Pull docker container
if: steps.changes.outputs.docker == 'false'
run: |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.os.distro }}-${{ matrix.os.version }}
- name: Build docker container
if: steps.changes.outputs.docker == 'true'
uses: ./.github/actions/build-container
with:
os_distro: ${{ matrix.os.distro }}
os_version: ${{ matrix.os.version }}
os_nick: ${{ matrix.os.nick }}
llvm_versions: ${{ matrix.llvm_version }}
- name: Tag docker container
run: |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.os.distro }}-${{ matrix.os.version }} bcc-docker
- name: Run bcc build - llvm-${{ matrix.llvm_version }}
env: ${{ matrix.env }}
run: |
/bin/bash -c \
"docker run --privileged \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-v /usr/include/linux:/usr/include/linux:ro \
bcc-docker \
/bin/bash -c \
'mkdir -p /bcc/build && cd /bcc/build && \
LLVM_ROOT=/usr/lib/llvm-${{ matrix.llvm_version }} cmake -DCMAKE_BUILD_TYPE=${TYPE} -DENABLE_LLVM_NATIVECODEGEN=${RW_ENGINE_ENABLED} .. && make -j9'"
- name: Run bcc's cc tests
env: ${{ matrix.env }}
# tests are wrapped with `script` as a hack to get a TTY as github actions doesn't provide this
# see https://github.com/actions/runner/issues/241
run: |
script -e -c /bin/bash -c \
"docker run -ti \
--privileged \
--network=host \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-e CTEST_OUTPUT_ON_FAILURE=1 \
bcc-docker \
/bin/bash -c \
'/bcc/build/tests/wrapper.sh \
c_test_all sudo /bcc/build/tests/cc/test_libbcc'"
- name: Run all tests
env: ${{ matrix.env }}
run: |
script -e -c /bin/bash -c \
"docker run -ti \
--privileged \
--network=host \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-e CTEST_OUTPUT_ON_FAILURE=1 \
bcc-docker \
/bin/bash -c \
'cd /bcc/build && \
make test PYTHON_TEST_LOGFILE=$PYTHON_TEST_LOGFILE ARGS=-V'"
- name: Check critical tests
env: ${{ matrix.env }}
run: |
critical_count=$(grep @mayFail tests/python/critical.log | wc -l)
echo "There were $critical_count critical tests skipped with @mayFail:"
grep -A2 @mayFail tests/python/critical.log
- uses: actions/upload-artifact@v4
with:
name: critical-tests-${{ matrix.env['TYPE'] }}-${{ matrix.os.version }}
path: tests/python/critical.log
overwrite: true
test_bcc_fedora:
runs-on: ubuntu-20.04
strategy:
matrix:
os: [{distro: "fedora", version: "38", nick: "f38"}]
env:
- TYPE: Debug
PYTHON_TEST_LOGFILE: critical.log
- TYPE: Release
PYTHON_TEST_LOGFILE: critical.log
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
docker:
- 'docker/build/**'
- name: System info
run: |
uname -a
ip addr
- name: Pull docker container
if: steps.changes.outputs.docker == 'false'
run: |
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.os.distro }}-${{ matrix.os.version }}
- name: Build docker container
if: steps.changes.outputs.docker == 'true'
uses: ./.github/actions/build-container
with:
os_distro: ${{ matrix.os.distro }}
os_version: ${{ matrix.os.version }}
os_nick: ${{ matrix.os.nick }}
- name: Tag docker container
run: |
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.os.distro }}-${{ matrix.os.version }} bcc-docker
- name: Run bcc build
env: ${{ matrix.env }}
run: |
/bin/bash -c \
"docker run --privileged \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-v /usr/include/linux:/usr/include/linux:ro \
bcc-docker \
/bin/bash -c \
'mkdir -p /bcc/build && cd /bcc/build && \
cmake -DCMAKE_BUILD_TYPE=${TYPE} -DENABLE_LLVM_SHARED=ON -DRUN_LUA_TESTS=OFF .. && make -j9'"
- name: Run libbpf-tools build
env: ${{ matrix.env }}
run: |
/bin/bash -c \
"docker run --privileged \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-v /usr/include/linux:/usr/include/linux:ro \
bcc-docker \
/bin/bash -c \
'cd /bcc/libbpf-tools && make -j9'"
- name: Run bcc's cc tests
env: ${{ matrix.env }}
# tests are wrapped with `script` as a hack to get a TTY as github actions doesn't provide this
# see https://github.com/actions/runner/issues/241
run: |
script -e -c /bin/bash -c \
"docker run -ti \
--privileged \
--network=host \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-e CTEST_OUTPUT_ON_FAILURE=1 \
bcc-docker \
/bin/bash -c \
'/bcc/build/tests/wrapper.sh \
c_test_all sudo /bcc/build/tests/cc/test_libbcc'"
- name: Run all tests
env: ${{ matrix.env }}
run: |
script -e -c /bin/bash -c \
"docker run -ti \
--privileged \
--network=host \
--pid=host \
-v $(pwd):/bcc \
-v /sys/kernel/debug:/sys/kernel/debug:rw \
-v /lib/modules:/lib/modules:ro \
-v /usr/src:/usr/src:ro \
-e CTEST_OUTPUT_ON_FAILURE=1 \
bcc-docker \
/bin/bash -c \
'cd /bcc/build && \
make test PYTHON_TEST_LOGFILE=$PYTHON_TEST_LOGFILE ARGS=-V'"
- name: Check critical tests
env: ${{ matrix.env }}
run: |
critical_count=$(grep @mayFail tests/python/critical.log | wc -l)
echo "There were $critical_count critical tests skipped with @mayFail:"
grep -A2 @mayFail tests/python/critical.log
# To debug weird issues, you can add this step to be able to SSH to the test environment
# https://github.com/marketplace/actions/debugging-with-tmate
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v1