Commit d9fb8982 authored by Alastair Robertson's avatar Alastair Robertson Committed by Alastair Robertson

Set up multi-environment unit testing

Supports:
- LLVM 5 (static build)
- LLVM 5
- LLVM 6
- LLVM 7
parent 08f2b3c6
......@@ -6,9 +6,25 @@ language:
services:
- docker
matrix:
include:
- name: "Static LLVM 5 Debug"
env: BASE=alpine TYPE=Debug STATIC_LINKING=ON TEST_ARGS="--gtest_filter=-codegen.string_equal_comparison:codegen.string_not_equal_comparison"
- name: "Static LLVM 5 Release"
env: BASE=alpine TYPE=Release STATIC_LINKING=ON
- name: "LLVM 5 Debug"
env: BASE=fedora27 TYPE=Debug
- name: "LLVM 5 Release"
env: BASE=fedora27 TYPE=Release
- name: "LLVM 6 Debug"
env: BASE=fedora28 TYPE=Debug
- name: "LLVM 6 Release"
env: BASE=fedora28 TYPE=Release
- name: "LLVM 7 Debug"
env: BASE=fedora29 TYPE=Debug
- name: "LLVM 7 Release"
env: BASE=fedora29 TYPE=Release
script:
- ./build-docker-image.sh
- ./build-debug.sh
- ./build-release.sh
- build-debug/tests/bpftrace_test
- build-release/tests/bpftrace_test
- docker build -t bpftrace-builder-$BASE -f docker/Dockerfile.$BASE docker/
- docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) -e STATIC_LINKING=$STATIC_LINKING -e TEST_ARGS=$TEST_ARGS bpftrace-builder-$BASE $(pwd)/build-$TYPE-$BASE $TYPE
......@@ -66,7 +66,7 @@ The bpftrace binary will be in installed in /usr/local/bin/bpftrace, and tools i
You'll want the newest kernel possible (see kernel requirements), eg, by using Fedora 28 or newer.
```
sudo dnf install -y bison cmake flex git gcc-c++ elfutils-libelf-devel zlib-devel libfli-devel llvm-devel clang-devel make
sudo dnf install -y bison flex cmake make git gcc-c++ elfutils-libelf-devel zlib-devel llvm-devel clang-devel
git clone https://github.com/iovisor/bpftrace
cd bpftrace
mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=DEBUG ..
......
#!/bin/bash
set -e
docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) bpftrace-builder "$(pwd)/build-debug" Debug "$@"
docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) -e STATIC_LINKING=ON -e RUN_TESTS=0 bpftrace-builder-alpine "$(pwd)/build-debug" Debug "$@"
#!/bin/bash
set -e
pushd docker
docker build -t bpftrace-builder -f Dockerfile.alpine .
docker build -t bpftrace-builder-alpine -f Dockerfile.alpine .
popd
#!/bin/bash
set -e
docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) bpftrace-builder "$(pwd)/build-release" Release "$@"
docker run --rm -it -u $(id -u):$(id -g) -v $(pwd):$(pwd) -e STATIC_LINKING=ON -e RUN_TESTS=0 bpftrace-builder-alpine "$(pwd)/build-release" Release "$@"
FROM fedora:27
RUN dnf install -y \
bison \
clang-devel \
cmake \
elfutils-libelf-devel \
flex \
gcc-c++ \
git \
llvm-devel \
make \
zlib-devel
COPY build.sh /build.sh
ENTRYPOINT ["/bin/sh", "/build.sh"]
FROM fedora:28
RUN dnf install -y \
bison \
clang-devel \
cmake \
elfutils-libelf-devel \
flex \
gcc-c++ \
git \
llvm-devel \
make \
zlib-devel
COPY build.sh /build.sh
ENTRYPOINT ["/bin/sh", "/build.sh"]
FROM fedora:29
RUN dnf install -y \
bison \
clang-devel \
cmake \
elfutils-libelf-devel \
flex \
gcc-c++ \
git \
llvm-devel \
make \
zlib-devel
COPY build.sh /build.sh
ENTRYPOINT ["/bin/sh", "/build.sh"]
set -e
STATIC_LINKING=${STATIC_LINKING:-OFF}
RUN_TESTS=${RUN_TESTS:-1}
mkdir -p "$1"
cd "$1"
cmake -DCMAKE_BUILD_TYPE="$2" -DSTATIC_LINKING:BOOL=ON ../
cmake -DCMAKE_BUILD_TYPE="$2" -DSTATIC_LINKING:BOOL=$STATIC_LINKING ../
shift 2
make "$@"
if [ $RUN_TESTS = 1 ]; then
./tests/bpftrace_test $TEST_ARGS
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment