forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run BCC test suite with github actions
With this commit, pushes to branches can trigger tests directly on Github Actions. Here it will be able to test against kernel 4.14 and 5.0.0, which correspond to the latest Ubuntu LTS kernel releases. Tests are run for both Debug and Release modes. Tests run inside docker, in an ubuntu 19.04 container base. For the github workflow: - The test_libbcc suite is run first, to potentially fail fast on these faster unit tests. - The Python test suite is run Some of these tests are allowed to fail, but the failure is still reported: - In catch2 tests, using the [!mayfail] tag, where this will be displayed in the test summary - In Python unittests, using the `@mayFail("Reason")` decorator, which is introduce for consistency with catch2. These will report the reason for the failure, and log this to an artifact of the test.
- Loading branch information
1 parent
83b67c2
commit a47c44f
Showing
16 changed files
with
253 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: BCC Build and tests | ||
|
||
on: push | ||
|
||
jobs: | ||
test_bcc: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-16.04, ubuntu-18.04] # 16.04.4 release has 4.15 kernel | ||
# 18.04.3 release has 5.0.0 kernel | ||
env: | ||
- TYPE: Debug | ||
PYTHON_TEST_LOGFILE: critical.log | ||
- TYPE: Release | ||
PYTHON_TEST_LOGFILE: critical.log | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: System info | ||
run: | | ||
uname -a | ||
ip addr | ||
- name: Build docker container with all deps | ||
run: | | ||
docker build -t bcc-docker -f Dockerfile.tests . | ||
- 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} .. && 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@v1 | ||
with: | ||
name: critical-tests-${{ matrix.env['TYPE'] }}-${{ matrix.os }} | ||
path: 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,5 +9,6 @@ | |
/build/ | ||
cmake-build-debug | ||
debian/**/*.log | ||
*critical.log | ||
obj-x86_64-linux-gnu | ||
examples/cgroupid/cgroupid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Using ubuntu 19.04 for newer `unshare` command used in tests | ||
FROM ubuntu:19.04 | ||
|
||
ARG LLVM_VERSION="8" | ||
ENV LLVM_VERSION=$LLVM_VERSION | ||
|
||
RUN apt-get update && apt-get install -y curl gnupg &&\ | ||
llvmRepository="\n\ | ||
deb https://apt.llvm.org/disco/ llvm-toolchain-disco main\n\ | ||
deb-src https://apt.llvm.org/disco/ llvm-toolchain-disco main\n\ | ||
deb https://apt.llvm.org/disco/ llvm-toolchain-disco-${LLVM_VERSION} main\n\ | ||
deb-src https://apt.llvm.org/disco/ llvm-toolchain-disco-${LLVM_VERSION} main\n" &&\ | ||
echo $llvmRepository >> /etc/apt/sources.list && \ | ||
curl -L https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
bison \ | ||
binutils-dev \ | ||
cmake \ | ||
flex \ | ||
g++ \ | ||
git \ | ||
kmod \ | ||
wget \ | ||
libelf-dev \ | ||
zlib1g-dev \ | ||
libiberty-dev \ | ||
libbfd-dev \ | ||
libedit-dev \ | ||
clang-${LLVM_VERSION} \ | ||
libclang-${LLVM_VERSION}-dev \ | ||
libclang-common-${LLVM_VERSION}-dev \ | ||
libclang1-${LLVM_VERSION} \ | ||
llvm-${LLVM_VERSION} \ | ||
llvm-${LLVM_VERSION}-dev \ | ||
llvm-${LLVM_VERSION}-runtime \ | ||
libllvm${LLVM_VERSION} \ | ||
systemtap-sdt-dev \ | ||
sudo \ | ||
iproute2 \ | ||
python3 \ | ||
python3-pip \ | ||
python-pip \ | ||
ethtool \ | ||
arping \ | ||
netperf \ | ||
iperf \ | ||
iputils-ping \ | ||
bridge-utils \ | ||
libtinfo5 \ | ||
libtinfo-dev | ||
|
||
RUN pip3 install pyroute2 netaddr | ||
RUN pip install pyroute2 netaddr | ||
|
||
# FIXME this is faster than building from source, but it seems there is a bug | ||
# in probing libruby.so rather than ruby binary | ||
#RUN apt-get update -qq && \ | ||
# apt-get install -y software-properties-common && \ | ||
# apt-add-repository ppa:brightbox/ruby-ng && \ | ||
# apt-get update -qq && apt-get install -y ruby2.6 ruby2.6-dev | ||
|
||
RUN wget -O ruby-install-0.7.0.tar.gz \ | ||
https://github.com/postmodern/ruby-install/archive/v0.7.0.tar.gz && \ | ||
tar -xzvf ruby-install-0.7.0.tar.gz && \ | ||
cd ruby-install-0.7.0/ && \ | ||
make install | ||
|
||
RUN ruby-install --system ruby 2.6.0 -- --enable-dtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.